diff --git a/ALIROOT/binaliroot.pkg b/ALIROOT/binaliroot.pkg index dfce83819e0..e49fb9b55a1 100644 --- a/ALIROOT/binaliroot.pkg +++ b/ALIROOT/binaliroot.pkg @@ -7,7 +7,7 @@ ELIBSDIR:= -ELIBS:= MUONgeometry MUONrec MUONsim MUONbase MUONtrigger MUONraw MUONcalib MUONmapping \ +ELIBS:= MUONgeometry MUONrec MUONsim MUONbase MUONraw MUONcalib MUONmapping \ TPCbase TPCsim TPCrec TPCfast \ ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase \ TRDsim TRDrec TRDfast \ @@ -21,7 +21,7 @@ ELIBS:= MUONgeometry MUONrec MUONsim MUONbase MUONtrigger MUONraw MUONcalib MUON hijing TMEVSIM mevsim THbtp HBTP TEPEMGEN EPEMGEN \ FASTSIM microcern \ RAWDatabase RAWDatarec RAWDatasim \ - HLTbase AliHLTSrc AliHLTComp AliHLTMisc AliHLTMUON MUONevaluation \ + HLTbase AliHLTSrc AliHLTComp AliHLTMisc AliHLTMUON \ AliHLTHough AliHLTITS\ # THerwig herwig TPHIC diff --git a/ANALYSIS/ANALYSISLinkDef.h b/ANALYSIS/ANALYSISLinkDef.h index c14e5a65469..8cb375cea76 100644 --- a/ANALYSIS/ANALYSISLinkDef.h +++ b/ANALYSIS/ANALYSISLinkDef.h @@ -13,7 +13,7 @@ #pragma link C++ class AliAnalysisSelector+; #ifdef WITHXML -#pragma link C++ class AliAnalysisGoodies+; +//#pragma link C++ class AliAnalysisGoodies+; #pragma link C++ class AliTagAnalysis+; #pragma link C++ class AliXMLCollection+; #endif diff --git a/ANALYSIS/AliAnalysisDataContainer.cxx b/ANALYSIS/AliAnalysisDataContainer.cxx index d551dd36cc6..004491f031b 100644 --- a/ANALYSIS/AliAnalysisDataContainer.cxx +++ b/ANALYSIS/AliAnalysisDataContainer.cxx @@ -266,7 +266,7 @@ void AliAnalysisDataContainer::PrintContainer(Option_t *option, Int_t indent) co opt.ToLower(); Bool_t dep = (opt.Contains("dep"))?kTRUE:kFALSE; if (!dep) { - printf("%sContainer: %s type: %s POST_LOOP=%i", ind.Data(), GetName(), GetTitle(), IsPostEventLoop()); + printf("%sContainer: %s type: %s", ind.Data(), GetName(), GetTitle()); if (fProducer) printf("%s = Data producer: task %s",ind.Data(),fProducer->GetName()); else diff --git a/ANALYSIS/AliAnalysisDataContainer.h b/ANALYSIS/AliAnalysisDataContainer.h index 5e2a87001a4..5e583830c4e 100644 --- a/ANALYSIS/AliAnalysisDataContainer.h +++ b/ANALYSIS/AliAnalysisDataContainer.h @@ -38,9 +38,6 @@ enum ENotifyMessage { kSaveData, kFileChange }; -enum EAnalysisContainerFlags { - kPostEventLoop = BIT(14) -}; AliAnalysisDataContainer(); AliAnalysisDataContainer(const AliAnalysisDataContainer &cont); AliAnalysisDataContainer(const char *name, TClass *type); @@ -59,7 +56,6 @@ enum EAnalysisContainerFlags { void ResetDataReady() {fDataReady = kFALSE;} virtual Bool_t SetData(TObject *data, Option_t *option=""); void SetDataOwned(Bool_t flag) {fOwnedData = flag;} - void SetPostEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kPostEventLoop,flag);} void SetFileName(const char *filename) {fFileName = filename;} void SetProducer(AliAnalysisTask *prod, Int_t islot); void AddConsumer(AliAnalysisTask *cons, Int_t islot); @@ -69,7 +65,6 @@ enum EAnalysisContainerFlags { void ImportData(AliAnalysisDataWrapper *pack); // Container status checking Bool_t IsDataReady() const {return fDataReady;} - Bool_t IsPostEventLoop() const {return TObject::TestBit(kPostEventLoop);} Bool_t IsOwnedData() const {return fOwnedData;} Bool_t ClientsExecuted() const; Bool_t HasConsumers() const {return (fConsumers != 0);} diff --git a/ANALYSIS/AliAnalysisDataSlot.cxx b/ANALYSIS/AliAnalysisDataSlot.cxx index d859515d381..de55e65e451 100644 --- a/ANALYSIS/AliAnalysisDataSlot.cxx +++ b/ANALYSIS/AliAnalysisDataSlot.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include "AliAnalysisDataSlot.h" #include "AliAnalysisTask.h" @@ -138,30 +137,6 @@ void *AliAnalysisDataSlot::GetBranchAddress(const char *branchname) const return br->GetAddress(); } -//______________________________________________________________________________ -Int_t AliAnalysisDataSlot::EnableBranch(const char *bname, TTree *tree) -{ -// Static method to enable recursively a branch in a tree (why this in not in ROOT?) - TBranch *branch = tree->GetBranch(bname); - Int_t count = 0; -// static Int_t indent = 0; - if (!branch) return count; -// TString s; -// for (Int_t i=0; iGetName(), branch->TestBit(kDoNotProcess)); - branch->SetBit(kDoNotProcess, kFALSE); - TIter next(branch->GetListOfBranches()); - TBranch *branch_sub; - // Activate all sub-branches -// indent++; - while ((branch_sub=(TBranch*)next())) { - count += AliAnalysisDataSlot::EnableBranch(branch_sub->GetName(), tree); - } -// indent--; - return count; -} - //______________________________________________________________________________ Bool_t AliAnalysisDataSlot::SetBranchAddress(const char *branchname, void *address) { @@ -172,6 +147,7 @@ Bool_t AliAnalysisDataSlot::SetBranchAddress(const char *branchname, void *addre return kFALSE; } TTree *tree = (TTree*)GetData(); + tree->SetBranchStatus(branchname,1); tree->SetBranchAddress(branchname, address); return kTRUE; } diff --git a/ANALYSIS/AliAnalysisDataSlot.h b/ANALYSIS/AliAnalysisDataSlot.h index ad023125903..87c7154b569 100644 --- a/ANALYSIS/AliAnalysisDataSlot.h +++ b/ANALYSIS/AliAnalysisDataSlot.h @@ -18,7 +18,6 @@ #endif class TClass; -class TTree; class AliAnalysisDataContainer; class AliAnalysisTask; @@ -34,7 +33,6 @@ class AliAnalysisDataSlot : public TNamed { AliAnalysisDataSlot &operator=(const AliAnalysisDataSlot &slot); // Connect some container to the slot Bool_t ConnectContainer(AliAnalysisDataContainer *cont); - static Int_t EnableBranch(const char *bname, TTree *tree); // Getters void *GetBranchAddress(const char *branch) const; Bool_t SetBranchAddress(const char *branch, void *address); diff --git a/ANALYSIS/AliAnalysisGoodies.cxx b/ANALYSIS/AliAnalysisGoodies.cxx index b78d9f3300a..f3eb3874576 100644 --- a/ANALYSIS/AliAnalysisGoodies.cxx +++ b/ANALYSIS/AliAnalysisGoodies.cxx @@ -26,10 +26,12 @@ #include "AliAnalysisGoodies.h" #include "AliAnalysisManager.h" #include "AliAnalysisTask.h" + //#include "AliPhotonAnalysisTask.h" #include "AliLog.h" #include #ifdef WITHALIEN +#include #include #include #endif @@ -41,8 +43,6 @@ //______________________________________________________________________________ AliAnalysisGoodies::AliAnalysisGoodies() : - TObject(), - fTimer(), fESDTreeName("esdTree"), fnumberOfTasks(0), fTaskList(0), @@ -59,26 +59,6 @@ AliAnalysisGoodies::AliAnalysisGoodies() : AliInfo("You are not connected to the GRID") ; } -//______________________________________________________________________________ -AliAnalysisGoodies::AliAnalysisGoodies(const AliAnalysisGoodies& ag) : - TObject(), - fTimer(), - fESDTreeName(""), - fnumberOfTasks(0), - fTaskList(0), - fTaskInType(0), - fTaskOuType(0) -{ - - fESDTreeName = ag.fESDTreeName ; - TString token = gSystem->Getenv("GRID_TOKEN") ; - - if ( token == "OK" ) - TGrid::Connect("alien://"); - else - AliInfo("You are not connected to the GRID") ; -} - //______________________________________________________________________________ void AliAnalysisGoodies::Help() const { @@ -176,7 +156,7 @@ Bool_t AliAnalysisGoodies::Alien2Local(const TString collectionNameIn, const TSt } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::Make(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const +Bool_t AliAnalysisGoodies::Make(AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const { // makes esd collection from tags // usage Make(tags, esds) @@ -192,9 +172,9 @@ Bool_t AliAnalysisGoodies::Make(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, TString file(in) ; if ( file.Contains(".root") ) - rv = MakeEsdCollectionFromTagFile(runCuts, lhcCuts, detCuts, evtCuts, file.Data(), out) ; + rv = MakeEsdCollectionFromTagFile(runCuts, evtCuts, file.Data(), out) ; else if ( file.Contains(".xml") ) - rv = MakeEsdCollectionFromTagCollection(runCuts, lhcCuts, detCuts, evtCuts, file.Data(), out) ; + rv = MakeEsdCollectionFromTagCollection(runCuts, evtCuts, file.Data(), out) ; else { AliError(Form("%s is not a valid file format", in)) ; rv = kFALSE ; @@ -204,7 +184,7 @@ Bool_t AliAnalysisGoodies::Make(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagFile(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const +Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagFile(AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const { // Makes an esd collection from a root tag file Bool_t rv = kTRUE ; @@ -218,14 +198,14 @@ Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagFile(AliRunTagCuts *runCuts, if ( ! rv ) return rv ; - tagAna->CreateXMLCollection(out, runCuts, lhcCuts, detCuts, evtCuts) ; + tagAna->CreateXMLCollection(out, runCuts, evtCuts) ; return rv ; } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const +Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts, const char * in, const char * out) const { // Makes an esd collection from a xml tag collection Bool_t rv = kTRUE ; @@ -236,12 +216,12 @@ Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(AliRunTagCuts *run #ifdef WITHALIEN - TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(%s)",in)); + TGridCollection * collection = TAlienCollection::Open(in); TGridResult* result = collection->GetGridResult(""); AliTagAnalysis * tagAna = new AliTagAnalysis(); tagAna->ChainGridTags(result); - tagAna->CreateXMLCollection(out, runCuts, lhcCuts, detCuts, evtCuts) ; + tagAna->CreateXMLCollection(out, runCuts, evtCuts) ; #else rv = kFALSE; @@ -250,7 +230,7 @@ Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(AliRunTagCuts *run } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(const char * runCuts, const char *lhcCuts, const char *detCuts, const char * evtCuts, const char * in, const char * out) const +Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(const char * runCuts, const char * evtCuts, const char * in, const char * out) const { // Makes an esd collection from a xml tag collection @@ -263,17 +243,17 @@ Bool_t AliAnalysisGoodies::MakeEsdCollectionFromTagCollection(const char * runCu #ifdef WITHALIEN - TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(%s)",in)); + TGridCollection * collection = TAlienCollection::Open(in); TGridResult* result = collection->GetGridResult(""); AliTagAnalysis * tagAna = new AliTagAnalysis(); tagAna->ChainGridTags(result); - tagAna->CreateXMLCollection(out, runCuts, lhcCuts, detCuts, evtCuts) ; + tagAna->CreateXMLCollection(out, runCuts, evtCuts) ; + return rv ; #else - rv = kFALSE; + return kFALSE; #endif - return rv ; } //______________________________________________________________________ @@ -299,7 +279,7 @@ Bool_t AliAnalysisGoodies::Merge(const char * collectionFile, const char * subFi #ifdef WITHALIEN - TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(%s)",collectionFile)); + TGridCollection * collection = TAlienCollection::Open(collectionFile); TGridResult* result = collection->GetGridResult(""); Int_t index = 0 ; @@ -335,10 +315,10 @@ Bool_t AliAnalysisGoodies::Merge(const char * collectionFile, const char * subFi fTimer.Stop(); fTimer.Print(); + return rv ; #else - rv = kFALSE; + return kFALSE; #endif - return rv ; } //______________________________________________________________________ @@ -363,18 +343,16 @@ Bool_t AliAnalysisGoodies::Process(const char * inFile) // usage Process(esdFile) // esdFile: is of the form opt?file_lfn Bool_t rv = kFALSE ; - AliRunTagCuts * runCuts = 0x0 ; - AliLHCTagCuts * lhcCuts = 0x0 ; - AliDetectorTagCuts * detCuts = 0x0 ; - AliEventTagCuts * evtCuts = 0x0 ; + AliRunTagCuts * runCuts = 0x0 ; + AliEventTagCuts * evtCuts = 0x0 ; - rv = Process(inFile, runCuts, lhcCuts, detCuts, evtCuts) ; + rv = Process(inFile, runCuts, evtCuts) ; return rv ; } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::Process(const char * inFile, AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts * evtCuts ) +Bool_t AliAnalysisGoodies::Process(const char * inFile, AliRunTagCuts *runCuts, AliEventTagCuts * evtCuts ) { // process the events with an Analysis Task // usage Process(esdFile, runtagCuts, evtTagCuts) @@ -395,11 +373,11 @@ Bool_t AliAnalysisGoodies::Process(const char * inFile, AliRunTagCuts *runCuts, } else if (file.Contains("tag?") && file.Contains(".root") ) { file.ReplaceAll("tag?", "") ; - rv = ProcessTagFile(file.Data(), runCuts, lhcCuts, detCuts, evtCuts) ; + rv = ProcessTagFile(file.Data(), runCuts, evtCuts) ; } else if (file.Contains("tag?") && file.Contains(".xml") ) { file.ReplaceAll("tag?", "") ; - rv = ProcessTagXmlCollection(file.Data(), runCuts, lhcCuts, detCuts, evtCuts) ; + rv = ProcessTagXmlCollection(file.Data(), runCuts, evtCuts) ; } else { AliError(Form("%s is not a valid file format", inFile)) ; @@ -413,7 +391,7 @@ Bool_t AliAnalysisGoodies::Process(const char * inFile, AliRunTagCuts *runCuts, } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::Process(const char * inFile, const char * runCuts, const char * lhcCuts, const char * detCuts, const char * evtCuts) +Bool_t AliAnalysisGoodies::Process(const char * inFile, const char * runCuts, const char * evtCuts) { // process the events with an Analysis Task // usage Process(esdFile, runtagCuts, evtTagCuts) @@ -434,11 +412,11 @@ Bool_t AliAnalysisGoodies::Process(const char * inFile, const char * runCuts, co } else if (file.Contains("tag?") && file.Contains(".root") ) { file.ReplaceAll("tag?", "") ; - rv = ProcessTagFile(file.Data(), runCuts, lhcCuts, detCuts, evtCuts) ; + rv = ProcessTagFile(file.Data(), runCuts, evtCuts) ; } else if (file.Contains("tag?") && file.Contains(".xml") ) { file.ReplaceAll("tag?", "") ; - rv = ProcessTagXmlCollection(file.Data(), runCuts, lhcCuts, detCuts, evtCuts) ; + rv = ProcessTagXmlCollection(file.Data(), runCuts, evtCuts) ; } else { AliError(Form("%s is not a valid file format", inFile)) ; @@ -483,10 +461,12 @@ Bool_t AliAnalysisGoodies::ProcessChain(TChain * chain) const mgr->ConnectOutput(task, 0, taskOutput); } - // start processing + // Open data +// taskInput->SetData(chain); if (mgr->InitAnalysis()) { mgr->PrintStatus(); +// chain->Process(mgr); mgr->StartAnalysis("local",chain); } else rv = kFALSE ; @@ -519,7 +499,7 @@ Bool_t AliAnalysisGoodies::ProcessEsdFile(const char * esdFile) const } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts) const +Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts) const { // process the events in a single Tag file with an Analysis Task // usage ProcessLocalEsdFile(tagFile) @@ -543,7 +523,7 @@ Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, AliRunTagCuts *r // Query the tag file and make the analysis chain TChain * analysisChain = new TChain(fESDTreeName) ; - analysisChain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evtCuts); + analysisChain = tagAna->QueryTags(runCuts, evtCuts); // Process the events rv = ProcessChain(analysisChain) ; @@ -552,7 +532,7 @@ Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, AliRunTagCuts *r } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, const char * runCuts, const char * lhcCuts, const char * detCuts, const char * evtCuts) const +Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, const char * runCuts, const char * evtCuts) const { // process the events in a single Tag file with an Analysis Task // usage ProcessLocalEsdFile(tagFile) @@ -577,7 +557,7 @@ Bool_t AliAnalysisGoodies::ProcessTagFile(const char * tagFile, const char * run // Query the tag file and make the analysis chain TChain * analysisChain = new TChain(fESDTreeName) ; - analysisChain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evtCuts); + analysisChain = tagAna->QueryTags(runCuts, evtCuts); // Process the events rv = ProcessChain(analysisChain) ; @@ -600,7 +580,7 @@ Bool_t AliAnalysisGoodies::ProcessEsdXmlCollection(const char * xmlFile) const #ifdef WITHALIEN - TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(%s)",xmlFile)); + TGridCollection * collection = TAlienCollection::Open(xmlFile) ; if (! collection) { AliError(Form("%s not found", xmlFile)) ; return kFALSE ; @@ -617,14 +597,14 @@ Bool_t AliAnalysisGoodies::ProcessEsdXmlCollection(const char * xmlFile) const // Process the events rv = ProcessChain(analysisChain) ; + return rv ; #else - rv = kFALSE; + return kFALSE; #endif - return rv ; } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts * evtCuts) const +Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, AliRunTagCuts *runCuts, AliEventTagCuts * evtCuts) const { // process the events in a xml ESD collection with an Analysis Task // usage ProcessLocalEsdFile(xmlFile) @@ -647,7 +627,7 @@ Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, AliRunT #ifdef WITHALIEN - TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(%s)",xmlFile)); + TGridCollection * collection = TAlienCollection::Open(xmlFile) ; if (! collection) { AliError(Form("%s not found", xmlFile)) ; return kFALSE ; @@ -659,19 +639,19 @@ Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, AliRunT // Query the tag file and make the analysis chain TChain * analysisChain = new TChain(fESDTreeName) ; - analysisChain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evtCuts); + analysisChain = tagAna->QueryTags(runCuts, evtCuts); // Process the events rv = ProcessChain(analysisChain) ; + return rv ; #else - rv = kFALSE; + return kFALSE; #endif - return rv ; } //______________________________________________________________________ -Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, const char * runCuts, const char * lhcCuts, const char * detCuts, const char * evtCuts) const +Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, const char * runCuts, const char * evtCuts) const { // process the events in a xml ESD collection with an Analysis Task // usage ProcessLocalEsdFile(xmlFile) @@ -694,7 +674,7 @@ Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, const c if ( gSystem->AccessPathName(xmlFile) ) TGrid::Connect("alien://"); - TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(%s)",xmlFile)); + TGridCollection * collection = TAlienCollection::Open(xmlFile) ; if (! collection) { AliError(Form("%s not found", xmlFile)) ; return kFALSE ; @@ -706,15 +686,15 @@ Bool_t AliAnalysisGoodies::ProcessTagXmlCollection(const char * xmlFile, const c // Query the tag file and make the analysis chain TChain * analysisChain = new TChain(fESDTreeName) ; - analysisChain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evtCuts); + analysisChain = tagAna->QueryTags(runCuts, evtCuts); // Process the events rv = ProcessChain(analysisChain) ; + return rv ; #else - rv = kFALSE; + return kFALSE; #endif - return rv ; } //______________________________________________________________________ diff --git a/ANALYSIS/AliAnalysisGoodies.h b/ANALYSIS/AliAnalysisGoodies.h index cc259dfe46c..5774dbbd630 100644 --- a/ANALYSIS/AliAnalysisGoodies.h +++ b/ANALYSIS/AliAnalysisGoodies.h @@ -19,41 +19,39 @@ class TChain ; class TClass ; class AliEventTagCuts ; class AliRunTagCuts ; -class AliLHCTagCuts ; -class AliDetectorTagCuts ; class AliAnalysisGoodies : public TObject { public: AliAnalysisGoodies() ; - AliAnalysisGoodies(const AliAnalysisGoodies& ag) ; ~AliAnalysisGoodies() {;} virtual void Help() const; Bool_t Alien2Local(const TString collectionNameIn, const TString localDir) ; - Bool_t Make(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const ; + Bool_t Make(AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const ; Bool_t Merge(const char * collection, const char * subFile = 0, const char * outFile = 0) ; Bool_t Register( const char * lfndir, const char * pfndir, const char * file) ; Bool_t Process(TChain * chain) ; Bool_t Process(const char * esdFile) ; - Bool_t Process(const char * inFile, AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts * evtCuts ) ; - Bool_t Process(const char * inFile, const char * runCuts, const char * lhcCuts, const char * detCuts, const char * evtCuts) ; - void SetESDTreeName(const char * name) { fESDTreeName = name ; } + Bool_t Process(const char * esdFile, AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts) ; + Bool_t Process(const char * esdFile, const char * runCuts, const char * evtCuts) ; + void SetESDTreeName(const char * name) { fESDTreeName = name ; } void SetTasks(Int_t nb, AliAnalysisTask ** taskList, TClass ** inputType, TClass ** outputType) ; - Bool_t MakeEsdCollectionFromTagFile(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const ; + Bool_t MakeEsdCollectionFromTagFile(AliRunTagCuts * runCuts, AliEventTagCuts * evCuts, const char * in, const char * out) const ; private: Bool_t MakeEsdCollectionFromTagFile(const char * , const char * , const char * , const char *) const ; - Bool_t MakeEsdCollectionFromTagCollection(AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts, const char * in, const char * out) const ; - Bool_t MakeEsdCollectionFromTagCollection(const char * runCuts, const char *lhcCuts, const char *detCuts, const char * evtCuts, const char * in, const char * out) const ; + //{ AliError("Not implemented") ; return 0 ;} + Bool_t MakeEsdCollectionFromTagCollection(AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts, const char * in, const char * out) const ; + Bool_t MakeEsdCollectionFromTagCollection(const char * , const char * , const char * , const char * ) const ; + //{ AliError("Not implemented") ; return 0 ;} Bool_t ProcessChain(TChain * chain) const ; Bool_t ProcessEsdFile(const char * esdFile) const ; - Bool_t ProcessEsdXmlCollection(const char * xmlFile) const ; - Bool_t ProcessTagFile(const char * tagFile, AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts *evtCuts) const ; + Bool_t ProcessTagFile(const char * tagFile, AliRunTagCuts *runCuts, AliEventTagCuts *evtCuts) const ; Bool_t ProcessTagFile(const char * tagFile, const char * runCuts, const char * evtCuts) const ; - Bool_t ProcessTagFile(const char * tagFile, const char * runCuts, const char * lhcCuts, const char * detCuts, const char * evtCuts) const ; - Bool_t ProcessTagXmlCollection(const char * xmlFile, AliRunTagCuts *runCuts, AliLHCTagCuts *lhcCuts, AliDetectorTagCuts *detCuts, AliEventTagCuts * evtCuts) const ; - Bool_t ProcessTagXmlCollection(const char * xmlFile, const char * runCuts, const char * lhcCuts, const char * detCuts, const char * evtCuts) const ; + Bool_t ProcessEsdXmlCollection(const char * esdFile) const ; + Bool_t ProcessTagXmlCollection(const char * esdFile, AliRunTagCuts * runCuts, AliEventTagCuts * evtCuts) const ; + Bool_t ProcessTagXmlCollection(const char * esdFile, const char * runCuts, const char * evtCuts) const ; TStopwatch fTimer ; //! stopwatch TString fESDTreeName ; //! name of the ESD TTree diff --git a/ANALYSIS/AliAnalysisManager.cxx b/ANALYSIS/AliAnalysisManager.cxx index 29dacf662fd..7e29eb7b95f 100644 --- a/ANALYSIS/AliAnalysisManager.cxx +++ b/ANALYSIS/AliAnalysisManager.cxx @@ -59,7 +59,6 @@ AliAnalysisManager::AliAnalysisManager() { // Dummy constructor. fgAnalysisManager = this; - SetEventLoop(kTRUE); } //______________________________________________________________________________ @@ -85,7 +84,6 @@ AliAnalysisManager::AliAnalysisManager(const char *name, const char *title) fContainers = new TObjArray(); fInputs = new TObjArray(); fOutputs = new TObjArray(); - SetEventLoop(kTRUE); } //______________________________________________________________________________ @@ -210,11 +208,8 @@ void AliAnalysisManager::SlaveBegin(TTree *tree) TIter next(fTasks); AliAnalysisTask *task; // Call CreateOutputObjects for all tasks - while ((task=(AliAnalysisTask*)next())) { - TDirectory *curdir = gDirectory; + while ((task=(AliAnalysisTask*)next())) task->CreateOutputObjects(); - if (curdir) curdir->cd(); - } if (fMode == kLocalAnalysis) Init(tree); if (fDebug > 1) { cout << "<-AliAnalysisManager::SlaveBegin()" << endl; @@ -347,24 +342,6 @@ void AliAnalysisManager::UnpackOutput(TList *source) AliAnalysisDataContainer *output; while ((output=(AliAnalysisDataContainer*)next())) { if (!output->GetData()) continue; - // Check if there are client tasks that run post event loop - if (output->HasConsumers()) { - // Disable event loop semaphore - output->SetPostEventLoop(kTRUE); - TObjArray *list = output->GetConsumers(); - Int_t ncons = list->GetEntriesFast(); - for (Int_t i=0; iAt(i); - task->CheckNotify(kTRUE); - // If task is active, execute it - if (task->IsPostEventLoop() && task->IsActive()) { - if (fDebug > 1) { - cout << "== Executing post event loop task " << task->GetName() << endl; - } - task->ExecuteTask(); - } - } - } // Check if the output need to be written to a file. const char *filename = output->GetFileName(); if (!filename || !strlen(filename)) continue; @@ -380,7 +357,7 @@ void AliAnalysisManager::UnpackOutput(TList *source) callEnv.SetParam((Long_t) file); callEnv.Execute(output->GetData()); } - output->GetData()->Write(); + output->GetData()->Write(); } if (fDebug > 1) { cout << "<-AliAnalysisManager::UnpackOutput()" << endl; @@ -429,10 +406,6 @@ AliAnalysisDataContainer *AliAnalysisManager::CreateContainer(const char *name, // kExchangeContainer = 0, used to exchange date between tasks // kInputContainer = 1, used to store input data // kOutputContainer = 2, used for posting results - if (fContainers->FindObject(name)) { - Error("CreateContainer","A container named %s already defined !\n",name); - return NULL; - } AliAnalysisDataContainer *cont = new AliAnalysisDataContainer(name, datatype); fContainers->Add(cont); switch (type) { @@ -440,6 +413,7 @@ AliAnalysisDataContainer *AliAnalysisManager::CreateContainer(const char *name, fInputs->Add(cont); break; case kOutputContainer: + if (fOutputs->FindObject(name)) printf("CreateContainer: warning: a container named %s existing !\n",name); fOutputs->Add(cont); if (filename && strlen(filename)) cont->SetFileName(filename); break; @@ -561,22 +535,6 @@ Bool_t AliAnalysisManager::InitAnalysis() return kFALSE; } } - // Check that all containers feeding post-event loop tasks are in the outputs list - TIter nextcont(fContainers); // loop over all containers - while ((cont=(AliAnalysisDataContainer*)nextcont())) { - if (!cont->IsPostEventLoop() && !fOutputs->FindObject(cont)) { - if (cont->HasConsumers()) { - // Check if one of the consumers is post event loop - TIter nextconsumer(cont->GetConsumers()); - while ((task=(AliAnalysisTask*)nextconsumer())) { - if (task->IsPostEventLoop()) { - fOutputs->Add(cont); - break; - } - } - } - } - } fInitOK = kTRUE; return kTRUE; } @@ -620,43 +578,23 @@ void AliAnalysisManager::StartAnalysis(const char *type, TTree *tree) Warning("StartAnalysis", "GRID analysis mode not implemented. Running local."); fMode = kLocalAnalysis; } - char line[128]; - SetEventLoop(kFALSE); - // Disable all branches if requested and set event loop mode - if (tree) { - if (TestBit(kDisableBranches)) { - printf("Disabling all branches...\n"); -// tree->SetBranchStatus("*",0); // not yet working - } - SetEventLoop(kTRUE); - } - + char line[128]; + // Disable by default all branches + if (tree) tree->SetBranchStatus("*",0); TChain *chain = dynamic_cast(tree); - - // Initialize locally all tasks - TIter next(fTasks); - AliAnalysisTask *task; - while ((task=(AliAnalysisTask*)next())) { - task->LocalInit(); - } - switch (fMode) { case kLocalAnalysis: if (!tree) { TIter next(fTasks); AliAnalysisTask *task; // Call CreateOutputObjects for all tasks - while ((task=(AliAnalysisTask*)next())) { - TDirectory *curdir = gDirectory; - task->CreateOutputObjects(); - if (curdir) curdir->cd(); - } + while ((task=(AliAnalysisTask*)next())) task->CreateOutputObjects(); ExecAnalysis(); Terminate(); return; } // Run tree-based analysis via AliAnalysisSelector - gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/AliAnalysisSelector.cxx+"); + gROOT->ProcessLine(".L AliAnalysisSelector.cxx+"); cout << "===== RUNNING LOCAL ANALYSIS " << GetName() << " ON TREE " << tree->GetName() << endl; sprintf(line, "AliAnalysisSelector *selector = new AliAnalysisSelector((AliAnalysisManager*)0x%lx);",(ULong_t)this); gROOT->ProcessLine(line); diff --git a/ANALYSIS/AliAnalysisManager.h b/ANALYSIS/AliAnalysisManager.h index 83cf30b54a0..a6021dcd722 100644 --- a/ANALYSIS/AliAnalysisManager.h +++ b/ANALYSIS/AliAnalysisManager.h @@ -38,11 +38,6 @@ enum EAliAnalysisExecMode { kGridAnalysis = 2 }; -enum EAliAnalysisFlags { - kEventLoop = BIT(14), - kDisableBranches = BIT(15) -}; - AliAnalysisManager(); AliAnalysisManager(const char *name, const char *title=""); virtual ~AliAnalysisManager(); @@ -80,7 +75,6 @@ enum EAliAnalysisFlags { void SetAnalysisType(EAliAnalysisExecMode mode) {fMode = mode;} void SetCurrentEntry(Long64_t entry) {fCurrentEntry = entry;} void SetDebugLevel(UInt_t level) {fDebug = level;} - void SetDisableBranches(Bool_t disable=kTRUE) {TObject::SetBit(kDisableBranches,disable);} // Container handling AliAnalysisDataContainer *CreateContainer(const char *name, TClass *datatype, @@ -102,7 +96,6 @@ enum EAliAnalysisFlags { // Analysis initialization and execution, status Bool_t InitAnalysis(); Bool_t IsInitialized() const {return fInitOK;} - Bool_t IsEventLoop() const {return TObject::TestBit(kEventLoop);} void ResetAnalysis(); void ExecAnalysis(Option_t *option=""); void FinishAnalysis(); @@ -110,7 +103,6 @@ enum EAliAnalysisFlags { protected: void ImportWrappers(TList *source); - void SetEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kEventLoop,flag);} private: TTree *fTree; //! Input tree in case of TSelector model diff --git a/ANALYSIS/AliAnalysisSelector.cxx b/ANALYSIS/AliAnalysisSelector.cxx index 3d2870f56a2..0cd1ac115ef 100644 --- a/ANALYSIS/AliAnalysisSelector.cxx +++ b/ANALYSIS/AliAnalysisSelector.cxx @@ -105,8 +105,7 @@ Bool_t AliAnalysisSelector::Notify() // is started when using PROOF. It is normaly not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. - if (fAnalysis) return fAnalysis->Notify(); - return kFALSE; + if (fAnalysis) fAnalysis->Notify(); } //______________________________________________________________________________ diff --git a/ANALYSIS/AliAnalysisTask.cxx b/ANALYSIS/AliAnalysisTask.cxx index 86f9ae3f929..b35021ceeb7 100644 --- a/ANALYSIS/AliAnalysisTask.cxx +++ b/ANALYSIS/AliAnalysisTask.cxx @@ -62,13 +62,7 @@ // } // } // -// The method LocalInit() may be implemented to call locally (on the client) -// all initialization methods of the class. It is not mandatory and was created -// in order to minimize the complexity and readability of the analysis macro. -// DO NOT create in this method the histigrams or task output objects that will -// go in the task output containers. Use CreateOutputObjects for that. -// -// The method CreateOutputObjects() has to be implemented an will contain the +// The method CreateOutputObjects() has to be overloaded an will contain the // objects that should be created only once per session (e.g. output // histograms) // @@ -98,14 +92,12 @@ //============================================================================== #include -#include +#include #include -#include #include "AliAnalysisTask.h" #include "AliAnalysisDataSlot.h" #include "AliAnalysisDataContainer.h" -#include "AliAnalysisManager.h" ClassImp(AliAnalysisTask) @@ -232,11 +224,8 @@ void AliAnalysisTask::CheckNotify(Bool_t init) // accordingly. This method is called automatically for all tasks connected // to a container where the data was published. if (init) fInitialized = kFALSE; - Bool_t single_shot = IsPostEventLoop(); - AliAnalysisDataContainer *cinput; for (Int_t islot=0; islotGetContainer(); - if (!cinput->GetData() || (single_shot && !cinput->IsPostEventLoop())) { + if (!GetInputData(islot)) { SetActive(kFALSE); return; } @@ -287,8 +276,6 @@ Bool_t AliAnalysisTask::ConnectOutput(Int_t islot, AliAnalysisDataContainer *con } // Connect the slot to the container as output if (!output->ConnectContainer(cont)) return kFALSE; - // Set event loop type the same as for the task - cont->SetPostEventLoop(IsPostEventLoop()); // Declare this as the data producer cont->SetProducer(this, islot); AreSlotsConnected(); @@ -384,40 +371,12 @@ Bool_t AliAnalysisTask::SetBranchAddress(Int_t islot, const char *branch, void * return GetInputSlot(islot)->SetBranchAddress(branch, address); } -//______________________________________________________________________________ -void AliAnalysisTask::EnableBranch(Int_t islot, const char *bname) const -{ -// Call this in ConnectInputData() to enable only the branches needed by this -// task. "*" will enable everything. - AliAnalysisDataSlot *input = GetInputSlot(islot); - if (!input || !input->GetType()->InheritsFrom(TTree::Class())) { - Error("EnableBranch", "Wrong slot type #%d for task %s: not TTree-derived type", islot, GetName()); - return; - } - TTree *tree = (TTree*)input->GetData(); - if (!strcmp(bname, "*")) { - tree->SetBranchStatus("*",1); - return; - } - AliAnalysisDataSlot::EnableBranch(bname, tree); -} - //______________________________________________________________________________ void AliAnalysisTask::ConnectInputData(Option_t *) { // Overload and connect your branches here. } -//______________________________________________________________________________ -void AliAnalysisTask::LocalInit() -{ -// The method LocalInit() may be implemented to call locally (on the client) -// all initialization methods of the class. It is not mandatory and was created -// in order to minimize the complexity and readability of the analysis macro. -// DO NOT create in this method the histigrams or task output objects that will -// go in the task output containers. Use CreateOutputObjects for that. -} - //______________________________________________________________________________ void AliAnalysisTask::CreateOutputObjects() { @@ -425,36 +384,6 @@ void AliAnalysisTask::CreateOutputObjects() // task initialization and/or create your output objects here. } -//______________________________________________________________________________ -void AliAnalysisTask::OpenFile(Int_t iout, Option_t *option) const -{ -// This method has to be called INSIDE the user redefined CreateOutputObjects -// method, before creating each object corresponding to the output containers -// that are to be written to a file. This need to be done in general for the big output -// objects that may not fit memory during processing. -// - 'option' is the file opening option. -//========================================================================= -// NOTE !: The method call will be ignored in PROOF mode, in which case the -// results have to be streamed back to the client and written just before Terminate() -//========================================================================= -// -// Example: -// void MyAnaTask::CreateOutputObjects() { -// OpenFile(0); // Will open the file for the object to be written at output #0 -// fAOD = new TTree("AOD for D0toKPi"); -// OpenFile(1); -// now some histos that should go in the file of the second output container -// fHist1 = new TH1F("my quality check hist1",...); -// fHist2 = new TH2F("my quality check hist2",...); -// } - - if (iout<0 || iout>=fNoutputs) return; - AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); - if (!mgr || mgr->GetAnalysisType()==AliAnalysisManager::kProofAnalysis) return; - AliAnalysisDataContainer *cont = GetOutputSlot(iout)->GetContainer(); - if (strlen(cont->GetFileName())) new TFile(cont->GetFileName(), option); -} - //______________________________________________________________________________ Bool_t AliAnalysisTask::Notify() { @@ -539,7 +468,7 @@ void AliAnalysisTask::PrintTask(Option_t *option, Int_t indent) const AliAnalysisDataContainer *cont; for (Int_t i=0; iSetChecked(kFALSE); else { for (islot=0; islotGetContainer(); - if (cont) cont->PrintContainer(option, indent); - } -} - -//______________________________________________________________________________ -void AliAnalysisTask::SetPostEventLoop(Bool_t flag) -{ -// Set the task execution mode - run after event loop or not. All output -// containers of this task will get the same type. - TObject::SetBit(kTaskPostEventLoop,flag); - AliAnalysisDataContainer *cont; - Int_t islot; - for (islot=0; islotGetContainer(); - if (cont) cont->SetPostEventLoop(flag); + cont->PrintContainer(option, indent); } } - diff --git a/ANALYSIS/AliAnalysisTask.h b/ANALYSIS/AliAnalysisTask.h index 37f93c65bf0..2303583662e 100644 --- a/ANALYSIS/AliAnalysisTask.h +++ b/ANALYSIS/AliAnalysisTask.h @@ -29,9 +29,8 @@ class AliAnalysisTask : public TTask { enum EAnalysisTaskFlags { kTaskUsed = BIT(14), kTaskZombie = BIT(15), - kTaskChecked = BIT(16), - kTaskPostEventLoop = BIT(17) - }; + kTaskChecked = BIT(16) + }; protected: Bool_t fReady; // Flag if the task is ready @@ -60,18 +59,14 @@ class AliAnalysisTask : public TTask { Bool_t PostData(Int_t iout, TObject *data, Option_t *option=""); //===================================================================== - // === USE THIS FIRST IN YOUR ConnectInputData() TO CHECH IF A BRANCH IS ALREADY CONNECTED + // === USE THIS FIRST IN YOUR Init() TO CHECH IF A BRANCH IS ALREADY CONNECTED // TO SOME ADDRESS. char *GetBranchAddress(Int_t islot, const char *branch) const; - // === CALL THIS AFTERWARDS IN ConnectInputData() IF THE BRANCH ADDRESS IS NOT YET SET + // === CALL THIS AFTERWARDS IN Init() IF THE BRANCH ADDRESS IS NOT YET SET Bool_t SetBranchAddress(Int_t islot, const char *branch, void *address) const; //===================================================================== - //=== CALL IN ConnectInputData() TO ENABLE ONLY EXPLICIT BRANCHES NEEDED FOR THIS TASK EXECUTION - void EnableBranch(Int_t islot, const char *bname) const; - //===================================================================== - // === CALL THIS IN CreateOutputObjects BEFORE CREATING THE OBJECT FOR EACH - // OUTPUT IOUT THAT HAS TO BE WRITTEN TO A FILE - void OpenFile(Int_t iout, Option_t *option="RECREATE") const; + // === CALL THIS IN CreateOutputObjects IF THE OUTPUT IS TO BE WRITTEN AT OUTPUT IOUT +// void OpenFile(Int_t iout, const char *name, Option_t *option) const; public: AliAnalysisTask(); @@ -84,8 +79,6 @@ class AliAnalysisTask : public TTask { //===================================================================== // === OVERLOAD THIS AND CREATE YOUR OUTPUT OBJECTS (HISTOGRAMS,DATA) HERE virtual void CreateOutputObjects(); - // === OVERLOAD THIS IF YOU NEED TO INITIALIZE YOUR CLASS ON THE CLIENT - virtual void LocalInit(); // === OVERLOAD THIS IF YOU NEED TO TREAT INPUT FILE CHANGE virtual Bool_t Notify(); // Conect inputs/outputs to data containers (by AliAnalysisModule) @@ -110,7 +103,6 @@ class AliAnalysisTask : public TTask { TObject *GetOutputData(Int_t islot) const; Bool_t IsOutputReady(Int_t islot) const {return fOutputReady[islot];} Bool_t IsChecked() const {return TObject::TestBit(kTaskChecked);} - Bool_t IsPostEventLoop() const {return TObject::TestBit(kTaskPostEventLoop);} Bool_t IsInitialized() const {return fInitialized;} Bool_t IsReady() const {return fReady;} Bool_t IsUsed() const {return TObject::TestBit(kTaskUsed);} @@ -118,7 +110,6 @@ class AliAnalysisTask : public TTask { void PrintTask(Option_t *option="all", Int_t indent=0) const; void PrintContainers(Option_t *option="all", Int_t indent=0) const; void SetChecked(Bool_t flag=kTRUE) {TObject::SetBit(kTaskChecked,flag);} - void SetPostEventLoop(Bool_t flag=kTRUE); void SetUsed(Bool_t flag=kTRUE); void SetZombie(Bool_t flag=kTRUE) {TObject::SetBit(kTaskZombie,flag);} // Main task execution diff --git a/ANALYSIS/AliTagAnalysis.cxx b/ANALYSIS/AliTagAnalysis.cxx index 5826fe98510..b5fab2f64ec 100644 --- a/ANALYSIS/AliTagAnalysis.cxx +++ b/ANALYSIS/AliTagAnalysis.cxx @@ -36,8 +36,6 @@ #include "AliEventTag.h" #include "AliTagAnalysis.h" #include "AliEventTagCuts.h" -#include "AliDetectorTagCuts.h" -#include "AliLHCTagCuts.h" #include "AliRunTagCuts.h" #include "AliXMLCollection.h" @@ -127,18 +125,16 @@ void AliTagAnalysis::ChainGridTags(TGridResult *res) { //___________________________________________________________________________ -TChain *AliTagAnalysis::QueryTags(AliRunTagCuts *runTagCuts, AliLHCTagCuts *lhcTagCuts, AliDetectorTagCuts *detTagCuts, AliEventTagCuts *evTagCuts) { +TChain *AliTagAnalysis::QueryTags(AliRunTagCuts *RunTagCuts, AliEventTagCuts *EvTagCuts) { //Queries the tag chain using the defined //event tag cuts from the AliEventTagCuts object //and returns a TChain along with the associated TEventList AliInfo(Form("Querying the tags........")); - - TString fAliceFile = "esdTree"; - + //ESD file chain - TChain *fESDchain = new TChain(fAliceFile.Data()); - //global entry list - TEntryList *fGlobalList = new TEntryList(); + TChain *fESDchain = new TChain("esdTree"); + //Event list + TEventList *fEventList = new TEventList(); //Defining tag objects AliRunTag *tag = new AliRunTag; @@ -152,49 +148,39 @@ TChain *AliTagAnalysis::QueryTags(AliRunTagCuts *runTagCuts, AliLHCTagCuts *lhcT Int_t iAccepted = 0; for(Int_t iTagFiles = 0; iTagFiles < fChain->GetEntries(); iTagFiles++) { fChain->GetEntry(iTagFiles); - if(runTagCuts->IsAccepted(tag)) { - if(lhcTagCuts->IsAccepted(tag->GetLHCTag())) { - if(detTagCuts->IsAccepted(tag->GetDetectorTags())) { - TEntryList *fLocalList = new TEntryList(); - Int_t iEvents = tag->GetNEvents(); - const TClonesArray *tagList = tag->GetEventTags(); - for(Int_t i = 0; i < iEvents; i++) { - evTag = (AliEventTag *) tagList->At(i); - guid = evTag->GetGUID(); - turl = evTag->GetTURL(); - path = evTag->GetPath(); - fLocalList->SetTreeName(fAliceFile.Data()); - fLocalList->SetFileName(turl.Data()); - if(evTagCuts->IsAccepted(evTag)) fLocalList->Enter(i); - }//event loop - - if(path != "") fESDchain->AddFile(path); - else if(turl != "") fESDchain->AddFile(turl); - fGlobalList->Add(fLocalList); - iAccepted += fLocalList->GetN(); - }//detector tag cuts - }//lhc tag cuts + if(RunTagCuts->IsAccepted(tag)) { + Int_t iEvents = tag->GetNEvents(); + const TClonesArray *tagList = tag->GetEventTags(); + for(Int_t i = 0; i < iEvents; i++) { + evTag = (AliEventTag *) tagList->At(i); + guid = evTag->GetGUID(); + turl = evTag->GetTURL(); + path = evTag->GetPath(); + if(EvTagCuts->IsAccepted(evTag)) fEventList->Enter(iAccepted+i); + }//event loop + iAccepted += iEvents; + + if(path != "") fESDchain->AddFile(path); + else if(turl != "") fESDchain->AddFile(turl); }//run tags cut }//tag file loop - AliInfo(Form("Accepted events: %d",iAccepted)); - fESDchain->SetEntryList(fGlobalList,"ne"); + AliInfo(Form("Accepted events: %d",fEventList->GetN())); + fESDchain->SetEventList(fEventList); return fESDchain; } //___________________________________________________________________________ -TChain *AliTagAnalysis::QueryTags(const char *fRunCut, const char *fLHCCut, const char *fDetectorCut, const char *fEventCut) { +TChain *AliTagAnalysis::QueryTags(const char *fRunCut, const char *fEventCut) { //Queries the tag chain using the defined //event tag cuts from the AliEventTagCuts object //and returns a TChain along with the associated TEventList AliInfo(Form("Querying the tags........")); - TString fAliceFile = "esdTree"; - - //ESD file chain - TChain *fESDchain = new TChain(fAliceFile.Data()); - //global entry list - TEntryList *fGlobalList = new TEntryList(); + //ESD file chain + TChain *fESDchain = new TChain("esdTree"); + //Event list + TEventList *fEventList = new TEventList(); //Defining tag objects AliRunTag *tag = new AliRunTag; @@ -206,9 +192,7 @@ TChain *AliTagAnalysis::QueryTags(const char *fRunCut, const char *fLHCCut, cons TString path = 0; TTreeFormula *fRunFormula = new TTreeFormula("fRun",fRunCut,fChain); - TTreeFormula *fLHCFormula = new TTreeFormula("fLHC",fLHCCut,fChain); - TTreeFormula *fDetectorFormula = new TTreeFormula("fDetector",fDetectorCut,fChain); - TTreeFormula *fEventFormula = new TTreeFormula("fEvent",fEventCut,fChain); + TTreeFormula *fEventFormula = new TTreeFormula("fEvent",fEventCut,fChain); Int_t current = -1; Int_t iAccepted = 0; @@ -216,44 +200,33 @@ TChain *AliTagAnalysis::QueryTags(const char *fRunCut, const char *fLHCCut, cons fChain->GetEntry(iTagFiles); if (current != fChain->GetTreeNumber()) { fRunFormula->UpdateFormulaLeaves(); - fLHCFormula->UpdateFormulaLeaves(); - fDetectorFormula->UpdateFormulaLeaves(); fEventFormula->UpdateFormulaLeaves(); current = fChain->GetTreeNumber(); } if(fRunFormula->EvalInstance(iTagFiles) == 1) { - if(fLHCFormula->EvalInstance(iTagFiles) == 1) { - if(fDetectorFormula->EvalInstance(iTagFiles) == 1) { - TEntryList *fLocalList = new TEntryList(); - Int_t iEvents = fEventFormula->GetNdata(); - const TClonesArray *tagList = tag->GetEventTags(); - for(Int_t i = 0; i < iEvents; i++) { - evTag = (AliEventTag *) tagList->At(i); - guid = evTag->GetGUID(); - turl = evTag->GetTURL(); - path = evTag->GetPath(); - fLocalList->SetTreeName(fAliceFile.Data()); - fLocalList->SetFileName(turl.Data()); - if(fEventFormula->EvalInstance(i) == 1) fLocalList->Enter(i); - }//event loop - iAccepted += fLocalList->GetN(); - - if(path != "") fESDchain->AddFile(path); - else if(turl != "") fESDchain->AddFile(turl); - fGlobalList->Add(fLocalList); - iAccepted += fLocalList->GetN(); - }//detector tag cuts - }//lhc tag cuts + Int_t iEvents = fEventFormula->GetNdata(); + const TClonesArray *tagList = tag->GetEventTags(); + for(Int_t i = 0; i < iEvents; i++) { + evTag = (AliEventTag *) tagList->At(i); + guid = evTag->GetGUID(); + turl = evTag->GetTURL(); + path = evTag->GetPath(); + if(fEventFormula->EvalInstance(i) == 1) fEventList->Enter(iAccepted+i); + }//event loop + iAccepted += iEvents; + + if(path != "") fESDchain->AddFile(path); + else if(turl != "") fESDchain->AddFile(turl); }//run tag cut }//tag file loop - AliInfo(Form("Accepted events: %d",iAccepted)); - fESDchain->SetEntryList(fGlobalList,"ne"); + AliInfo(Form("Accepted events: %d",fEventList->GetN())); + fESDchain->SetEventList(fEventList); return fESDchain; } //___________________________________________________________________________ -Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, AliRunTagCuts *runTagCuts, AliLHCTagCuts *lhcTagCuts, AliDetectorTagCuts *detTagCuts, AliEventTagCuts *evTagCuts) { +Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, AliRunTagCuts *RunTagCuts, AliEventTagCuts *EvTagCuts) { //Queries the tag chain using the defined //event tag cuts from the AliEventTagCuts object //and returns a XML collection @@ -263,6 +236,8 @@ Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, AliRunTagCuts *runT collection->SetCollectionName(name); collection->WriteHeader(); + //Event list + //TEntryList *fEventList = new TEntryList(); TString guid = 0x0; TString turl = 0x0; TString lfn = 0x0; @@ -276,21 +251,17 @@ Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, AliRunTagCuts *runT //Event list TEntryList *fList = new TEntryList(); fChain->GetEntry(iTagFiles); - if(runTagCuts->IsAccepted(tag)) { - if(lhcTagCuts->IsAccepted(tag->GetLHCTag())) { - if(detTagCuts->IsAccepted(tag->GetDetectorTags())) { - Int_t iEvents = tag->GetNEvents(); - const TClonesArray *tagList = tag->GetEventTags(); - for(Int_t i = 0; i < iEvents; i++) { - evTag = (AliEventTag *) tagList->At(i); - guid = evTag->GetGUID(); - turl = evTag->GetTURL(); - lfn = turl(8,turl.Length()); - if(evTagCuts->IsAccepted(evTag)) fList->Enter(i); - }//event loop - collection->WriteBody(iTagFiles+1,guid,lfn,turl,fList); - }//detector tag cuts - }//lhc tag cuts + if(RunTagCuts->IsAccepted(tag)) { + Int_t iEvents = tag->GetNEvents(); + const TClonesArray *tagList = tag->GetEventTags(); + for(Int_t i = 0; i < iEvents; i++) { + evTag = (AliEventTag *) tagList->At(i); + guid = evTag->GetGUID(); + turl = evTag->GetTURL(); + lfn = turl(8,turl.Length()); + if(EvTagCuts->IsAccepted(evTag)) fList->Enter(i); + }//event loop + collection->WriteBody(iTagFiles+1,guid,lfn,turl,fList); }//run tag cuts }//tag file loop collection->Export(); @@ -299,7 +270,7 @@ Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, AliRunTagCuts *runT } //___________________________________________________________________________ -Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, const char *fRunCut, const char *fLHCCut, const char *fDetectorCut, const char *fEventCut) { +Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, const char *fRunCut, const char *fEventCut) { //Queries the tag chain using the defined //event tag cuts from the AliEventTagCuts object //and returns a XML collection @@ -319,8 +290,6 @@ Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, const char *fRunCut fChain->SetBranchAddress("AliTAG",&tag); TTreeFormula *fRunFormula = new TTreeFormula("fRun",fRunCut,fChain); - TTreeFormula *fLHCFormula = new TTreeFormula("fLHC",fLHCCut,fChain); - TTreeFormula *fDetectorFormula = new TTreeFormula("fDetector",fDetectorCut,fChain); TTreeFormula *fEventFormula = new TTreeFormula("fEvent",fEventCut,fChain); Int_t current = -1; @@ -330,26 +299,20 @@ Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, const char *fRunCut fChain->GetEntry(iTagFiles); if (current != fChain->GetTreeNumber()) { fRunFormula->UpdateFormulaLeaves(); - fLHCFormula->UpdateFormulaLeaves(); - fDetectorFormula->UpdateFormulaLeaves(); fEventFormula->UpdateFormulaLeaves(); current = fChain->GetTreeNumber(); } if(fRunFormula->EvalInstance(iTagFiles) == 1) { - if(fLHCFormula->EvalInstance(iTagFiles) == 1) { - if(fDetectorFormula->EvalInstance(iTagFiles) == 1) { - Int_t iEvents = fEventFormula->GetNdata(); - const TClonesArray *tagList = tag->GetEventTags(); - for(Int_t i = 0; i < iEvents; i++) { - evTag = (AliEventTag *) tagList->At(i); - guid = evTag->GetGUID(); - turl = evTag->GetTURL(); - lfn = turl(8,turl.Length()); - if(fEventFormula->EvalInstance(i) == 1) fList->Enter(i); - }//event loop - collection->WriteBody(iTagFiles+1,guid,lfn,turl,fList); - }//detector tag cuts - }//lhc tag cuts + Int_t iEvents = fEventFormula->GetNdata(); + const TClonesArray *tagList = tag->GetEventTags(); + for(Int_t i = 0; i < iEvents; i++) { + evTag = (AliEventTag *) tagList->At(i); + guid = evTag->GetGUID(); + turl = evTag->GetTURL(); + lfn = turl(8,turl.Length()); + if(fEventFormula->EvalInstance(i) == 1) fList->Enter(i); + }//event loop + collection->WriteBody(iTagFiles+1,guid,lfn,turl,fList); }//run tag cuts }//tag file loop collection->Export(); diff --git a/ANALYSIS/AliTagAnalysis.h b/ANALYSIS/AliTagAnalysis.h index d1fa9256e11..64dd30fedeb 100644 --- a/ANALYSIS/AliTagAnalysis.h +++ b/ANALYSIS/AliTagAnalysis.h @@ -29,8 +29,6 @@ class AliEventTag; class TChain; class AliEventTagCuts; -class AliDetectorTagCuts; -class AliLHCTagCuts; class AliRunTagCuts; class TGridResult; class TTreeFormula; @@ -45,11 +43,11 @@ class AliTagAnalysis : public TObject { void ChainLocalTags(const char *dirname); void ChainGridTags(TGridResult *result); - TChain *QueryTags(AliRunTagCuts *runTagCuts, AliLHCTagCuts *lhcTagCuts, AliDetectorTagCuts *detTagCuts, AliEventTagCuts *evTagCuts); - TChain *QueryTags(const char *fRunCut, const char *fLHCCut, const char *fDetectorCut, const char *fEventCut); + TChain *QueryTags(AliRunTagCuts *RunTagCuts, AliEventTagCuts *EvTagCuts); + TChain *QueryTags(const char *fRunCut, const char *fEventCut); - Bool_t CreateXMLCollection(const char* name, AliRunTagCuts *runTagCuts, AliLHCTagCuts *lhcTagCuts, AliDetectorTagCuts *detTagCuts, AliEventTagCuts *evTagCuts); - Bool_t CreateXMLCollection(const char* name, const char *fRunCut, const char *fLHCCut, const char *fDetectorCut, const char *fEventCut); + Bool_t CreateXMLCollection(const char* name, AliRunTagCuts *RunTagCuts, AliEventTagCuts *EvTagCuts); + Bool_t CreateXMLCollection(const char* name, const char *fRunCut, const char *fEventCut); TChain *GetInputChain(const char* system, const char *wn); TChain *GetChainFromCollection(const char* collectionname, const char* treename); diff --git a/ANALYSIS/Aliengui/AliTagAnalysisFrame.cxx b/ANALYSIS/Aliengui/AliTagAnalysisFrame.cxx index 45dd125fac0..677ccd7a75c 100644 --- a/ANALYSIS/Aliengui/AliTagAnalysisFrame.cxx +++ b/ANALYSIS/Aliengui/AliTagAnalysisFrame.cxx @@ -34,8 +34,6 @@ #include "TEventList.h" #include "AliRunTagCuts.h" -#include "AliLHCTagCuts.h" -#include "AliDetectorTagCuts.h" #include "AliEventTagCuts.h" #include "AliTagAnalysis.h" @@ -61,8 +59,8 @@ AliTagAnalysisFrame::AliTagAnalysisFrame(const TGWindow *main, UInt_t w, UInt_t fComboEventTagCut2(0), fTagResult(0), fAnalysisChain(0), fListBox(0), fBrowser(NULL), fBrowserButton(NULL), - fAliTagAnalysis(0), fAliRunCuts(0), fAliLHCCuts(0), - fAliDetectorCuts(0), fAliEventCuts(0), fEventTagCutsName(0) { + fAliTagAnalysis(0), fAliRunCuts(0), + fAliEventCuts(0), fEventTagCutsName(0) { // Constructor. /* @@ -128,8 +126,6 @@ AliTagAnalysisFrame::AliTagAnalysisFrame(const TGWindow *main, UInt_t w, UInt_t fAliTagAnalysis = new AliTagAnalysis(); fAliRunCuts = new AliRunTagCuts(); - fAliLHCCuts = new AliLHCTagCuts(); - fAliDetectorCuts = new AliDetectorTagCuts(); fAliEventCuts = new AliEventTagCuts(); MapSubwindows(); @@ -152,8 +148,6 @@ AliTagAnalysisFrame::~AliTagAnalysisFrame() { delete fAliTagAnalysis; delete fAliRunCuts; - delete fAliLHCCuts; - delete fAliDetectorCuts; delete fAliEventCuts; delete fTagResult; delete fAnalysisChain; @@ -367,7 +361,7 @@ void AliTagAnalysisFrame::RunLocal() { #endif fAnalysisChain = new TChain("esdTree"); - fAnalysisChain = fAliTagAnalysis->QueryTags(fAliRunCuts,fAliLHCCuts,fAliDetectorCuts,fAliEventCuts); + fAnalysisChain = fAliTagAnalysis->QueryTags(fAliRunCuts,fAliEventCuts); TString res = TString("Number of Accepted Events: "); res += fAnalysisChain->GetEventList()->GetN(); @@ -412,7 +406,7 @@ void AliTagAnalysisFrame::RunGrid() { #endif fAnalysisChain = new TChain("esdTree"); - fAnalysisChain = fAliTagAnalysis->QueryTags(fAliRunCuts,fAliLHCCuts,fAliDetectorCuts,fAliEventCuts); + fAnalysisChain = fAliTagAnalysis->QueryTags(fAliRunCuts,fAliEventCuts); TString res = TString("Number of Accepted Events: "); res += fAnalysisChain->GetEventList()->GetN(); diff --git a/ANALYSIS/Aliengui/AliTagAnalysisFrame.h b/ANALYSIS/Aliengui/AliTagAnalysisFrame.h index edc43aa6d2e..22f71b972f1 100644 --- a/ANALYSIS/Aliengui/AliTagAnalysisFrame.h +++ b/ANALYSIS/Aliengui/AliTagAnalysisFrame.h @@ -38,8 +38,6 @@ class TGridResult; class TChain; class AliRunTagCuts; -class AliLHCTagCuts; -class AliDetectorTagCuts; class AliEventTagCuts; class AliTagAnalysis; @@ -107,8 +105,6 @@ class AliTagAnalysisFrame : public TGMainFrame { // AliRoot Tag cut analysis AliTagAnalysis *fAliTagAnalysis; //alitaganalysis object AliRunTagCuts *fAliRunCuts; //run cuts object - AliLHCTagCuts *fAliLHCCuts; //lhc cuts object - AliDetectorTagCuts *fAliDetectorCuts; //detector cuts object AliEventTagCuts *fAliEventCuts; //event cuts object const char **fEventTagCutsName; //event tag names diff --git a/ANALYSIS/binaliengui.pkg b/ANALYSIS/binaliengui.pkg index 98702b3f62d..70a749a3f41 100644 --- a/ANALYSIS/binaliengui.pkg +++ b/ANALYSIS/binaliengui.pkg @@ -4,7 +4,7 @@ CSRCS := EINCLUDE := ELIBSDIR := ELIBS := Aliengui \ - MUONevaluation MUONgeometry MUONrec MUONsim MUONbase MUONtrigger MUONraw MUONcalib MUONmapping \ + MUONgeometry MUONrec MUONsim MUONbase MUONraw MUONcalib MUONmapping \ TPCbase TPCsim TPCrec TPCfast \ ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase \ TRDsim TRDrec TRDfast \ diff --git a/ANALYSIS/libANALYSIS.pkg b/ANALYSIS/libANALYSIS.pkg index 14978005648..dbc9c218ad8 100644 --- a/ANALYSIS/libANALYSIS.pkg +++ b/ANALYSIS/libANALYSIS.pkg @@ -1,7 +1,6 @@ SRCS = AliAnalysisDataContainer.cxx AliAnalysisDataSlot.cxx \ AliAnalysisManager.cxx AliAnalysisTask.cxx \ - AliAnalysisSelector.cxx \ - AliAnalysisGoodies.cxx + AliAnalysisSelector.cxx CHECKALIEN = $(shell root-config --has-alien) ifeq (yes,$(CHECKALIEN)) diff --git a/EMCAL/AliEMCALTrack.cxx b/EMCAL/AliEMCALTrack.cxx index 4d188861076..7fd8236121e 100755 --- a/EMCAL/AliEMCALTrack.cxx +++ b/EMCAL/AliEMCALTrack.cxx @@ -27,8 +27,6 @@ #include "Riostream.h" -#include "TVector3.h" - #include "AliLog.h" #include "AliTracker.h" #include "AliESDtrack.h" @@ -36,8 +34,6 @@ #include "AliEMCALTrack.h" Bool_t AliEMCALTrack::fgUseOuterParams = kTRUE; -Bool_t AliEMCALTrack::fgCorrectForEL = kFALSE; -Bool_t AliEMCALTrack::fgSortByPt = kTRUE; ClassImp(AliEMCALTrack) // @@ -46,8 +42,8 @@ ClassImp(AliEMCALTrack) AliEMCALTrack::AliEMCALTrack() : AliExternalTrackParam(), fClusterIndex(-1), - fClusterDist(1000.0), // default: extremely large distance - fMass(0.13957018), // default: pion mass + fClusterDist(1000.0), + fMass(0.0), fSeedIndex(-1), fSeedLabel(-1) { @@ -60,6 +56,21 @@ AliEMCALTrack::AliEMCALTrack() // //------------------------------------------------------------------------------ // +AliEMCALTrack::AliEMCALTrack(const AliEMCALTrack& t) + : AliExternalTrackParam(t), + fClusterIndex(t.fClusterIndex), + fClusterDist(t.fClusterDist), + fMass(t.fMass), + fSeedIndex(t.fSeedIndex), + fSeedLabel(t.fSeedLabel) +{ + // + // Copy constructor. + // + } +// +//------------------------------------------------------------------------------ +// AliEMCALTrack::AliEMCALTrack(const AliESDtrack& t) : AliExternalTrackParam(), fClusterIndex(-1), @@ -89,22 +100,7 @@ AliEMCALTrack::AliEMCALTrack(const AliESDtrack& t) // set this accordingly Set(x, alpha, params, cov); -} -// -//------------------------------------------------------------------------------ -// -AliEMCALTrack::AliEMCALTrack(const AliEMCALTrack& t) - : AliExternalTrackParam(t), - fClusterIndex(t.fClusterIndex), - fClusterDist(t.fClusterDist), - fMass(t.fMass), - fSeedIndex(t.fSeedIndex), - fSeedLabel(t.fSeedLabel) -{ - // - // Copy constructor. - // -} +} // //------------------------------------------------------------------------------ // @@ -131,31 +127,17 @@ AliEMCALTrack& AliEMCALTrack::operator=(const AliEMCALTrack &t) Int_t AliEMCALTrack::Compare(const TObject *obj) const { // - // Compare tracks. - // How tracks are compared depends on the static flag - // "fSortByPt" (boolean): - // true => tracks are compared w.r. to their transverse momentum - // false => tracks are compared w.r. to their distance from cluster + // Tracks compared wrt their distance from matched point // AliEMCALTrack *that = (AliEMCALTrack*)obj; - Double_t thisP[3], thisVal, thatP[3], thatVal; - - if (fgSortByPt) { - this->GetPxPyPz(thisP); - that->GetPxPyPz(thatP); - thisVal = TMath::Sqrt(thisP[0]*thisP[0] + thisP[1]*thisP[1]); - thatVal = TMath::Sqrt(thatP[0]*thatP[0] + thatP[1]*thatP[1]); - } - else { - thisVal = this->GetClusterDist(); - thatVal = that->GetClusterDist(); - } + Double_t thisDist = GetClusterDist(); + Double_t thatDist = that->GetClusterDist(); - if (thisVal > thatVal) return 1; - else if (thisVal < thatVal) return -1; - else return 0; + if (thisDist > thatDist) return 1; + else if (thisDist < thatDist) return -1; + return 0; } // //------------------------------------------------------------------------------ @@ -163,136 +145,39 @@ Int_t AliEMCALTrack::Compare(const TObject *obj) const Double_t AliEMCALTrack::GetBz() const { // - // Returns Z-component of the magnetic field in kG. - // In case it B is not constant, its value is returned - // at the current position of the track (local X,Y,Z) + // returns Bz component of the magnetic field in kG, + // at the point where track is actually propagated // - // if magnetic field is constant... - if (AliTracker::UniformField()) return AliTracker::GetBz(); - - // ...else: Double_t r[3]; - GetXYZ(r); - return AliTracker::GetBz(r); + + if (AliTracker::UniformField()) { + return AliTracker::GetBz(); + } + else { + GetXYZ(r); + return AliTracker::GetBz(r); + } } // //------------------------------------------------------------------------------ // -Bool_t AliEMCALTrack::PropagateTo(Double_t xk, Double_t d, Double_t x0) +Bool_t AliEMCALTrack::PropagateTo(Double_t xk, Double_t eqWidth, Double_t x0) { // // Propagates a track to the plane defined by x='xk'. - // Second parameter is the width (in units of rad. length) crossed by the track. - // Third parameter is the reference radiation length used. + // Second parameter represents the percent width of radiation length + // crossed by the track. + // Third parameter is the reference radiation length used (default: Si). // Track propagation includes computing energy loss (modifies curvature) - // and multiple scattering perturbation (alters covariance matrix), if requested. + // and multiple scattering perturbation (alters covariance matrix). // Method returns kFALSE when something goes wrong with computations. // - // An additional operation (thanks to Yuri Belikov) is done to check - // when the track crosses a sector boundary. If this happens, - // the local track reference frame is adjusted accordingly. - // - - Double_t y; - Double_t field = GetBz(); - Double_t width = TMath::Pi() / 9.0; // width of TPC/TRD/EMCAL sector (= 20 deg) - Double_t ymax = TMath::Abs(xk * TMath::Tan(0.5 * width)); // max allowed Y in local coords at distance xk - - // first check: try to compute the local 'y' at the distance 'xk': - // if this attempt fails, the propagation cannot be done - if (!GetYAt(xk, field, y)) return kFALSE; - - // if is -ymax < y < ymax ==> 'direct' propagation is done; - if (TMath::Abs(y) <= ymax) return SimplePropagation(xk, d, x0); - - // otherwise, try change a sector to find one where the propagation is ok - Int_t i, incr, istart, nloops; - Double_t alpha = GetAlpha(); - incr = (y > ymax) ? 1 : -1; - if (alpha < 0.0) alpha += TMath::TwoPi(); - istart = (Int_t)(alpha / width); - for (i = istart, nloops = 0; nloops < 18; i += incr, nloops++) { - if (i == 18) i = 0; - if (i == -1) i = 17; - alpha = ((Double_t)i + 0.5) * width; - if (Rotate(alpha)) { - if (GetYAt(xk, field, y)) { - if (TMath::Abs(y) <= ymax) { - AliInfo(Form("Required change from sector %d to sector %d to succeed in propagation", istart, i)); - return SimplePropagation(xk, d, x0); - } - } - } - } - - // if the routine exits from the loop and reaches this point, - // it means that none of the rotations succeeded - AliWarning("Track propagation fails in every sector. Impossible to propagate."); - return kFALSE; -} -// -//------------------------------------------------------------------------------ -// -Double_t AliEMCALTrack::StraightPropagateTo(Double_t xk, Double_t &x, Double_t &y, Double_t &z) -{ - // - // Does propagation with a straight line approximation. - // This operation does not update track parameters, but it returns a point - // in space, according to this propagation, which is stored in - // the arguments #2, #3 and #4 - // - - Double_t oldX = GetX(), oldY = GetY(), oldZ = GetZ(); - Double_t newPos[3]; - - newPos[0] = xk; - newPos[1] = oldY * xk / oldX; - newPos[2] = oldZ * xk / oldX; - - Double_t cs = TMath::Cos(GetAlpha()), sn = TMath::Sin(GetAlpha()); - x = newPos[0]*cs - newPos[1]*sn; - y = newPos[0]*sn + newPos[1]*cs; - z = newPos[2]; - - return newPos[1]; -} -// -//------------------------------------------------------------------------------ -// -Bool_t AliEMCALTrack::PropagateToGlobal(Double_t x, Double_t y, Double_t z, Double_t d, Double_t x0) -{ - // - // Propagate to a point specified with its global XYZ coordinates. - // Here, the correct value of the 'X' parameter to be sent to "PropagateTo" is computed. - // - - TVector3 vc(x, y, z); - Double_t width = 20.0; // width of TPC/TRD/EMCAL sector - Double_t phi = vc.Phi() * TMath::RadToDeg(); - if (phi < 0.0) phi += 360.0; - - Int_t isector = (Int_t)(phi / width); - Double_t rotation = ((Double_t)isector + 0.5) * width; - vc.RotateZ(rotation * TMath::DegToRad()); - - return PropagateTo(vc.X(), d, x0); -} -// -//------------------------------------------------------------------------------ -// -Bool_t AliEMCALTrack::SimplePropagation(Double_t xk, Double_t d, Double_t x0) -{ - // - // Recall base class method for track propagation. - // Double_t field = GetBz(); - // propagation... if (!AliExternalTrackParam::PropagateTo(xk, field)) return kFALSE; - - // EL correction is computed only if requested... - if (!fgCorrectForEL) return kTRUE; - return AliExternalTrackParam::CorrectForMaterial(d, x0, GetMass()); -} + if (!AliExternalTrackParam::CorrectForMaterial(eqWidth, x0, GetMass())) return kFALSE; + + return kTRUE; +} diff --git a/EMCAL/AliEMCALTrack.h b/EMCAL/AliEMCALTrack.h index 947339f797a..beffc24f66c 100755 --- a/EMCAL/AliEMCALTrack.h +++ b/EMCAL/AliEMCALTrack.h @@ -26,8 +26,8 @@ class AliEMCALTrack : public AliExternalTrackParam public: AliEMCALTrack(); - AliEMCALTrack(const AliESDtrack& t); AliEMCALTrack(const AliEMCALTrack& t); + AliEMCALTrack(const AliESDtrack& t); AliEMCALTrack& operator=(const AliEMCALTrack &t); Int_t Compare(const TObject *o) const; @@ -38,39 +38,30 @@ class AliEMCALTrack : public AliExternalTrackParam Double_t GetMass() const {return fMass;} Int_t GetSeedIndex() const {return fSeedIndex;} Int_t GetSeedLabel() const {return fSeedLabel;} - + Bool_t IsSortable() const {return kTRUE;} - Bool_t PropagateTo(Double_t xr, Double_t d = 0.0, Double_t x0 = 21.82); - Double_t StraightPropagateTo(Double_t xk, Double_t &x, Double_t &y, Double_t &z); - Bool_t PropagateToGlobal(Double_t x, Double_t y, Double_t z, Double_t d = 0.0, Double_t x0 = 21.82); + Bool_t PropagateTo(Double_t xr, Double_t d, Double_t x0=21.82); - void SetClusterIndex(Int_t idx) {fClusterIndex = idx;} - void SetClusterDist(Double_t dist) {fClusterDist = dist;} - void SetMass(Double_t mass) {fMass = mass;} - void SetSeedIndex(Int_t index) {fSeedIndex = index;} - void SetSeedLabel(Int_t label) {fSeedLabel = label;} + void SetClusterIndex(Int_t idx) {fClusterIndex=idx;} + void SetClusterDist(Double_t dist) {fClusterDist=dist;} + void SetMass(Double_t mass) {fMass=mass;} + void SetSeedIndex(Int_t index) {fSeedIndex=index;} + void SetSeedLabel(Int_t label) {fSeedLabel=label;} - static void SetUseOuterParams(Bool_t doit = kTRUE) {fgUseOuterParams = doit;} - static void SetCorrectForEL(Bool_t doit = kTRUE) {fgCorrectForEL = doit;} - static void SetSortByPt(Bool_t doit = kTRUE) {fgSortByPt = doit;} + static void SetUseOuterParams(Bool_t doit=kTRUE) {fgUseOuterParams=doit;} protected: - Bool_t SimplePropagation(Double_t xk, Double_t d = 0.0, Double_t x0 = 0.0); - static Bool_t fgUseOuterParams; // use outer parameters from AliESDtrack? - static Bool_t fgCorrectForEL; // apply corrections for energy loss? - static Bool_t fgSortByPt; // true --> sort by pt, false --> sort by track-cluster distance Int_t fClusterIndex; // index of matched cluster (if any) Double_t fClusterDist; // distance between track propagation and matched cluster - Double_t fMass; // mass hypothesis (in GeV/c2) + Double_t fMass; // mass hypothesis (in GeV/c2) Int_t fSeedIndex; // index of imported ESD track in its owner AliESD - Int_t fSeedLabel; // GEANT label of imported ESD track - + Int_t fSeedLabel; // label of imported ESD track private: ClassDef(AliEMCALTrack, 0) // track implementation for EMCAL matching -}; +}; #endif diff --git a/EMCAL/AliEMCALTracker.cxx b/EMCAL/AliEMCALTracker.cxx index c93948387e4..e12dd5dd13b 100644 --- a/EMCAL/AliEMCALTracker.cxx +++ b/EMCAL/AliEMCALTracker.cxx @@ -39,7 +39,6 @@ #include #include #include -#include #include "AliLog.h" #include "AliESD.h" @@ -49,8 +48,6 @@ #include "AliRunLoader.h" #include "AliEMCALTrack.h" #include "AliEMCALLoader.h" -#include "AliEMCALGeometry.h" - #include "AliEMCALTracker.h" ClassImp(AliEMCALTracker) @@ -72,8 +69,7 @@ AliEMCALTracker::AliEMCALTracker() fX0(1.0), fTracks(0), fClusters(0), - fMatches(0), - fGeom(0) + fMatches(0) { // // Default constructor. @@ -100,8 +96,7 @@ AliEMCALTracker::AliEMCALTracker(const AliEMCALTracker& copy) fX0(copy.fX0), fTracks((TObjArray*)copy.fTracks->Clone()), fClusters((TObjArray*)copy.fClusters->Clone()), - fMatches((TList*)copy.fMatches->Clone()), - fGeom(copy.fGeom) + fMatches((TList*)copy.fMatches->Clone()) { // // Copy constructor @@ -130,50 +125,11 @@ AliEMCALTracker& AliEMCALTracker::operator=(const AliEMCALTracker& copy) fClusters = (TObjArray*)copy.fClusters->Clone(); fMatches = (TList*)copy.fMatches->Clone(); - fGeom = copy.fGeom; - return (*this); } // //------------------------------------------------------------------------------ // -TTree* AliEMCALTracker::SearchTrueMatches() -{ - if (!fClusters) return 0; - if (fClusters->IsEmpty()) return 0; - if (!fTracks) return 0; - if (fTracks->IsEmpty()) return 0; - - TTree *outTree = new TTree("tree", "True matches from event"); - Int_t indexT, indexC, label; - outTree->Branch("indexC", &indexC, "indexC/I"); - outTree->Branch("indexT", &indexT, "indexT/I"); - outTree->Branch("label", &label , "label/I"); - - Double_t dist; - Int_t ic, nClusters = (Int_t)fClusters->GetEntries(); - Int_t it, nTracks = fTracks->GetEntries(); - - for (ic = 0; ic < nClusters; ic++) { - AliEMCALMatchCluster *cluster = (AliEMCALMatchCluster*)fClusters->At(ic); - label = cluster->Label(); - indexC = cluster->Index(); - for (it = 0; it < nTracks; it++) { - AliEMCALTrack *track = (AliEMCALTrack*)fTracks->At(it); - if (TMath::Abs(track->GetSeedLabel()) != label) continue; - dist = CheckPair(track, cluster); - if (dist <= fMaxDist) { - indexT = track->GetSeedIndex(); - outTree->Fill(); - } - } - } - - return outTree; -} -// -//------------------------------------------------------------------------------ -// void AliEMCALTracker::Clear(Option_t* option) { // @@ -182,7 +138,6 @@ void AliEMCALTracker::Clear(Option_t* option) // TString opt(option); - Bool_t doDelete = opt.Contains("DELETE"); Bool_t clearTracks = opt.Contains("TRACKS"); Bool_t clearClusters = opt.Contains("CLUSTERS"); Bool_t clearMatches = opt.Contains("MATCHES"); @@ -193,34 +148,19 @@ void AliEMCALTracker::Clear(Option_t* option) } if (fTracks != 0x0 && clearTracks) { - if (!doDelete) { - fTracks->Clear(); - } - else { - if (!fTracks->IsEmpty()) fTracks->Delete(); - delete fTracks; - fTracks = 0; - } + if (!fTracks->IsEmpty()) fTracks->Delete(); + delete fTracks; + fTracks = 0; } if (fClusters != 0x0 && clearClusters) { - if (!doDelete) { - fClusters->Clear(); - } - else { - if (!fClusters->IsEmpty()) fClusters->Delete(); - delete fClusters; - fClusters = 0; - } + if (!fClusters->IsEmpty()) fClusters->Delete(); + delete fClusters; + fClusters = 0; } if (fMatches != 0x0 && clearMatches) { - if (!doDelete) { - fMatches->Clear(); - } - else { - if (!fMatches->IsEmpty()) fMatches->Delete(); - delete fMatches; - fMatches = 0; - } + if (!fMatches->IsEmpty()) fMatches->Delete(); + delete fMatches; + fMatches = 0; } } // @@ -238,7 +178,7 @@ Int_t AliEMCALTracker::LoadClusters(TTree *cTree) TBranch *branch = cTree->GetBranch("EMCALECARP"); if (!branch) { - AliError("Can't get the branch with the EMCAL clusters"); + AliError("can't get the branch with the EMCAL clusters"); return 1; } @@ -321,26 +261,21 @@ Int_t AliEMCALTracker::LoadTracks(AliESD *esd) for (i = 0; i < nTracks; i++) { AliESDtrack *esdTrack = esd->GetTrack(i); // set by default the value corresponding to "no match" - esdTrack->SetEMCALcluster(kUnmatched); + esdTrack->SetEMCALcluster(-99999); // if (esdTrack->GetLabel() < 0) continue; // if (!(esdTrack->GetStatus() & AliESDtrack::kTOFout)) continue; isKink = kFALSE; for (j = 0; j < 3; j++) { - if (esdTrack->GetKinkIndex(j) != 0) isKink = kTRUE; + if (esdTrack->GetKinkIndex(j) > 0) isKink = kTRUE; } if (isKink) continue; AliEMCALTrack *track = new AliEMCALTrack(*esdTrack); - track->SetMass(0.13957018); // check alpha and reject the tracks which fall outside EMCAL acceptance alpha = track->GetAlpha() * TMath::RadToDeg(); if (alpha > -155.0 && alpha < 67.0) { delete track; continue; } -// if (!PropagateToEMCAL(track)) { -// delete track; -// continue; -// } track->SetSeedIndex(i); track->SetSeedLabel(esdTrack->GetLabel()); fTracks->AddLast(track); @@ -374,18 +309,17 @@ Int_t AliEMCALTracker::PropagateBack(AliESD* esd) // step 1: // if cluster array is empty, cluster are collected // from the passed ESD, and work is done with ESDCaloClusters - Int_t okLoadClusters, nClusters; + Int_t okLoadClusters; if (!fClusters || (fClusters && fClusters->IsEmpty())) { + AliInfo("Cluster array is empty. Loading clusters..."); okLoadClusters = LoadClusters(esd); if (okLoadClusters) return 2; } - nClusters = fClusters->GetEntries(); // step 2: // collect ESD tracks - Int_t okLoadTracks = LoadTracks(esd), nTracks; + Int_t okLoadTracks = LoadTracks(esd); if (okLoadTracks) return 3; - nTracks = fTracks->GetEntries(); // step 3: // each track is propagated to the "R" position of each cluster. @@ -393,11 +327,11 @@ Int_t AliEMCALTracker::PropagateBack(AliESD* esd) // IF no clusters lie within the maximum allowed distance, no matches are assigned. Int_t nMatches = CreateMatches(); if (!nMatches) { - AliInfo(Form("#clusters = %d -- #tracks = %d --> No good matches found.", nClusters, nTracks)); + AliInfo("No good matches found."); return 4; } else { - AliInfo(Form("#clusters = %d -- #tracks = %d --> Found %d matches.", nClusters, nTracks, nMatches)); + AliInfo(Form("Found %d matches", nMatches)); } // step 4: @@ -411,7 +345,7 @@ Int_t AliEMCALTracker::PropagateBack(AliESD* esd) // step 5: // save obtained information setting the 'fEMCALindex' field of AliESDtrack object - Int_t nSaved = 0, trackID, nGood = 0, nFake = 0; + Int_t nSaved = 0, trackID; TListIter iter(fMatches); AliEMCALMatch *match = 0; while ( (match = (AliEMCALMatch*)iter.Next()) ) { @@ -421,13 +355,11 @@ Int_t AliEMCALTracker::PropagateBack(AliESD* esd) trackID = track->GetSeedIndex(); AliESDtrack *esdTrack = esd->GetTrack(trackID); if (!esdTrack) continue; - if (TMath::Abs(esdTrack->GetLabel()) == cluster->Label()) { + if (esdTrack->GetLabel() == cluster->Label()) { esdTrack->SetEMCALcluster(cluster->Index()); - nGood++; } else { esdTrack->SetEMCALcluster(-cluster->Index()); - nFake++; } nSaved++; } @@ -440,7 +372,7 @@ Int_t AliEMCALTracker::PropagateBack(AliESD* esd) AliESDtrack *esdTrack = esd->GetTrack(trackID); if (!esdTrack) continue; if (clusterID < 0) { - esdTrack->SetEMCALcluster(kUnmatched); + esdTrack->SetEMCALcluster(-99999); } else { AliEMCALMatchCluster *cluster = (AliEMCALMatchCluster*)fClusters->At(clusterID); @@ -456,7 +388,7 @@ Int_t AliEMCALTracker::PropagateBack(AliESD* esd) } } */ - AliInfo(Form("Saved %d matches [%d good + %d fake]", nSaved, nGood, nFake)); + AliInfo(Form("Saved %d matches", nSaved)); return 0; } @@ -531,6 +463,7 @@ Double_t AliEMCALTracker::CheckPair Bool_t isTrue = kFALSE; // if (tr->GetSeedLabel() == cl->Label()) { // isTrue = kTRUE; +// cout << "TRUE MATCH!!!" << endl; // } // copy track into temporary variable @@ -587,25 +520,7 @@ Double_t AliEMCALTracker::CheckPair } else { // when no steps are used, no correction makes sense - //if (!tr->PropagateTo(rc, 0.0, 0.0)) return distance; - if (!tr->PropagateToGlobal(cl->X(), cl->Y(), cl->Z(), 0.0, 0.0)) return distance; - /* - Bool_t propOK = kFALSE; - cout << "START" << endl; - Double_t dist, rCHK, bestDist = 10000000.0; - for (Double_t rTMP = rc; rTMP> rc*0.95; rTMP -= 0.1) { - if (!tr->PropagateTo(rTMP)) continue; - propOK = kTRUE; - tr->GetXYZ(pos); - rCHK = TMath::Sqrt(x*x + y*y); - dist = TMath::Abs(rCHK - rc); - cout << rCHK << " vs. " << rc << endl; - - if (TMath::Abs(rCHK - rc) < 0.01) break; - } - cout << "STOP" << endl; - if (!propOK) return distance; - */ + if (!tr->PropagateTo(rc, 0.0, 0.0)) return distance; } // get global propagation of track at end of propagation @@ -615,13 +530,6 @@ Double_t AliEMCALTracker::CheckPair TVector3 vc(cl->X(), cl->Y(), cl->Z()); TVector3 vt(x, y, z); Double_t angle = TMath::Abs(vc.Angle(vt)) * TMath::RadToDeg(); - // check: where is the track? - Double_t r, phiT, phiC; - r = TMath::Sqrt(pos[0]*pos[0] + pos[1]*pos[1]); - phiT = TMath::ATan2(pos[1], pos[0]) * TMath::RadToDeg(); - phiC = vc.Phi() * TMath::RadToDeg(); - //cout << "Propagated R, phiT, phiC = " << r << ' ' << phiT << ' ' << phiC << endl; - if (angle > fCutAngle) { //cout << "angle" << endl; return distance; @@ -629,17 +537,17 @@ Double_t AliEMCALTracker::CheckPair // compute differences wr to each coordinate x -= cl->X(); - if (TMath::Abs(x) > fCutX) { + if (x > fCutX) { //cout << "cut X" << endl; return distance; } y -= cl->Y(); - if (TMath::Abs(y) > fCutY) { + if (y > fCutY) { //cout << "cut Y" << endl; return distance; } z -= cl->Z(); - if (TMath::Abs(z) > fCutZ) { + if (z > fCutZ) { //cout << "cut Z" << endl; return distance; } @@ -767,97 +675,6 @@ Double_t AliEMCALTracker::CheckPairV2 // //------------------------------------------------------------------------------ // -Double_t AliEMCALTracker::CheckPairV3 -(AliEMCALTrack *track, AliEMCALMatchCluster *cl) -{ - // - // Given a track and a cluster, - // propagates the first to the radius of the second. - // Then, checks the propagation point against all cuts. - // If at least a cut is not passed, a valuer equal to - // twice the maximum allowed distance is passed (so the value returned - // will not be taken into account when creating matches) - // - - AliEMCALTrack tr(*track); - - Int_t sector; - Double_t distance = 2.0 * fMaxDist; - Double_t dx, dy, dz; - Double_t phi, alpha, slope, tgtXnum, tgtXden, sectorWidth = 20.0 * TMath::DegToRad(); - Double_t xcurr, xprop, param[6] = {0., 0., 0., 0., 0., 0.}, d, x0, rho, bz; - Double_t x[3], x1[3], x2[3]; - - // get initial track position - xcurr = tr.GetX(); - - // evaluate the EMCAL sector number - phi = cl->Phi(); - if (phi < 0.0) phi += TMath::TwoPi(); - sector = (Int_t)(phi / sectorWidth); - alpha = ((Double_t)sector + 0.5) * sectorWidth; - // evaluate the corresponding X for track propagation - slope = TMath::Tan(alpha - 0.5*TMath::Pi()); - tgtXnum = cl->Y() - slope * cl->X(); - tgtXden = TMath::Sqrt(1.0 + slope*slope); - xprop = TMath::Abs(tgtXnum / tgtXden); - - // propagate by small steps - tr.GetXYZ(x1); - bz = tr.GetBz(); - if (!tr.GetXYZAt(xprop, bz, x2)) return distance; - //AliKalmanTrack::MeanMaterialBudget(x1, x2, param); - d = param[4]; - rho = param[0]; - x0 = param[1]; - if (!tr.PropagateTo(xprop, d*rho/x0, x0)) return distance; - //if (!tr.PropagateTo(xprop, 0.0, 0.0)) return distance; - - // get propagated position at the end - tr.GetXYZ(x); - dx = TMath::Abs(x[0] - cl->X()); - dy = TMath::Abs(x[1] - cl->Y()); - dz = TMath::Abs(x[2] - cl->Z()); - if (dx > fCutX || dy > fCutY || dz > fCutZ) return distance; - - distance = TMath::Sqrt(dx*dx + dy*dy + dz*dz); - - return distance; -} -// -//------------------------------------------------------------------------------ -// -Bool_t AliEMCALTracker::PropagateToEMCAL(AliEMCALTrack *tr) -{ - // - // Propagates the track to the proximity of the EMCAL surface - // - - Double_t xcurr, xtemp, xprop = 438.0, step = 10.0, param[6], d, x0, rho, bz; - Double_t x1[3], x2[3]; - - // get initial track position - xcurr = tr->GetX(); - - // propagate by small steps - for (xtemp = xcurr + step; xtemp < xprop; xtemp += step) { - // to compute material budget, take current position and - // propagated hypothesis without energy loss - tr->GetXYZ(x1); - bz = tr->GetBz(); - if (!tr->GetXYZAt(xtemp, bz, x2)) return kFALSE; - AliKalmanTrack::MeanMaterialBudget(x1, x2, param); - d = param[4]; - rho = param[0]; - x0 = param[1]; - if (!tr->PropagateTo(xtemp, d*rho/x0, x0)) return kFALSE; - } - - return kTRUE; -} -// -//------------------------------------------------------------------------------ -// Int_t AliEMCALTracker::CreateMatches() { // @@ -885,23 +702,23 @@ Int_t AliEMCALTracker::CreateMatches() // external loop on clusters, internal loop on tracks Double_t dist; for (ic = 0; ic < nClusters; ic++) { + cout << "\rMatching cluster " << ic+1 << " of " << nClusters << flush; AliEMCALMatchCluster *cluster = (AliEMCALMatchCluster*)fClusters->At(ic); for (it = 0; it < nTracks; it++) { AliEMCALTrack *track = (AliEMCALTrack*)fTracks->At(it); dist = CheckPair(track, cluster); - //cout << dist << endl; if (dist <= fMaxDist) { AliEMCALMatch *candidate = new AliEMCALMatch; candidate->SetIndexT(it); candidate->SetIndexC(ic); candidate->SetDistance(dist); - candidate->SetPt(track->GetPt()); fMatches->Add(candidate); count++; } } } - + cout << endl; + /* // loop on clusters and tracks Int_t icBest; @@ -1067,8 +884,8 @@ Int_t AliEMCALTracker::AliEMCALMatch::Compare(const TObject *obj) const AliEMCALTracker::AliEMCALMatch *that = (AliEMCALTracker::AliEMCALMatch*)obj; - Double_t thisDist = fPt;//fDistance; - Double_t thatDist = that->fPt;//that->GetDistance(); + Double_t thisDist = fDistance; + Double_t thatDist = that->GetDistance(); if (thisDist > thatDist) return 1; else if (thisDist < thatDist) return -1; @@ -1080,8 +897,7 @@ AliEMCALTracker::AliEMCALMatch::AliEMCALMatch() fCanBeSaved(kFALSE), fIndexC(0), fIndexT(0), - fDistance(0.), - fPt(0.) + fDistance(0.) { //default constructor @@ -1092,8 +908,7 @@ AliEMCALTracker::AliEMCALMatch::AliEMCALMatch(const AliEMCALMatch& copy) fCanBeSaved(copy.fCanBeSaved), fIndexC(copy.fIndexC), fIndexT(copy.fIndexT), - fDistance(copy.fDistance), - fPt(copy.fPt) + fDistance(copy.fDistance) { //copy ctor } diff --git a/EMCAL/AliEMCALTracker.h b/EMCAL/AliEMCALTracker.h index ef8ea99d9f6..79b7876b773 100644 --- a/EMCAL/AliEMCALTracker.h +++ b/EMCAL/AliEMCALTracker.h @@ -25,13 +25,11 @@ #include "AliTracker.h" class TList; -class TTree; class TObjArray; class AliESD; class AliESDCaloCluster; class AliEMCALTrack; class AliEMCALRecPoint; -class AliEMCALGeometry; class AliEMCALTracker : public AliTracker { @@ -52,35 +50,27 @@ class AliEMCALTracker : public AliTracker virtual Int_t RefitInward(AliESD*) {return -1;} virtual void UnloadClusters(); virtual AliCluster* GetCluster(Int_t) const {return NULL;}; - TTree* SearchTrueMatches(); void SetCorrection(Double_t rho, Double_t x0) {fRho=rho;fX0=x0;} void SetCutAlpha(Double_t min, Double_t max) {fCutAlphaMin=min;fCutAlphaMax=max;} void SetCutAngle(Double_t value) {fCutAngle=value;} void SetCutX(Double_t value) {fCutX=value;} void SetCutY(Double_t value) {fCutY=value;} void SetCutZ(Double_t value) {fCutZ=value;} - void SetGeometry(AliEMCALGeometry *geom) {fGeom=geom;} void SetMaxDistance(Double_t value) {fMaxDist=value;} void SetNumberOfSteps(Int_t n) {fNPropSteps=n;if(!n)SetTrackCorrectionMode("NONE");} void SetTrackCorrectionMode(Option_t *option); - enum { - kUnmatched = -99999 - }; - class AliEMCALMatchCluster : public TObject { public: - AliEMCALMatchCluster(Int_t ID, AliEMCALRecPoint *recPoint); - AliEMCALMatchCluster(Int_t ID, AliESDCaloCluster *caloCluster); - virtual ~AliEMCALMatchCluster() { } - //---------------------------------------------------------------------------- + AliEMCALMatchCluster(Int_t ID, AliEMCALRecPoint *recPoint); + AliEMCALMatchCluster(Int_t ID, AliESDCaloCluster *caloCluster); + virtual ~AliEMCALMatchCluster() { } Int_t& Index() {return fIndex;} Int_t& Label() {return fLabel;} Double_t& X() {return fX;} Double_t& Y() {return fY;} Double_t& Z() {return fZ;} - Double_t Phi() {return TMath::ATan2(fY, fX);} private: Int_t fIndex; // index of cluster in its native container (ESD or TClonesArray) Int_t fLabel; // track label of assigned cluster @@ -92,27 +82,23 @@ class AliEMCALTracker : public AliTracker class AliEMCALMatch : public TObject { public: - AliEMCALMatch(); - AliEMCALMatch(const AliEMCALMatch& copy); - virtual ~AliEMCALMatch() { } - //---------------------------------------------------------------------------- + AliEMCALMatch(); + AliEMCALMatch(const AliEMCALMatch& copy); + ~AliEMCALMatch() { } Bool_t& CanBeSaved() {return fCanBeSaved;} Int_t Compare(const TObject *obj) const; Double_t GetDistance() {return fDistance;} - Double_t GetPt() {return fPt;} Int_t GetIndexC() {return fIndexC;} Int_t GetIndexT() {return fIndexT;} Bool_t IsSortable() const {return kTRUE;} void SetIndexC(Int_t icl) {fIndexC=icl;} void SetIndexT(Int_t itr) {fIndexT=itr;} void SetDistance(Double_t dist) {fDistance=dist;} - void SetPt(Double_t pt) {fPt=pt;} private: Bool_t fCanBeSaved; // when true, this match can be saved, otherwise it will not be Int_t fIndexC; // cluster index in 'fClusters' array Int_t fIndexT; // track index in 'fTracks' array Double_t fDistance; // track - cluster distance - Double_t fPt; // track pt }; private: @@ -120,9 +106,7 @@ class AliEMCALTracker : public AliTracker Double_t AngleDiff(Double_t angle1, Double_t angle2); Double_t CheckPair(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster); Double_t CheckPairV2(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster); - Double_t CheckPairV3(AliEMCALTrack *tr, AliEMCALMatchCluster *cluster); Int_t CreateMatches(); - Bool_t PropagateToEMCAL(AliEMCALTrack *tr); Int_t SolveCompetitions(); enum ETrackCorr { @@ -145,12 +129,10 @@ class AliEMCALTracker : public AliTracker Double_t fRho; // energy correction: density Double_t fX0; // energy correction: radiation length - TObjArray *fTracks; //! collection of tracks + TObjArray *fTracks; //! collection of ESD tracks TObjArray *fClusters; //! collection of EMCAL clusters (ESDCaloCluster or EMCALRecPoint) TList *fMatches; //! collection of matches between tracks and clusters - AliEMCALGeometry *fGeom; //! EMCAL geometry - ClassDef(AliEMCALTracker, 1) // EMCAL "tracker" }; diff --git a/ESDCheck/AliAnalysisTaskPt.cxx b/ESDCheck/AliAnalysisTaskPt.cxx index 8e6614c5b2c..fe3f16d90eb 100644 --- a/ESDCheck/AliAnalysisTaskPt.cxx +++ b/ESDCheck/AliAnalysisTaskPt.cxx @@ -120,19 +120,14 @@ void AliAnalysisTaskPt::Exec(Option_t *) void AliAnalysisTaskPt::Terminate(Option_t *) { // Processing when the event loop is ended - - Bool_t problem=kFALSE; - - AliInfo(Form(" *** %s Report:", GetName())) ; - + TCanvas *c1 = new TCanvas("c1","Pt",10,10,310,310); c1->SetFillColor(10); c1->SetHighLightColor(10); c1->cd(1)->SetLeftMargin(0.15); c1->cd(1)->SetBottomMargin(0.15); - if (fhPt->GetMaximum() > 0 ) - c1->cd(1)->SetLogy(); + c1->cd(1)->SetLogy(); fOutputContainer = (TObjArray*)GetOutputData(0); fhPt = (TH1F*)fOutputContainer->At(0); if (fhPt) fhPt->DrawCopy("E"); @@ -140,18 +135,10 @@ void AliAnalysisTaskPt::Terminate(Option_t *) c1->Print("TracksPt.eps"); char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; gROOT->ProcessLine(line); sprintf(line, ".!rm -fR *.eps"); gROOT->ProcessLine(line); - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ; } diff --git a/ESDCheck/AliEMCALQATask.cxx b/ESDCheck/AliEMCALQATask.cxx index bd37807ed79..b3d9c8e7055 100644 --- a/ESDCheck/AliEMCALQATask.cxx +++ b/ESDCheck/AliEMCALQATask.cxx @@ -210,43 +210,36 @@ void AliEMCALQATask::Terminate(Option_t *) fhEMCALPhotons = (TH1I*)fOutputContainer->At(5); fhEMCALInvariantMass = (TH1D*)fOutputContainer->At(6); fhEMCALDigitsEvent = (TH1I*)fOutputContainer->At(7); - - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; - printf(" EMCALEnergy Mean : %5.3f , RMS : %5.3f \n", fhEMCALEnergy->GetMean(), fhEMCALEnergy->GetRMS() ) ; - printf(" EMCALDigits Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigits->GetMean(), fhEMCALDigits->GetRMS() ) ; - printf(" EMCALRecParticles Mean : %5.3f , RMS : %5.3f \n", fhEMCALRecParticles->GetMean(), fhEMCALRecParticles->GetRMS() ) ; - printf(" EMCALPhotons Mean : %5.3f , RMS : %5.3f \n", fhEMCALPhotons->GetMean(), fhEMCALPhotons->GetRMS() ) ; - printf(" EMCALInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhEMCALInvariantMass->GetMean(), fhEMCALInvariantMass->GetRMS() ) ; - printf(" EMCALDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigitsEvent->GetMean(), fhEMCALDigitsEvent->GetRMS() ) ; + printf("EMCALEnergy Mean : %5.3f , RMS : %5.3f \n", fhEMCALEnergy->GetMean(), fhEMCALEnergy->GetRMS() ) ; + printf("EMCALDigits Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigits->GetMean(), fhEMCALDigits->GetRMS() ) ; + printf("EMCALRecParticles Mean : %5.3f , RMS : %5.3f \n", fhEMCALRecParticles->GetMean(), fhEMCALRecParticles->GetRMS() ) ; + printf("EMCALPhotons Mean : %5.3f , RMS : %5.3f \n", fhEMCALPhotons->GetMean(), fhEMCALPhotons->GetRMS() ) ; + printf("EMCALInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhEMCALInvariantMass->GetMean(), fhEMCALInvariantMass->GetRMS() ) ; + printf("EMCALDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhEMCALDigitsEvent->GetMean(), fhEMCALDigitsEvent->GetRMS() ) ; TCanvas * cEMCAL = new TCanvas("EMCAL", "EMCAL ESD Test", 400, 10, 600, 700); cEMCAL->Divide(3, 2) ; cEMCAL->cd(1) ; - if ( fhEMCALEnergy->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhEMCALEnergy->SetAxisRange(0, 25.); fhEMCALEnergy->SetXTitle("Energy (GeV)"); fhEMCALEnergy->Draw(); cEMCAL->cd(2) ; - if ( fhEMCALDigits->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhEMCALDigits->SetAxisRange(0, 25.); fhEMCALDigits->SetXTitle("DigitsPerCluster"); fhEMCALDigits->Draw(); cEMCAL->cd(3) ; - if ( fhEMCALRecParticles->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhEMCALRecParticles->SetAxisRange(0, 25.); fhEMCALRecParticles->SetXTitle("RecParticles"); fhEMCALRecParticles->Draw(); cEMCAL->cd(4) ; - if ( fhEMCALPhotons->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhEMCALPhotons->SetAxisRange(0, 25.); fhEMCALPhotons->SetXTitle("Photons"); fhEMCALPhotons->Draw(); @@ -256,8 +249,7 @@ void AliEMCALQATask::Terminate(Option_t *) fhEMCALInvariantMass->Draw(); cEMCAL->cd(6) ; - if ( fhEMCALDigitsEvent->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhEMCALDigitsEvent->SetAxisRange(0, 40.); fhEMCALDigitsEvent->SetXTitle("DigitsPerEvent"); fhEMCALDigitsEvent->Draw(); @@ -265,18 +257,10 @@ void AliEMCALQATask::Terminate(Option_t *) cEMCAL->Print("EMCAL.eps"); char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; gROOT->ProcessLine(line); sprintf(line, ".!rm -fR *.eps"); gROOT->ProcessLine(line); - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ; } diff --git a/ESDCheck/AliFMDQATask.cxx b/ESDCheck/AliFMDQATask.cxx index 1b42171ae8e..06e6782ef14 100644 --- a/ESDCheck/AliFMDQATask.cxx +++ b/ESDCheck/AliFMDQATask.cxx @@ -130,9 +130,9 @@ void AliFMDQATask::Exec(Option_t *) // ************************ FMD ************************************* - AliESDFMD * fmd = fESD->GetFMDData() ; + AliESDFMD * fmd = fESD->GetFMDData() ; - //fmd->CheckNeedUShort(currentFile); + fmd->CheckNeedUShort(currentFile); Int_t nFMD1 = 0, nFMD2i = 0, nFMD2o = 0, nFMD3i = 0, nFMD3o = 0 ; diff --git a/ESDCheck/AliHMPIDQATask.cxx b/ESDCheck/AliHMPIDQATask.cxx index 4da33f22733..839966ca57a 100644 --- a/ESDCheck/AliHMPIDQATask.cxx +++ b/ESDCheck/AliHMPIDQATask.cxx @@ -183,10 +183,7 @@ void AliHMPIDQATask::Terminate(Option_t *) fhHMPIDProb[2] = (TH1F*)fOutputContainer->At(6); fhHMPIDProb[3] = (TH1F*)fOutputContainer->At(7); fhHMPIDProb[4] = (TH1F*)fOutputContainer->At(8); - - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; - + Float_t n = 1.292 ; //mean freon ref idx TF1 * hHMPIDpPi = new TF1("RiPiTheo", "acos(sqrt(x*x+[0]*[0])/(x*[1]))", 1.2, 7) ; hHMPIDpPi->SetLineWidth(1) ; @@ -236,18 +233,10 @@ void AliHMPIDQATask::Terminate(Option_t *) cHMPID->Print("HMPID.eps"); char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; gROOT->ProcessLine(line); sprintf(line, ".!rm -fR *.eps"); gROOT->ProcessLine(line); - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ; } diff --git a/ESDCheck/AliMUONQATask.cxx b/ESDCheck/AliMUONQATask.cxx index 137c6795496..949d2e3412b 100644 --- a/ESDCheck/AliMUONQATask.cxx +++ b/ESDCheck/AliMUONQATask.cxx @@ -145,7 +145,7 @@ void AliMUONQATask::CreateOutputObjects() fhChi2match = new TH1F("hChi2match","Chi2 of trig/track matching",100, 0.,20.); // create output container - fOutputContainer = new TObjArray(12) ; + fOutputContainer = new TObjArray(10) ; fOutputContainer->SetName(GetName()) ; fOutputContainer->AddAt(fhMUONVertex, 0) ; fOutputContainer->AddAt(fhMUONMult, 1) ; @@ -279,104 +279,100 @@ void AliMUONQATask::Terminate(Option_t *) effMatch = 100 * fnTrackTrig / ftracktot ; fheffMatchT->Fill(effMatch);} - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; + AliInfo(Form("Terminate %s:", GetName())) ; + fOutputContainer = (TObjArray*)GetOutputData(0); + fhMUONVertex = (TH1F*)fOutputContainer->At(0); + fhMUONMult = (TH1F*)fOutputContainer->At(1); + fhPt = (TH1F*)fOutputContainer->At(2); + fhY = (TH1F*)fOutputContainer->At(3); + fheffMatchT=(TH1F*)fOutputContainer->At(4); + fhSLowpt=(TH1F*)fOutputContainer->At(5); + fhUSLowpt=(TH1F*)fOutputContainer->At(6); + fhUSHighpt=(TH1F*)fOutputContainer->At(7); + fhLSLowpt=(TH1F*)fOutputContainer->At(8); + fhLSHighpt=(TH1F*)fOutputContainer->At(9); + //______________________________________________________________________ + printf("===================================================\n") ; + printf("================ %s ESD SUMMARY ==============\n", GetName()) ; + printf(" \n") ; + printf(" Total number of processed events %d \n", fnevents) ; + printf("\n") ; + printf("\n") ; + printf("Table 1: \n") ; + printf("===================================================\n") ; + printf(" Global Trigger output Low pt High pt \n") ; + printf(" number of Single :\t"); + printf("%i\t", fSLowpt) ; + printf("\n"); + printf(" number of UnlikeSign pair :\t"); + printf("%i\t%i\t", fUSLowpt, fUSHighpt) ; + printf("\n"); + printf(" number of LikeSign pair :\t"); + printf("%i\t%i\t", fLSLowpt, fLSHighpt) ; + printf("\n"); + printf("===================================================\n") ; + printf("\n") ; + printf("matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); + printf("\n") ; + printf("===================================================\n") ; + +TCanvas * cMUON1 = new TCanvas("cMUON1", "MUON ESD Vert & Mult", 400, 10, 600, 700) ; + cMUON1->Divide(1,2) ; + cMUON1->cd(1) ; + fhMUONVertex->SetXTitle("Vz (cm)"); + fhMUONVertex->Draw() ; + cMUON1->cd(2) ; + fhMUONMult->SetXTitle(" Track Multiplicity"); + fhMUONMult->Draw() ; + cMUON1->Print("MUON1.eps") ; - fOutputContainer = (TObjArray*)GetOutputData(0); - fhMUONVertex = (TH1F*)fOutputContainer->At(0); - fhMUONMult = (TH1F*)fOutputContainer->At(1); - fhPt = (TH1F*)fOutputContainer->At(2); - fhY = (TH1F*)fOutputContainer->At(3); - fheffMatchT=(TH1F*)fOutputContainer->At(4); - fhSLowpt=(TH1F*)fOutputContainer->At(5); - fhUSLowpt=(TH1F*)fOutputContainer->At(6); - fhUSHighpt=(TH1F*)fOutputContainer->At(7); - fhLSLowpt=(TH1F*)fOutputContainer->At(8); - fhLSHighpt=(TH1F*)fOutputContainer->At(9); - - printf(" Total number of processed events %d \n", fnevents) ; - printf(" \n") ; - printf(" \n") ; - printf(" Table 1: \n") ; - printf(" ===================================================\n") ; - printf(" Global Trigger output Low pt High pt \n") ; - printf(" number of Single :\t"); - printf(" %i\t", fSLowpt) ; - printf("\n"); - printf(" number of UnlikeSign pair :\t"); - printf(" %i\t%i\t", fUSLowpt, fUSHighpt) ; - printf("\n"); - printf(" number of LikeSign pair :\t"); - printf(" %i\t%i\t", fLSLowpt, fLSHighpt) ; - printf("\n"); - printf(" matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); - printf("\n") ; - - TCanvas * cMUON1 = new TCanvas("cMUON1", "MUON ESD Vert & Mult", 400, 10, 600, 700) ; - cMUON1->Divide(1,2) ; - cMUON1->cd(1) ; - fhMUONVertex->SetXTitle("Vz (cm)"); - fhMUONVertex->Draw() ; - cMUON1->cd(2) ; - fhMUONMult->SetXTitle(" Track Multiplicity"); - fhMUONMult->Draw() ; - cMUON1->Print("MUON1.eps") ; - - TCanvas * cMUON2 = new TCanvas("cMUON2", "MUON ESD Pt & Y", 400, 10, 600, 700) ; - cMUON2->Divide(1,2) ; - cMUON2->cd(1) ; - fhPt->SetXTitle("Pt (GeV)"); - fhPt->Draw() ; - cMUON2->cd(2) ; - fhY->SetXTitle("Y"); - fhY->Draw() ; - cMUON2->Print("MUON2.eps") ; - - TCanvas * cMUON3 = new TCanvas("cMUON3", "Track Chi2 by dof and Chi2 of trigger/track matching ", 400, 10, 600, 700) ; - cMUON3->Divide(1,2) ; - cMUON3->cd(1) ; - fhChi2->SetXTitle("Chi2 by d.o.f."); - fhChi2->Draw(); - cMUON3->cd(2) ; - fhChi2match->SetXTitle("Chi2 of trig/track matching"); - fhChi2match->Draw(); - cMUON3->Print("MUON3.eps") ; - - TCanvas * cMUON4 = new TCanvas("cMUON4", "Trigger Matching and Trigger Response (%)", 400, 10, 600, 700) ; - cMUON4->Divide(2,3) ; - cMUON4->cd(1) ; - fheffMatchT->SetXTitle("%"); - fheffMatchT->Draw() ; - cMUON4->cd(2) ; - fhSLowpt->SetXTitle("%"); - fhSLowpt->Draw() ; - cMUON4->cd(3) ; - fhUSLowpt->SetXTitle("%"); - fhUSLowpt->Draw() ; - cMUON4->cd(4) ; - fhUSHighpt->SetXTitle("%"); - fhUSHighpt->Draw() ; - cMUON4->cd(5) ; - fhLSLowpt->SetXTitle("%"); - fhLSLowpt->Draw() ; - cMUON4->cd(6) ; - fhLSHighpt->SetXTitle("%"); - fhLSHighpt->Draw() ; - cMUON4->Print("MUON4.eps") ; - - char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; - gROOT->ProcessLine(line); - sprintf(line, ".!rm -fR *.eps"); - gROOT->ProcessLine(line); - - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; + TCanvas * cMUON2 = new TCanvas("cMUON2", "MUON ESD Pt & Y", 400, 10, 600, 700) ; + cMUON2->Divide(1,2) ; + cMUON2->cd(1) ; + fhPt->SetXTitle("Pt (GeV)"); + fhPt->Draw() ; + cMUON2->cd(2) ; + fhY->SetXTitle("Y"); + fhY->Draw() ; + cMUON2->Print("MUON2.eps") ; + + TCanvas * cMUON3 = new TCanvas("cMUON3", "Track Chi2 by dof and Chi2 of trigger/track matching ", 400, 10, 600, 700) ; + cMUON3->Divide(1,2) ; + cMUON3->cd(1) ; + fhChi2->SetXTitle("Chi2 by d.o.f."); + fhChi2->Draw(); + cMUON3->cd(2) ; + fhChi2match->SetXTitle("Chi2 of trig/track matching"); + fhChi2match->Draw(); + cMUON3->Print("MUON3.eps") ; + + TCanvas * cMUON4 = new TCanvas("cMUON4", "Trigger Matching and Trigger Response (%)", 400, 10, 600, 700) ; + cMUON4->Divide(2,3) ; + cMUON4->cd(1) ; + fheffMatchT->SetXTitle("%"); + fheffMatchT->Draw() ; + cMUON4->cd(2) ; + fhSLowpt->SetXTitle("%"); + fhSLowpt->Draw() ; + cMUON4->cd(3) ; + fhUSLowpt->SetXTitle("%"); + fhUSLowpt->Draw() ; + cMUON4->cd(4) ; + fhUSHighpt->SetXTitle("%"); + fhUSHighpt->Draw() ; + cMUON4->cd(5) ; + fhLSLowpt->SetXTitle("%"); + fhLSLowpt->Draw() ; + cMUON4->cd(6) ; + fhLSHighpt->SetXTitle("%"); + fhLSHighpt->Draw() ; + cMUON4->Print("MUON4.eps") ; - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; + char line[1024] ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; + gROOT->ProcessLine(line); + sprintf(line, ".!rm -fR *.eps"); + gROOT->ProcessLine(line); + + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ; } diff --git a/ESDCheck/AliPHOSQATask.cxx b/ESDCheck/AliPHOSQATask.cxx index 5063d3c6828..94e3382007a 100644 --- a/ESDCheck/AliPHOSQATask.cxx +++ b/ESDCheck/AliPHOSQATask.cxx @@ -212,21 +212,18 @@ void AliPHOSQATask::Terminate(Option_t *) fhPHOSInvariantMass = (TH1D*)fOutputContainer->At(6); fhPHOSDigitsEvent = (TH1I*)fOutputContainer->At(7); - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; - printf(" PHOSEnergy Mean : %5.3f , RMS : %5.3f \n", fhPHOSEnergy->GetMean(), fhPHOSEnergy->GetRMS() ) ; - printf(" PHOSDigits Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigits->GetMean(), fhPHOSDigits->GetRMS() ) ; - printf(" PHOSRecParticles Mean : %5.3f , RMS : %5.3f \n", fhPHOSRecParticles->GetMean(), fhPHOSRecParticles->GetRMS() ) ; - printf(" PHOSPhotons Mean : %5.3f , RMS : %5.3f \n", fhPHOSPhotons->GetMean(), fhPHOSPhotons->GetRMS() ) ; - printf(" PHOSInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhPHOSInvariantMass->GetMean(), fhPHOSInvariantMass->GetRMS() ) ; - printf(" PHOSDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigitsEvent->GetMean(), fhPHOSDigitsEvent->GetRMS() ) ; + printf("PHOSEnergy Mean : %5.3f , RMS : %5.3f \n", fhPHOSEnergy->GetMean(), fhPHOSEnergy->GetRMS() ) ; + printf("PHOSDigits Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigits->GetMean(), fhPHOSDigits->GetRMS() ) ; + printf("PHOSRecParticles Mean : %5.3f , RMS : %5.3f \n", fhPHOSRecParticles->GetMean(), fhPHOSRecParticles->GetRMS() ) ; + printf("PHOSPhotons Mean : %5.3f , RMS : %5.3f \n", fhPHOSPhotons->GetMean(), fhPHOSPhotons->GetRMS() ) ; + printf("PHOSInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhPHOSInvariantMass->GetMean(), fhPHOSInvariantMass->GetRMS() ) ; + printf("PHOSDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigitsEvent->GetMean(), fhPHOSDigitsEvent->GetRMS() ) ; TCanvas * cPHOS = new TCanvas("cPHOS", "PHOS ESD Test", 400, 10, 600, 700) ; cPHOS->Divide(3, 2); cPHOS->cd(1) ; - if ( fhPHOSEnergy->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhPHOSEnergy->SetAxisRange(0, 25.); fhPHOSEnergy->SetLineColor(2); fhPHOSEnergy->Draw(); @@ -237,15 +234,13 @@ void AliPHOSQATask::Terminate(Option_t *) fhPHOSDigits->Draw(); cPHOS->cd(3) ; - if ( fhPHOSRecParticles->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhPHOSRecParticles->SetAxisRange(0, 25.); fhPHOSRecParticles->SetLineColor(2); fhPHOSRecParticles->Draw(); cPHOS->cd(4) ; - if ( fhPHOSPhotons->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhPHOSPhotons->SetAxisRange(0,25.); fhPHOSPhotons->SetLineColor(2); fhPHOSPhotons->Draw(); @@ -255,8 +250,7 @@ void AliPHOSQATask::Terminate(Option_t *) fhPHOSInvariantMass->Draw(); cPHOS->cd(6) ; - if ( fhPHOSDigitsEvent->GetMaximum() > 0. ) - gPad->SetLogy(); + gPad->SetLogy(); fhPHOSDigitsEvent->SetAxisRange(0,40.); fhPHOSDigitsEvent->SetLineColor(2); fhPHOSDigitsEvent->Draw(); @@ -264,18 +258,10 @@ void AliPHOSQATask::Terminate(Option_t *) cPHOS->Print("PHOS.eps"); char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; gROOT->ProcessLine(line); sprintf(line, ".!rm -fR *.eps"); gROOT->ProcessLine(line); - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ; } diff --git a/ESDCheck/AliPMDQATask.cxx b/ESDCheck/AliPMDQATask.cxx index 1533932bc50..ecceb3fb398 100644 --- a/ESDCheck/AliPMDQATask.cxx +++ b/ESDCheck/AliPMDQATask.cxx @@ -474,9 +474,6 @@ void AliPMDQATask::Terminate(Option_t *) fhPMDSM24 = (TH2F*)fOutputContainer->At(36); fhPMDSM = (TH1F*)fOutputContainer->At(37); - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; - gStyle->SetOptStat(110000); gStyle->SetOptFit(1); @@ -584,18 +581,11 @@ void AliPMDQATask::Terminate(Option_t *) cPMD4->Print("CPVPREAdc.eps"); char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; gROOT->ProcessLine(line); - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ; - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; } //______________________________________________________________________________ diff --git a/ESDCheck/AliT0QATask.cxx b/ESDCheck/AliT0QATask.cxx index 56db7fd13c6..a0353cfef57 100644 --- a/ESDCheck/AliT0QATask.cxx +++ b/ESDCheck/AliT0QATask.cxx @@ -142,17 +142,13 @@ void AliT0QATask::Terminate(Option_t *) fhT02 = (TH1F*)fOutputContainer->At(1); fhT03 = (TH1F*)fOutputContainer->At(2); - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; - Float_t mean = fhT02->GetMean(); printf ("mean time T0 ps %f\n", mean) ; - if ( mean > 12600 || mean < 12400 ) { + if ( mean > 12600 || mean < 12400 ) AliWarning (" !!!!!!!!!!-----events sample is WRONG - T0 unreal -------"); - problem = kTRUE ; - } + TCanvas * cTO1 = new TCanvas("cT01", "T0 ESD Test", 400, 10, 600, 700) ; cTO1->Divide(2, 2) ; @@ -169,18 +165,10 @@ void AliT0QATask::Terminate(Option_t *) cTO1->Print("T0.eps"); char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; gROOT->ProcessLine(line); sprintf(line, ".!rm -fR *.eps"); gROOT->ProcessLine(line); - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report)) ; + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ; } diff --git a/ESDCheck/AliTOFQATask.cxx b/ESDCheck/AliTOFQATask.cxx index 2e2b185f325..60c7f921198 100644 --- a/ESDCheck/AliTOFQATask.cxx +++ b/ESDCheck/AliTOFQATask.cxx @@ -20,7 +20,6 @@ //-TOF Time info and (TOF - expected time) plots //-Summary Plots on TOF Pid ////////////////////////////////////////////////////////////////////////////// -#include #include #include #include @@ -29,14 +28,13 @@ #include #include #include -#include -#include #include #include "AliTOFQATask.h" #include "AliESD.h" #include "AliESDtrack.h" #include "AliLog.h" +#include "Riostream.h" //______________________________________________________________________________ AliTOFQATask::AliTOFQATask(const char *name) : @@ -61,11 +59,7 @@ AliTOFQATask::AliTOFQATask(const char *name) : fhTOFDeltaTimeMT(0), fhTOFIDSpecies(0), fhTOFMassVsMom(0), - fhTOFMass(0), - fmatchFracMin(0.15), - fmatchEffMin(0.28), - ftimePeakMax(0.05), - fmassPeakMax(0.05) + fhTOFMass(0) { // Constructor. // Input slot #0 works with an Ntuple @@ -97,11 +91,7 @@ AliTOFQATask::AliTOFQATask(const AliTOFQATask &qatask) : fhTOFDeltaTimeMT(0), fhTOFIDSpecies(0), fhTOFMassVsMom(0), - fhTOFMass(0), - fmatchFracMin(0.15), - fmatchEffMin(0.28), - ftimePeakMax(0.05), - fmassPeakMax(0.05) + fhTOFMass(0) { // Copy Constructor. fChain=qatask.fChain; @@ -125,10 +115,6 @@ AliTOFQATask::AliTOFQATask(const AliTOFQATask &qatask) : fhTOFIDSpecies=qatask.fhTOFIDSpecies; fhTOFMassVsMom=qatask.fhTOFMassVsMom; fhTOFMass=qatask.fhTOFMass; - fmatchFracMin=qatask.fmatchFracMin; - fmatchEffMin=qatask.fmatchEffMin; - ftimePeakMax=qatask.ftimePeakMax; - fmassPeakMax=qatask.fmassPeakMax; } //______________________________________________________________________________ AliTOFQATask:: ~AliTOFQATask() @@ -178,10 +164,6 @@ AliTOFQATask& AliTOFQATask::operator=(const AliTOFQATask &qatask) this->fhTOFIDSpecies=qatask.fhTOFIDSpecies; this->fhTOFMassVsMom=qatask.fhTOFMassVsMom; this->fhTOFMass=qatask.fhTOFMass; - this->fmatchFracMin=qatask.fmatchFracMin; - this->fmatchEffMin=qatask.fmatchEffMin; - this->ftimePeakMax=qatask.ftimePeakMax; - this->fmassPeakMax=qatask.fmassPeakMax; return *this; } //______________________________________________________________________________ @@ -199,15 +181,22 @@ void AliTOFQATask::ConnectInputData(const Option_t*) } // One should first check if the branch address was taken by some other task - char ** address = (char **)GetBranchAddress(0, "ESD") ; - if (address) - fESD = (AliESD *)(*address) ; - else { - fESD = new AliESD() ; - SetBranchAddress(0, "ESD", &fESD) ; + char ** address = (char **)GetBranchAddress(0, "ESD"); + if (address) { + fESD = (AliESD*)(*address); + } else { + fESD = new AliESD(); + SetBranchAddress(0, "ESD", &fESD); } } +//________________________________________________________________________ +void AliTOFQATask::CreateOutputObjects() +{ +// Create histograms + BookHistos(); +} + //______________________________________________________________________________ void AliTOFQATask::Exec(Option_t *) { @@ -219,7 +208,7 @@ void AliTOFQATask::Exec(Option_t *) Int_t npidok=0; Int_t pisel=0,kasel=0,prsel=0,elsel=0,musel=0; //Set equal a-priori weights (just charged hadrions) - const Int_t nCalinSec=8736; + Int_t nCalinSec=8736; Double_t c[5]={0, 0, 1, 1, 1}; // Processing of one event Long64_t entry = fChain->GetReadEntry() ; @@ -337,10 +326,11 @@ void AliTOFQATask::Exec(Option_t *) fhTOFMatch->Fill(fracM); PostData(0, fOutputContainer); + AliInfo("Finishing event processing...") ; } //______________________________________________________________________________ -void AliTOFQATask::CreateOutputObjects() +void AliTOFQATask::BookHistos() { // Construct histograms: @@ -385,7 +375,7 @@ void AliTOFQATask::CreateOutputObjects() fhTOFMassVsMom = new TH2F("hTOFMassVsMom","TOF, Mass Vs Momentum ",280,-0.2,1.2,600,0.,6.); fhTOFMass = - new TH1F("hTOFMass","TOF, reconstructed mass ",240,0.,1.2); + new TH1F("hTOFMass","TOF, reconstructed mass ",280,-0.2,1.2); // create the output container @@ -430,18 +420,15 @@ void AliTOFQATask::GetEfficiency() } //______________________________________________________________________________ -Bool_t AliTOFQATask::DrawHistos() +void AliTOFQATask::DrawHistos() { - - - Int_t TOFsectors[18]={0,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1};//TOF sectors which are supposed to be present - const char* part[3]={"pions","kaons","protons"};// pi,ka,pr - const Float_t masses[3]={0.1396,0.494,0.938};// particle masses pi,ka,pr // Makes a few plots + AliInfo("Plotting....") ; + gROOT->SetStyle("Plain"); gStyle->SetPalette(1); - gStyle->SetOptStat(111110); + gStyle->SetOptStat(110010); gStyle->SetPalette(1); gStyle->SetCanvasColor(0); gStyle->SetFrameFillColor(0); @@ -479,10 +466,9 @@ Bool_t AliTOFQATask::DrawHistos() fhTOFeffMom->GetYaxis()->SetTitle("Fraction of matched ESD tracks"); fhTOFeffMom->SetFillColor(4); fhTOFeffMom->Draw(); - fhTOFeffMom->Fit("pol0","Q","",0.5,3.); - TF1 *fitMom = fhTOFeffMom->GetFunction("pol0"); fhTOFeffMom->Draw("histo,same"); + cTOFeff->Print("TOF_eff.gif"); cTOFeff->Print("TOF_eff.eps"); @@ -490,41 +476,31 @@ Bool_t AliTOFQATask::DrawHistos() TCanvas * cTOFtime = new TCanvas("cTOFtime", "TOF measured Times ", 400, 30, 550, 630) ; cTOFtime->Divide(1,2) ; cTOFtime->cd(1); - if ( fhTOFTime->GetMaximum() > 0 ) - cTOFtime->GetPad(1)->SetLogy(1); + cTOFtime->GetPad(1)->SetLogy(1); fhTOFTime->GetXaxis()->SetTitle("TOF time (ns)"); fhTOFTime->GetYaxis()->SetTitle("Entries"); fhTOFTime->SetFillColor(4); fhTOFTime->Draw(); cTOFtime->cd(2); - if ( fhTOFDeltaTime->GetMaximum() > 0 ) - cTOFtime->GetPad(2)->SetLogy(1); + cTOFtime->GetPad(2)->SetLogy(1); fhTOFDeltaTime->GetXaxis()->SetTitle("t^{TOF}-t^{exp}_{#pi} (ns)"); fhTOFDeltaTime->GetYaxis()->SetTitle("Entries"); fhTOFDeltaTime->SetFillColor(4); - Int_t ntimepeak=1; - TSpectrum *timeDiff = new TSpectrum(ntimepeak); - Int_t ntime = timeDiff->Search(fhTOFDeltaTime,ntimepeak,"new",0.1); fhTOFDeltaTime->Draw(); + cTOFtime->Print("TOF_time.gif"); cTOFtime->Print("TOF_time.eps"); TCanvas * cTOFpid = new TCanvas("cTOFpid", "TOF PID ", 400, 30, 550, 630) ; cTOFpid->Divide(1,3) ; cTOFpid->cd(1); - if ( fhTOFMass->GetMaximum() > 0 ) - cTOFpid->SetLogy(1); + cTOFpid->SetLogy(1); fhTOFMass->GetXaxis()->SetTitle("Reconstructed Mass (GeV/c^{2})"); fhTOFMass->GetYaxis()->SetTitle("Entries"); fhTOFMass->SetFillColor(4); - Int_t npmass=1; - if(fhTOFMass->GetEntries()>1000)npmass=3; - TSpectrum *mass = new TSpectrum(npmass); - Int_t nmass = mass->Search(fhTOFMass,npmass,"new",0.02); fhTOFMass->Draw(); - if ( fhTOFMassVsMom->GetMaximum() > 0 ) - cTOFpid->SetLogy(0); + cTOFpid->SetLogy(0); cTOFpid->cd(2); fhTOFMassVsMom->GetYaxis()->SetRange(0,400); fhTOFMassVsMom->GetXaxis()->SetTitle("Reconstructed Mass (GeV/c^{2})"); @@ -559,19 +535,19 @@ Bool_t AliTOFQATask::DrawHistos() Float_t kafrac=fhTOFIDSpecies->GetBinContent(4); Float_t prfrac=fhTOFIDSpecies->GetBinContent(5); - sprintf(ch,"[2]:pion fraction = %5.3f",pifrac); + sprintf(ch,"pion fraction = %5.3f",pifrac); TLatex * texpi = new TLatex(-0.3, 0.9, ch); texpi->SetTextColor(1); texpi->SetTextSize(0.05); texpi->SetLineWidth(2); texpi->Draw(); - sprintf(ch,"[3]:kaon fraction = %5.3f",kafrac); + sprintf(ch,"kaon fraction = %5.3f",kafrac); TLatex * texka = new TLatex(-0.3, 0.8, ch); texka->SetTextColor(1); texka->SetTextSize(0.05); texka->SetLineWidth(2); texka->Draw(); - sprintf(ch,"[4]:proton fraction = %5.3f",prfrac); + sprintf(ch,"proton fraction = %5.3f",prfrac); TLatex * texpr = new TLatex(-0.3, 0.7, ch); texpr->SetTextColor(1); texpr->SetTextSize(0.05); @@ -579,128 +555,44 @@ Bool_t AliTOFQATask::DrawHistos() texpr->Draw(); + cTOFpid->Print("TOF_pid.gif"); cTOFpid->Print("TOF_pid.eps"); - char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; - gROOT->ProcessLine(line); - sprintf(line, ".!rm -fR *.eps"); - gROOT->ProcessLine(line); - AliInfo(Form("*** TOF QA plots saved in %s.tar.gz...", GetName())) ; - - Bool_t hardProblem=kFALSE; - Bool_t softProblem=kFALSE; - //------------------------------Matching Efficiency - - //Overall Fraction: - Float_t matchFrac= fhTOFMatch->GetMean(); - if(matchFracGetEntries()<1.){ - AliWarning(Form("*** No tracks matching with TOF! Fraction is = %f", matchFrac)) ; - hardProblem=kTRUE; - return hardProblem; - } - + // draw all + //The General - //The efficiency as a function of momentum: - Float_t eff= fitMom->GetParameter(0); - Float_t deff= fitMom->GetParError(0); - if(eff+3*deff0.5 GeV is = %f", eff)) ; - } - - //Matched tracks vs TOF Sector: - for(Int_t isec=1;isec<=18;isec++){ - if(fhTOFsector->GetBinContent(isec)<1 && TOFsectors[isec-1]>0){ - AliWarning(Form("*** Missing Entries in sector %i", isec)); - softProblem=kTRUE; - } - if(fhTOFsector->GetBinContent(isec)>0 && TOFsectors[isec-1]==0){ - AliWarning(Form("*** Unexpected Entries in sector %i", isec)); - softProblem=kTRUE; - } - } - - //-----------------------------Pid Quality - - // Look at the time - expected time: - if(ntime==0){ - AliWarning("*** No peak was found in time difference spectrum!"); - } - else if (ntime>0){ - Float_t *timePos = timeDiff->GetPositionX(); - if(TMath::Abs(timePos[0])>3*ftimePeakMax){ - AliWarning(Form("*** Main Peak position in tTOF-TEXP spectrum is sitting very far from where expected! Tpeak = %f ps",timePos[0]*1.E3)); - hardProblem=kTRUE; - } - else if(TMath::Abs(timePos[0])>ftimePeakMax){ - AliWarning(Form("*** Main Peak position in tTOF-TEXP spectrum is sitting far from where expected! Tpeak = %f ps",timePos[0]*1.E3)); - softProblem=kTRUE; - }else{ - AliInfo(Form("*** Main Peak position in tTOF-TEXP found at = %f ps",timePos[0]*1.E3)); - } - } - // Look at the Mass Spectrum: - if(nmass==0){ - AliWarning("*** No peak was found in Mass difference spectrum!"); - softProblem=kTRUE; - } - else if(nmass>0){ - Int_t massind[3]; - Float_t *massPos = mass->GetPositionX(); - //check the found peaks (sorted in ascending mass order) - TMath::Sort(nmass,massPos,massind,kFALSE); - for(Int_t imass=0;imass fmassPeakMax){ - AliWarning(Form("*** the Mass peak position for %s is not in the right place, found at = %f GeV/c^2",part[imass],massPos[massind[imass]])); - softProblem=kTRUE; - } - } - // harder check on the pion peak (more statistically significant) - if(TMath::Abs( massPos[massind[0]]-masses[0])> 3*fmassPeakMax){ - hardProblem=kTRUE; - } - } - // Look at the ID Species: - - if(fhTOFIDSpecies->GetEntries()>1000){ - if(pifrac<0.8 || (kafrac<0.01 || kafrac>0.2) || (prfrac<0.01 || prfrac>0.2)){ - AliWarning(Form("*** Unexpected Id fractions: pions = %f, kaons = %f, protons %f", pifrac,kafrac,prfrac)); - softProblem=kTRUE; - } - } - - delete mass; - delete timeDiff; - return hardProblem || softProblem ; + //The efficiency } //______________________________________________________________________________ void AliTOFQATask::Terminate(Option_t *) { - // Processing when the event loop is ended, some plots+checks + // Processing when the event loop is ended - AliInfo(Form("*** %s Report:", GetName())) ; + // some plots + + AliInfo("TOF QA Task: End of events loop"); + fOutputContainer = (TObjArray*)GetOutputData(0); + fhTOFMatch = (TH1F*)fOutputContainer->At(0); + fhESDeffPhi = (TH1F*)fOutputContainer->At(1); + fhESDeffTheta = (TH1F*)fOutputContainer->At(2); + fhESDeffMom = (TH1F*)fOutputContainer->At(3); + fhTOFeffPhi = (TH1F*)fOutputContainer->At(4); + fhTOFeffPhiMT = (TH1F*)fOutputContainer->At(5); + fhTOFeffTheta = (TH1F*)fOutputContainer->At(6); + fhTOFeffThetaMT = (TH1F*)fOutputContainer->At(7); + fhTOFeffMom = (TH1F*)fOutputContainer->At(8); + fhTOFeffMomMT = (TH1F*)fOutputContainer->At(9); + fhTOFsector = (TH1F*)fOutputContainer->At(10); + fhTOFsectorMT = (TH1F*)fOutputContainer->At(11); + fhTOFTime = (TH1F*)fOutputContainer->At(12); + fhTOFDeltaTime = (TH1F*)fOutputContainer->At(13); + fhTOFDeltaTimeMT = (TH1F*)fOutputContainer->At(14); + fhTOFIDSpecies = (TH1F*)fOutputContainer->At(15); + fhTOFMassVsMom = (TH2F*)fOutputContainer->At(16); + fhTOFMass = (TH1F*)fOutputContainer->At(17); GetEfficiency(); - Bool_t problem = DrawHistos() ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report)) ; - +// PostData(0, fOutputContainer); + DrawHistos() ; } diff --git a/ESDCheck/AliTOFQATask.h b/ESDCheck/AliTOFQATask.h index 3c3e16d1ab6..fb796d03818 100644 --- a/ESDCheck/AliTOFQATask.h +++ b/ESDCheck/AliTOFQATask.h @@ -24,12 +24,13 @@ class AliTOFQATask : public AliAnalysisTask { AliTOFQATask& operator=(const AliTOFQATask & qatask); // assignment operator virtual ~AliTOFQATask(); //dtor virtual void Exec(Option_t * opt = "") ; - virtual void ConnectInputData(Option_t *) ; - virtual void CreateOutputObjects() ; + virtual void ConnectInputData(Option_t *); + virtual void CreateOutputObjects(); virtual void Terminate(Option_t * opt = "") ; private: - Bool_t DrawHistos() ; + void BookHistos() ; + void DrawHistos() ; void GetEfficiency() ; TTree * fChain ; //!pointer to the analyzed TTree or TChain AliESD * fESD ; //! Declaration of leave types @@ -56,12 +57,6 @@ class AliTOFQATask : public AliAnalysisTask { TH2F * fhTOFMassVsMom; //Mass vs Momentum correlation TH1F * fhTOFMass; //reconstructed Mass from TOF - // Some QA parameters - - Float_t fmatchFracMin; //Thresholds for QA checks (matched tracks) - Float_t fmatchEffMin; //Thresholds for QA checks (matched tracks) - Float_t ftimePeakMax; //Thresholds for QA checks (time spectrum) - Float_t fmassPeakMax; //Thresholds for QA checks (mass spectrum) - ClassDef(AliTOFQATask, 1); // TOF Quality Assurance analysis task + ClassDef(AliTOFQATask, 0); // TOF Quality Assurance analysis task }; #endif // ALITOFQATASK_H diff --git a/ESDCheck/AliTRDQATask.cxx b/ESDCheck/AliTRDQATask.cxx index be1fe6e88f0..196a3149f90 100644 --- a/ESDCheck/AliTRDQATask.cxx +++ b/ESDCheck/AliTRDQATask.cxx @@ -96,19 +96,19 @@ void AliTRDQATask::CreateOutputObjects() fXIn = new TH1D("xIn", ";X at the inner plane (cm)", 200, 50, 250); fXOut = new TH1D("xOut", ";X at the outer plane (cm)", 300, 50, 400); - const int knNameAlpha = 4; - const char *namesAlpha[knNameAlpha] = {"alphaTPCi", "alphaTPCo", "alphaTRDo", "alphaTRDr"}; + const int nNameAlpha = 4; + const char *namesAlpha[nNameAlpha] = {"alphaTPCi", "alphaTPCo", "alphaTRDo", "alphaTRDr"}; //TH1D *fAlpha[4]; - for(int i=0; iAddAt(fAlpha[3], counter++); fOutputContainer->AddAt(fSectorTRD, counter++); - for(int i=0; iAddAt(fPt[i], counter++); fOutputContainer->AddAt(fTheta[i], counter++); fOutputContainer->AddAt(fSigmaY[i], counter++); @@ -212,7 +212,7 @@ void AliTRDQATask::CreateOutputObjects() fOutputContainer->AddAt(fTrdSigMomPID[i], counter++); } - //AliInfo(Form("Number of histograms = %d", counter)); + AliInfo(Form("Number of histograms = %d", counter)); } @@ -263,7 +263,7 @@ void AliTRDQATask::Exec(Option_t *) for(int bit=0; bit<32; bit++) if (u<Fill(bit); - const int knbits = 6; + const int nbits = 6; int bit[6] = {0,0,0,0,0,0}; bit[0] = status & AliESDtrack::kTPCin; bit[1] = status & AliESDtrack::kTPCout; @@ -277,7 +277,7 @@ void AliTRDQATask::Exec(Option_t *) const double *val = track->GetParameter(); // parameters at the vertex double pt = 1./TMath::Abs(val[4]); - for(int b=0; bFill(pt); fTheta[b]->Fill(val[3]); @@ -318,7 +318,7 @@ void AliTRDQATask::Exec(Option_t *) // fill pid histograms double trdr0 = 0, tpcr0 = 0; int trdBestPid = 5, tpcBestPid = 5; // charged - const double kminPidValue = 0.9; + const double minPidValue = 0.9; double pp[5]; track->GetTPCpid(pp); // ESD inconsequence @@ -331,8 +331,8 @@ void AliTRDQATask::Exec(Option_t *) fTrdPID[pid]->Fill(track->GetTRDpid(pid)); fTpcPID[pid]->Fill(pp[pid]); - if (track->GetTRDpid(pid) > kminPidValue) trdBestPid = pid; - if (pp[pid] > kminPidValue) tpcBestPid = pid; + if (track->GetTRDpid(pid) > minPidValue) trdBestPid = pid; + if (pp[pid] > minPidValue) tpcBestPid = pid; } fTrdPID[5]->Fill(trdr0); // check unitarity @@ -352,6 +352,7 @@ void AliTRDQATask::Exec(Option_t *) void AliTRDQATask::Terminate(Option_t *) { // Processing when the event loop is ended + AliInfo("TRD QA module"); fOutputContainer = (TObjArray*)GetOutputData(0); int counter = 0; fNTracks = (TH1D*)fOutputContainer->At(counter++); @@ -368,8 +369,8 @@ void AliTRDQATask::Terminate(Option_t *) fAlpha[3] = (TH1D*)fOutputContainer->At(counter++); fSectorTRD = (TH1D*)fOutputContainer->At(counter++); - const int knbits = 6; - for(int i=0; iAt(counter++); fTheta[i] = (TH1D*)fOutputContainer->At(counter++); fSigmaY[i] = (TH1D*)fOutputContainer->At(counter++); @@ -398,34 +399,18 @@ void AliTRDQATask::Terminate(Option_t *) } // create efficiency histograms - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; CalculateEff(); +// PostData(0, fOutputContainer); DrawESD() ; DrawGeoESD() ; //DrawConvESD() ; DrawPidESD() ; - - char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; - gROOT->ProcessLine(line); - - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report)) ; - } //______________________________________________________________________________ -const int AliTRDQATask::GetSector(const double alpha) const +int AliTRDQATask::GetSector(double alpha) { // Gets the sector number @@ -435,13 +420,13 @@ const int AliTRDQATask::GetSector(const double alpha) const } //______________________________________________________________________________ -const int AliTRDQATask::CheckSector(const int sector) const +int AliTRDQATask::CheckSector(int sector) { // Checks the sector number - const int knSec = 8; + const int nSec = 8; int sec[] = {2,3,5,6,11,12,13,15}; - for(int i=0; iDivide(6,3) ; @@ -487,10 +474,10 @@ void AliTRDQATask::DrawESD() const // draw all - const int knplots = 18; - const int knover[knplots] = {1,1,1,4,1,1,1,1,1,1,2,1,1,3,1,1,1,1}; - const int knnames = 24; - const char *names[knnames] = { + const int nplots = 18; + const int nover[nplots] = {1,1,1,4,1,1,1,1,1,1,2,1,1,3,1,1,1,1}; + const int nnames = 24; + const char *names[nnames] = { "ntracks", "kinkIndex", "trackStatus", "ptTPCi", "ptTPCo", "ptTRDo", "ptTRDr", "ptTPCz", "ptTRDz", "eff_TPCi_TPCo", "eff_TPCo_TRDo", "eff_TRDo_TRDr", "eff_TPCo_TRDr", @@ -499,7 +486,7 @@ void AliTRDQATask::DrawESD() const "time", "budget", "signal" }; - const int klogy[knnames] = { + const int logy[nnames] = { 1,1,1, 1,1,1, 0,0,0,0, @@ -509,16 +496,16 @@ void AliTRDQATask::DrawESD() const }; int nhist=0; - for(int i=0; icd(i+1) ; // new TCanvas(names[i], names[nhist], 500, 300); + gPad->SetLogy(logy[i]); - for(int j=0; j(gDirectory->FindObject(names[nhist++])); if (!hist) continue; - if (hist->GetMaximum() > 0 ) - gPad->SetLogy(klogy[i]); + if (strstr(hist->GetName(), "eff")) { hist->SetMarkerStyle(20); hist->SetMinimum(0); @@ -529,14 +516,16 @@ void AliTRDQATask::DrawESD() const else hist->Draw("SAME"); } } - cTRD->Print("TRD_ESD.eps"); + cTRD->Print("TRD_ESD.gif"); } //______________________________________________________________________________ -void AliTRDQATask::DrawGeoESD() const +void AliTRDQATask::DrawGeoESD() { // Makes a few plots + AliInfo("Plotting....") ; + TCanvas * cTRDGeo = new TCanvas("cTRDGeo", "TRD ESDGeo Test", 400, 10, 600, 700) ; cTRDGeo->Divide(4,2) ; @@ -550,23 +539,23 @@ void AliTRDQATask::DrawGeoESD() const gStyle->SetTitleBorderSize(0); // draw all - const int knnames = 7; - const char *names[knnames] = { + const int nnames = 7; + const char *names[nnames] = { "xIn", "xOut", "planeYZTPCo", "planeYZTPCz", "planeYZTRDo", "planeYZTRDr", "planeYZTRDz", }; - const char *opt[knnames] = { + const char *opt[nnames] = { "", "", "colz","colz", "colz", "colz", "colz" }; - const int klogy[knnames] = { + const int logy[nnames] = { 1,1, 0,0,0,0,0 }; - for(int i=0; icd(i+1) ; TH1D *hist = dynamic_cast(gDirectory->FindObject(names[i])); if (!hist) continue; @@ -574,19 +563,18 @@ void AliTRDQATask::DrawGeoESD() const //if (i<2) new TCanvas(names[i], names[i], 500, 300); //else new TCanvas(names[i], names[i], 300, 900); - if (hist->GetMaximum() > 0 ) - gPad->SetLogy(klogy[i]); + gPad->SetLogy(logy[i]); if (strstr(opt[i],"colz")) gPad->SetRightMargin(0.1); hist->Draw(opt[i]); AliInfo(Form("%s\t%d", names[i], hist->GetEntries())); } - cTRDGeo->Print("TRD_Geo.eps"); + cTRDGeo->Print("TRD_Geo.gif"); } //______________________________________________________________________________ -void AliTRDQATask::DrawConvESD() const +void AliTRDQATask::DrawConvESD() { // Makes a few plots @@ -604,33 +592,32 @@ void AliTRDQATask::DrawConvESD() const gStyle->SetTitleFont(62, "XYZ"); gStyle->SetPadRightMargin(0.02); - const int knnames = 9; - const int knplots = 5; - const int knover[knplots] = {3,1,1,3,1}; + const int nnames = 9; + const int nplots = 5; + const int nover[nplots] = {3,1,1,3,1}; - const char *names[knnames] = { + const char *names[nnames] = { "sigmaYTPCo","sigmaYTRDo", "sigmaYTRDr", "sigmaYTPCz", "sigmaYTRDz", "Chi2TPCo", "Chi2TRDo", "Chi2TRDr", "Chi2TRDz" }; - const char *opt[knplots] = { + const char *opt[nplots] = { "", "", "","","", }; - const int klogy[knplots] = { + const int logy[nplots] = { 0,0,0,1,1 }; int nhist = 0; - for(int i=0; icd(i+1) ; //new TCanvas(names[i], names[i], 500, 300); + gPad->SetLogy(logy[i]); if (strstr(opt[i],"colz")) gPad->SetRightMargin(0.1); - for(int j=0; j(gDirectory->FindObject(names[nhist++])); - if ( hist->GetMaximum() > 0 ) - gPad->SetLogy(klogy[i]); if (!j) hist->Draw(opt[i]); else hist->Draw("same"); } @@ -640,10 +627,11 @@ void AliTRDQATask::DrawConvESD() const } //______________________________________________________________________________ -void AliTRDQATask::DrawPidESD() const +void AliTRDQATask::DrawPidESD() { // Makes a few plots + AliInfo("Plotting....") ; TCanvas * cTRDPid = new TCanvas("cTRDPid", "TRD ESDPid Test", 400, 10, 600, 700) ; cTRDPid->Divide(9,3) ; @@ -662,8 +650,8 @@ void AliTRDQATask::DrawPidESD() const // draw all - const int knnames = 27; - const char *names[knnames] = { + const int nnames = 27; + const char *names[nnames] = { "signal", "trdSigMom", "tpcSigMom", @@ -675,7 +663,7 @@ void AliTRDQATask::DrawPidESD() const }; - const char *opt[knnames] = { + const char *opt[nnames] = { "", "colz", "colz", @@ -686,7 +674,7 @@ void AliTRDQATask::DrawPidESD() const "colz", "colz", "colz", "colz", "colz", "colz" }; - const int klogy[knnames] = { + const int logy[nnames] = { 0,0,0, @@ -697,15 +685,14 @@ void AliTRDQATask::DrawPidESD() const 0,0,0,0,0,0 }; - for(int i=0; icd(i+1) ; TH1D *hist = dynamic_cast(gDirectory->FindObject(names[i])); if (!hist) continue; //new TCanvas(names[i], names[i], 500, 300); - if ( hist->GetMaximum() > 0 ) - gPad->SetLogy(klogy[i]); + gPad->SetLogy(logy[i]); if (strstr(opt[i],"colz")) gPad->SetRightMargin(0.1); if (strstr(names[i],"sigMom")) gPad->SetLogz(1); @@ -714,5 +701,5 @@ void AliTRDQATask::DrawPidESD() const hist->Draw(opt[i]); AliInfo(Form("%s\t%d", names[i], hist->GetEntries())); } - cTRDPid->Print("TRD_Pid.eps"); + cTRDPid->Print("TRD_Pid.gif"); } diff --git a/ESDCheck/AliTRDQATask.h b/ESDCheck/AliTRDQATask.h index ee350769bf1..6d67c7c7c10 100644 --- a/ESDCheck/AliTRDQATask.h +++ b/ESDCheck/AliTRDQATask.h @@ -1,18 +1,15 @@ #ifndef ALITRDQATASK_H -#define ALITRDQATASK_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ //______________________________________________________________________________ // An analysis task to check the TRD data in simulated data -// Starting from ESD -// Producing Histograms and plots -// Part of an analysis Train +// //*-- Sylwester Radomski ////////////////////////////////////////////////////////////////////////////// +#include #include "AliAnalysisTask.h" -class TTree; class AliESD; class TH1D; class TH2D; @@ -21,7 +18,6 @@ class AliTRDQATask : public AliAnalysisTask { public: AliTRDQATask(const char *name); - AliTRDQATask(AliTRDQATask& trd) { new AliTRDQATask(trd.GetName());} virtual ~AliTRDQATask() {} virtual void Exec(Option_t * opt = ""); @@ -31,13 +27,13 @@ class AliTRDQATask : public AliAnalysisTask { private: - const int GetSector(const double alpha) const; - const int CheckSector(const int sector) const; + int GetSector(double alpha); + int CheckSector(int sector); void CalculateEff(); - void DrawESD() const ; - void DrawGeoESD() const ; - void DrawConvESD() const ; - void DrawPidESD() const ; + void DrawESD() ; + void DrawGeoESD() ; + void DrawConvESD() ; + void DrawPidESD() ; TTree * fChain; //!pointer to the analyzed TTree or TChain AliESD * fESD; //! Declaration of leave types @@ -45,16 +41,16 @@ class AliTRDQATask : public AliAnalysisTask { TObjArray * fOutputContainer; //! output data container // options - int fConfSM; //!Super Module Configuration + int fConfSM; // Histograms - TH1D *fNTracks; // Number of tracks - TH1D *fEventSize; // Event size - TH1D *fTrackStatus; // Status of tracks + TH1D *fNTracks; + TH1D *fEventSize; + TH1D *fTrackStatus; - TH1D *fParIn; // Par In - TH1D *fParOut; // Par out - TH1D *fKinkIndex; // Kink Index + TH1D *fParIn; + TH1D *fParOut; + TH1D *fKinkIndex; // TPC clusters histograms //TH1D *fTpcNCls; @@ -62,42 +58,42 @@ class AliTRDQATask : public AliAnalysisTask { //TH1D *fTpcRCls; // last measurement X plane - TH1D *fXIn; // input Xplane - TH1D *fXOut; // output Xplane + TH1D *fXIn; + TH1D *fXOut; // sector - TH1D *fAlpha[4]; // alpha sectors - TH1D *fSectorTRD; // TRD sectors + TH1D *fAlpha[4]; + TH1D *fSectorTRD; //static const int knbits = 5; // track parameters - TH1D *fPt[6]; // Transverse momentum - TH1D *fTheta[6]; // Theta distribution - TH1D *fSigmaY[6]; // Sigma Y - TH1D *fChi2[6]; // Chi 2 - TH2D *fPlaneYZ[6]; // YZ Plane + TH1D *fPt[6]; + TH1D *fTheta[6]; + TH1D *fSigmaY[6]; + TH1D *fChi2[6]; + TH2D *fPlaneYZ[6]; - TH1D *fEffPt[4]; // Eff transverse momentum + TH1D *fEffPt[4]; // track features - TH1D *fClustersTRD[3]; // Clusters + TH1D *fClustersTRD[3]; // for good refitted tracks only - TH1D *fTime; // time - TH1D *fBudget; // Budget - TH1D *fQuality; // Quality - TH1D *fSignal; // Signal + TH1D *fTime; + TH1D *fBudget; + TH1D *fQuality; + TH1D *fSignal; // PID for TPC and TRD - TH2D *fTrdSigMom; // Sig TRD - TH2D *fTpcSigMom; // Sig TPC + TH2D *fTrdSigMom; + TH2D *fTpcSigMom; - TH1D *fTrdPID[6]; // Pid TRD - TH2D *fTrdSigMomPID[6];// Pid TRD + TH1D *fTrdPID[6]; + TH2D *fTrdSigMomPID[6]; - TH1D *fTpcPID[6]; // Pid TPC - TH2D *fTpcSigMomPID[6];// Pid TPC + TH1D *fTpcPID[6]; + TH2D *fTpcSigMomPID[6]; ClassDef(AliTRDQATask, 0); // a TRD analysis task diff --git a/ESDCheck/AliVZEROQATask.cxx b/ESDCheck/AliVZEROQATask.cxx index 8ef800b44b5..995e61932ac 100644 --- a/ESDCheck/AliVZEROQATask.cxx +++ b/ESDCheck/AliVZEROQATask.cxx @@ -150,10 +150,8 @@ void AliVZEROQATask::Terminate(Option_t *) fhVZEROMultA = (TH1I*)fOutputContainer->At(2); fhVZEROMultC = (TH1I*)fOutputContainer->At(3); - Bool_t problem = kFALSE ; - AliInfo(Form(" *** %s Report:", GetName())) ; - printf(" V0A Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultA->GetMean(),fhVZEROMultA->GetRMS()); - printf(" V0C Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultC->GetMean(),fhVZEROMultC->GetRMS()); + printf("V0A Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultA->GetMean(),fhVZEROMultA->GetRMS()); + printf("V0C Multiplicity Mean : %5.3f , RMS : %5.3f \n",fhVZEROMultC->GetMean(),fhVZEROMultC->GetRMS()); TCanvas * c1 = new TCanvas("Number of PMs fired in V0A", "Number of PMs fired in V0A", 1); fhVZERONbPMA->SetAxisRange(0, 99); @@ -185,19 +183,11 @@ void AliVZEROQATask::Terminate(Option_t *) c4->Print("NumberV0CPMs.eps"); char line[1024] ; - sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ; gROOT->ProcessLine(line); sprintf(line, ".!rm -fR *.eps"); gROOT->ProcessLine(line); - AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! ", GetName())) ; - - char * report ; - if(problem) - report="Problems found, please check!!!"; - else - report="OK"; - - AliInfo(Form("*** %s Summary Report: %s\n",GetName(), report)) ; + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;c4->Print("NumberPMsV0C.eps"); } diff --git a/ESDCheck/CheckESD.sh b/ESDCheck/CheckESD.sh deleted file mode 100755 index 986d1d840b5..00000000000 --- a/ESDCheck/CheckESD.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -currentDir=`pwd` -PACKAGES="ESD ANALYSIS AnalysisCheck" -DETECTORS="PHOS EMCal PMD HMPID T0 MUON TOF VZERO" -LOGFILE=`echo $0 | sed -e 's/sh/log/'` -function testpack() -{ - test=`cat CheckESD.log | grep "$2 done"` - if [ "$test" = "" ]; then - echo --ERROR $1 $2 - rv=1 - else - echo ++OK $1 $2 - rv=0 - fi - return $rv -} -function testdet() -{ - test=`cat CheckESD.log | grep "$2 Summary Report: OK"` - if [ "$test" = "" ]; then - echo --ERROR $1 $2 - rv=1 - else - echo ++OK $1 $2 - rv=0 - fi - return $rv -} -#Start -if [ -e $LOGFILE ]; then - rm $LOGFILE -fi -echo $0 LOG > $LOGFILE -# make the par files -cd $ALICE_ROOT -for pack in $PACKAGES; do - make $pack.par >> $currentDir/$LOGFILE -done -# copy the par file to the working directory -cd $currentDir -for pack in $PACKAGES; do - rm -fr $pack* - mv $ALICE_ROOT/$pack.par . -done -cp $ALICE_ROOT/ESDCheck/ana.C . -# run root -if [ ! -e "AliESDs.root" ]; then - echo File AliESDs.root not found >> $LOGFILE - exit 1 -fi -root -b -q ana.C >> $LOGFILE 2>&1 -#test function for parsing log file -# parse the log file -error=0 -for pack in $PACKAGES; do - testpack creating $pack.par - testpack loading lib$pack - let "error +=$?" -done - -for det in $DETECTORS; do - testdet Checking $det - let "error +=$?" -done -if [ "$error" > "0" ]; then - echo --------------- $error errors signaled -else - echo +++++++++++++++ All OK -fi -exit $error - diff --git a/ESDCheck/Makefile b/ESDCheck/Makefile index 0e16723a454..17724566a40 100644 --- a/ESDCheck/Makefile +++ b/ESDCheck/Makefile @@ -59,7 +59,7 @@ $(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_AnalysisCheck) $ @echo "Creating archive" $@ ... @tar cfzh $@ $(PACKAGE) @rm -rf $(PACKAGE) - @echo $@ "done" + @echo "done" $(PACKAGE)/Makefile: Makefile #.$(PACKAGE) @echo Copying $< to $@ with transformations diff --git a/ESDCheck/ana.C b/ESDCheck/ana.C index 9f1c0c456f2..457bdcda77f 100644 --- a/ESDCheck/ana.C +++ b/ESDCheck/ana.C @@ -14,7 +14,7 @@ Bool_t LoadLib( const char* pararchivename) if (pararchivename) { char processline[1024]; sprintf(processline,".! tar xvzf %s.par",pararchivename); - gROOT->ProcessLine(processline); + //gROOT->ProcessLine(processline); gSystem->ChangeDirectory(pararchivename); // check for BUILD.sh and execute @@ -36,22 +36,18 @@ Bool_t LoadLib( const char* pararchivename) } if ( strstr(pararchivename, "ESD") ) { - //gSystem->Load("libVMC.so"); - //gSystem->Load("libRAliEn.so"); - gSystem->Load("libESD.so") ; - //gSystem->Load("libProof.so") ; + gSystem->Load("libVMC.so"); + gSystem->Load("libESD.so"); + gSystem->Load("libRAliEn.so") ; + gSystem->Load("libProof.so") ; } - if ( strstr(pararchivename, "AnalysisCheck") ) { - gSystem->Load("libSpectrum.so"); - } - - printf("lib%s done\n", pararchivename); + printf("*** %s library loaded *** %s **\n", pararchivename); gSystem->ChangeDirectory(cdir); gIsAnalysisLoaded = kTRUE ; - return rv ; + return rv ; ; } //______________________________________________________________________ @@ -60,6 +56,7 @@ void ana() if (! gIsAnalysisLoaded ) { LoadLib("ESD") ; LoadLib("ANALYSIS") ; + printf("Include path = %s\n", gSystem->GetIncludePath()) ; LoadLib("AnalysisCheck") ; } @@ -123,11 +120,7 @@ void ana() // definition of Tag cuts const char * runCuts = 0x0 ; - const char * evtCuts = 0x0 ; - const char * lhcCuts = 0x0 ; - const char * detCuts = 0x0 ; - -//"fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ; + const char * evtCuts = 0x0 ; //"fEventTag.fNPHOSClustersMin == 1 && fEventTag.fNEMCALClustersMin == 1" ; TString input = gSystem->Getenv("ANA_INPUT") ; @@ -137,7 +130,7 @@ void ana() //create the ESD collection from the tag collection input.ReplaceAll("tag?", "") ; const char * collESD = "esdCollection.xml" ; - ag->MakeEsdCollectionFromTagCollection(runCuts, lhcCuts, detCuts, evtCuts, input.Data(), collESD) ; + ag->MakeEsdCollectionFromTagCollection(runCuts, evtCuts, input.Data(), collESD) ; sprintf(argument, "esd?%s", collESD) ; } else if ( input.Contains("esd?") ) sprintf(argument, "%s", input.Data()) ; @@ -148,11 +141,10 @@ void ana() TChain* analysisChain = new TChain("esdTree") ; // input = "alien:///alice/cern.ch/user/a/aliprod/prod2006_2/output_pp/105/411/AliESDs.root" ; // analysisChain->AddFile(input); - input = "AliESDs.root" ; + input = "/home/schutz/group/schutz/work/analysis/QA/HEAD/RunV0/AliESDs.root" ; analysisChain->AddFile(input); ag->Process(analysisChain) ; } - return ; } //______________________________________________________________________ @@ -165,3 +157,17 @@ void Merge(const char * xml, const char * sub, const char * out) ag->Merge(xml, sub, out) ; } +//______________________________________________________________________ +void test(const char * fcollection1) +{ + AliXMLCollection collection1(fcollection1); + TChain* analysisChain = new TChain("esdTree"); + + collection1.Reset(); + while (collection1.Next()) { + cout<<"Adding "<Add(collection1.GetTURL()); + } + + return ; +} diff --git a/EVE/binalieve.pkg b/EVE/binalieve.pkg index a530e69cd4b..9a142eca0d7 100644 --- a/EVE/binalieve.pkg +++ b/EVE/binalieve.pkg @@ -4,7 +4,7 @@ CSRCS := EINCLUDE := ELIBSDIR := ELIBS := Reve Alieve \ - MUONevaluation MUONgeometry MUONrec MUONsim MUONbase MUONtrigger MUONraw MUONcalib MUONmapping \ + MUONgeometry MUONrec MUONsim MUONbase MUONraw MUONcalib MUONmapping \ TPCbase TPCsim TPCrec TPCfast \ ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase \ TRDsim TRDrec TRDfast \ diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 25c9d740d23..06e62b512b1 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -72,7 +72,7 @@ AliHLTComponent::AliHLTComponent() memset(&fEnvironment, 0, sizeof(AliHLTComponentEnvironment)); if (fgpComponentHandler) fgpComponentHandler->ScheduleRegister(this); - //SetLocalLoggingLevel(kHLTLogDefault); + SetLocalLoggingLevel(kHLTLogDefault); } AliHLTComponent::AliHLTComponent(const AliHLTComponent&) @@ -452,7 +452,7 @@ const TObject* AliHLTComponent::GetFirstInputObject(const AliHLTComponentDataTyp fSearchDataType=dt; if (classname) fClassName=classname; else fClassName.clear(); - int idx=FindInputBlock(fSearchDataType, 0, 1); + int idx=FindInputBlock(fSearchDataType, 0); HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(dt).c_str()); TObject* pObj=NULL; if (idx>=0) { @@ -480,7 +480,7 @@ const TObject* AliHLTComponent::GetNextInputObject(int bForce) { // see header file for function documentation ALIHLTCOMPONENT_BASE_STOPWATCH(); - int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1, 1); + int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1); //HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(fSearchDataType).c_str()); TObject* pObj=NULL; if (idx>=0) { @@ -491,18 +491,13 @@ const TObject* AliHLTComponent::GetNextInputObject(int bForce) return pObj; } -int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx, int bObject) const +int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx) const { // see header file for function documentation int iResult=-ENOENT; if (fpInputBlocks!=NULL) { int idx=startIdx<0?0:startIdx; for ( ; (UInt_t)idxGetName()); } else { } - //} else { - } else if (bForce!=0) { + } else { + // } else if (bForce!=0) { HLTError("size missmatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t)); } } else { @@ -635,7 +630,6 @@ const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const AliHLT if (idx>=0) { // check for fpInputBlocks pointer done in FindInputBlock pBlock=&fpInputBlocks[idx]; - fCurrentInputBlock=idx; } return pBlock; } @@ -659,7 +653,6 @@ const AliHLTComponentBlockData* AliHLTComponent::GetNextInputBlock() if (idx>=0) { // check for fpInputBlocks pointer done in FindInputBlock pBlock=&fpInputBlocks[idx]; - fCurrentInputBlock=idx; } return pBlock; } diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index dbbdd31e773..c18ff34db5a 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -12,12 +12,6 @@ @brief Base class declaration for HLT components. @note The class is both used in Online (PubSub) and Offline (AliRoot) context - -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt */ /** * @defgroup alihlt_component Component handling of the HLT module @@ -754,17 +748,13 @@ class AliHLTComponent : public AliHLTLogging { /** * Find the first input block of specified data type beginning at index. - * Input blocks containing a TObject have the size of the object as an - * unsigned 32 bit number in the first 4 bytes. This has to match the block - * size minus 4. * @param dt data type * @param startIdx index to start the search - * @param bObject check if this is an object * @return index of the block, -ENOENT if no block found * * @internal */ - int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1, int bObject=0) const; + int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1) const; /** * Get index in the array of input bocks. diff --git a/HLT/BASE/AliHLTComponentHandler.cxx b/HLT/BASE/AliHLTComponentHandler.cxx index b6e8a3eb77c..28a829399f0 100644 --- a/HLT/BASE/AliHLTComponentHandler.cxx +++ b/HLT/BASE/AliHLTComponentHandler.cxx @@ -31,12 +31,11 @@ using namespace std; //#include #include #endif //HAVE_DLFCN_H -//#include "AliHLTStdIncludes.h" +#include "AliHLTStdIncludes.h" #include "AliHLTComponentHandler.h" #include "AliHLTComponent.h" #include "AliHLTDataTypes.h" -//#include "AliHLTSystem.h" -#include "TString.h" +#include "AliHLTSystem.h" // the standard components // #include "AliHLTFilePublisher.h" @@ -87,25 +86,6 @@ AliHLTComponentHandler::AliHLTComponentHandler(AliHLTComponentEnvironment* pEnv) AddStandardComponents(); } -AliHLTComponentHandler::AliHLTComponentHandler(const AliHLTComponentHandler&) - : - fComponentList(), - fScheduleList(), - fLibraryList(), - fEnvironment(), - fStandardList() -{ - // see header file for class documentation - HLTFatal("copy constructor untested"); -} - -AliHLTComponentHandler& AliHLTComponentHandler::operator=(const AliHLTComponentHandler&) -{ - // see header file for class documentation - HLTFatal("assignment operator untested"); - return *this; -} - AliHLTComponentHandler::~AliHLTComponentHandler() { // see header file for class documentation @@ -155,10 +135,8 @@ Int_t AliHLTComponentHandler::RegisterComponent(AliHLTComponent* pSample) int AliHLTComponentHandler::DeregisterComponent( const char* componentID ) { // see header file for class documentation - int iResult=0; if (componentID) { - HLTWarning("not yet implemented, please notify the developers if you need this function"); } else { iResult=-EINVAL; } @@ -284,7 +262,7 @@ int AliHLTComponentHandler::LoadLibrary( const char* libraryPath ) const char* loadtype=""; #ifdef HAVE_DLFCN_H // use interface to the dynamic linking loader - hLib.fHandle=dlopen(libraryPath, RTLD_NOW); + hLib.handle=dlopen(libraryPath, RTLD_NOW); loadtype="dlopen"; #else // use ROOT dynamic loader @@ -292,23 +270,23 @@ int AliHLTComponentHandler::LoadLibrary( const char* libraryPath ) // 'failure' if the library was already loaded AliHLTLibHandle* pLib=FindLibrary(libraryPath); if (pLib) { - int* pRootHandle=reinterpret_cast(pLib->fHandle); + int* pRootHandle=reinterpret_cast(pLib->handle); (*pRootHandle)++; HLTDebug("instance %d of library %s loaded", (*pRootHandle), libraryPath); - hLib.fHandle=pRootHandle; + hLib.handle=pRootHandle; } - if (hLib.fHandle==NULL && gSystem->Load(libraryPath)==0) { + if (hLib.handle==NULL && gSystem->Load(libraryPath)==0) { int* pRootHandle=new int; if (pRootHandle) *pRootHandle=1; - hLib.fHandle=pRootHandle; + hLib.handle=pRootHandle; //HLTDebug("library %s loaded via gSystem", libraryPath); } loadtype="gSystem"; #endif //HAVE_DLFCN_H - if (hLib.fHandle!=NULL) { + if (hLib.handle!=NULL) { // create TString object to store library path and use pointer as handle - hLib.fName=new TString(libraryPath); + hLib.name=new TString(libraryPath); HLTInfo("library %s loaded (%s)", libraryPath, loadtype); fLibraryList.insert(fLibraryList.begin(), hLib); iResult=RegisterScheduledComponents(); @@ -337,7 +315,7 @@ int AliHLTComponentHandler::UnloadLibrary( const char* libraryPath ) if (libraryPath) { vector::iterator element=fLibraryList.begin(); while (element!=fLibraryList.end()) { - TString* pName=reinterpret_cast((*element).fName); + TString* pName=reinterpret_cast((*element).name); if (pName->CompareTo(libraryPath)==0) { UnloadLibrary(*element); fLibraryList.erase(element); @@ -356,11 +334,11 @@ int AliHLTComponentHandler::UnloadLibrary(AliHLTComponentHandler::AliHLTLibHandl // see header file for class documentation int iResult=0; fgAliLoggingFunc=NULL; - TString* pName=reinterpret_cast(handle.fName); + TString* pName=reinterpret_cast(handle.name); #ifdef HAVE_DLFCN_H - dlclose(handle.fHandle); + dlclose(handle.handle); #else - int* pCount=reinterpret_cast(handle.fHandle); + int* pCount=reinterpret_cast(handle.handle); if (--(*pCount)==0) { if (pName) { /** Matthias 26.04.2007 @@ -388,8 +366,8 @@ int AliHLTComponentHandler::UnloadLibrary(AliHLTComponentHandler::AliHLTLibHandl delete pCount; } #endif //HAVE_DLFCN_H - handle.fName=NULL; - handle.fHandle=NULL; + handle.name=NULL; + handle.handle=NULL; if (pName) { HLTDebug("unload library %s", pName->Data()); delete pName; @@ -420,9 +398,9 @@ void* AliHLTComponentHandler::FindSymbol(const char* library, const char* symbol if (hLib==NULL) return NULL; void* pFunc=NULL; #ifdef HAVE_DLFCN_H - pFunc=dlsym(hLib->fHandle, symbol); + pFunc=dlsym(hLib->handle, symbol); #else - TString* name=reinterpret_cast(hLib->fName); + TString* name=reinterpret_cast(hLib->name); pFunc=gSystem->DynFindSymbol(name->Data(), symbol); #endif return pFunc; @@ -434,7 +412,7 @@ AliHLTComponentHandler::AliHLTLibHandle* AliHLTComponentHandler::FindLibrary(con AliHLTLibHandle* hLib=NULL; vector::iterator element=fLibraryList.begin(); while (element!=fLibraryList.end()) { - TString* name=reinterpret_cast((*element).fName); + TString* name=reinterpret_cast((*element).name); if (name->CompareTo(library)==0) { hLib=&(*element); break; @@ -479,7 +457,7 @@ int AliHLTComponentHandler::DeleteStandardComponents() int iResult=0; vector::iterator element=fStandardList.begin(); while (element!=fStandardList.end()) { - //DeregisterComponent((*element)->GetComponentID()); + DeregisterComponent((*element)->GetComponentID()); delete(*element); fStandardList.erase(element); element=fStandardList.begin(); diff --git a/HLT/BASE/AliHLTComponentHandler.h b/HLT/BASE/AliHLTComponentHandler.h index 3ee115d89ca..6e0288d8f30 100644 --- a/HLT/BASE/AliHLTComponentHandler.h +++ b/HLT/BASE/AliHLTComponentHandler.h @@ -1,4 +1,3 @@ -//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTCOMPONENTHANDLER_H @@ -13,15 +12,10 @@ @note The handler is part of the interface and both used in the Online (PubSub) and Offline (AliRoot) context. */ - -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + #include -//#include "TObject.h" +#include "TObject.h" #include "AliHLTDataTypes.h" #include "AliHLTLogging.h" @@ -41,10 +35,6 @@ class AliHLTComponentHandler : public AliHLTLogging { AliHLTComponentHandler(); /** constructor */ AliHLTComponentHandler(AliHLTComponentEnvironment* pEnv); - /** not a valid copy constructor, defined according to effective C++ style */ - AliHLTComponentHandler(const AliHLTComponentHandler&); - /** not a valid assignment op, but defined according to effective C++ style */ - AliHLTComponentHandler& operator=(const AliHLTComponentHandler&); /** destructor */ virtual ~AliHLTComponentHandler(); @@ -220,11 +210,11 @@ class AliHLTComponentHandler : public AliHLTLogging { * Compount descriptor for component libraries */ struct AliHLTLibHandle { - AliHLTLibHandle() : fHandle(NULL), fName(NULL) {} + AliHLTLibHandle() : handle(NULL), name(NULL) {} /** dlopen handle */ - void* fHandle; //! transient + void* handle; //! transient /** name of the library, casted to TString* before use */ - void* fName; //! transient + void* name; //! transient }; /** diff --git a/HLT/BASE/AliHLTConfiguration.h b/HLT/BASE/AliHLTConfiguration.h index 0c41a019688..574b71ee44c 100644 --- a/HLT/BASE/AliHLTConfiguration.h +++ b/HLT/BASE/AliHLTConfiguration.h @@ -1,4 +1,3 @@ -//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTCONFIGURATION_H @@ -13,12 +12,6 @@ @note The class is used in Offline (AliRoot) context */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include #include #include diff --git a/HLT/BASE/AliHLTConfigurationHandler.h b/HLT/BASE/AliHLTConfigurationHandler.h index aec210c8e75..5ea2ac0c45c 100644 --- a/HLT/BASE/AliHLTConfigurationHandler.h +++ b/HLT/BASE/AliHLTConfigurationHandler.h @@ -1,4 +1,3 @@ -//-*- Mode: C++ -*- // $Id$ #ifndef ALIHLTCONFIGURATIONHANDLER_H @@ -12,12 +11,6 @@ @brief Global handling of HLT configurations. */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include class AliHLTConfiguration; diff --git a/HLT/BASE/AliHLTDataBuffer.cxx b/HLT/BASE/AliHLTDataBuffer.cxx index 5bc3fd4bbfc..323388a8f3b 100644 --- a/HLT/BASE/AliHLTDataBuffer.cxx +++ b/HLT/BASE/AliHLTDataBuffer.cxx @@ -21,12 +21,6 @@ @brief Handling of Data Buffers for HLT components. */ -// see header file for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #if __GNUC__>= 3 using namespace std; #endif diff --git a/HLT/BASE/AliHLTDataBuffer.h b/HLT/BASE/AliHLTDataBuffer.h index 6684d42d0d2..b503acb2fd0 100644 --- a/HLT/BASE/AliHLTDataBuffer.h +++ b/HLT/BASE/AliHLTDataBuffer.h @@ -12,16 +12,12 @@ @note The class is used in Offline (AliRoot) context */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include #include "AliHLTLogging.h" #include "AliHLTDataTypes.h" +//#include "AliHLTDefinitions.h" #include "TObject.h" +//#include "TList.h" class AliHLTComponent; class AliHLTConsumerDescriptor; @@ -197,8 +193,6 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging * @brief Descriptor of a data segment within the buffer. */ class AliHLTDataSegment { - friend class AliHLTDataBuffer; - friend class AliHLTConsumerDescriptor; public: AliHLTDataSegment() : @@ -218,7 +212,6 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging { memset(&fDataType, 0, sizeof(AliHLTComponentDataType)); } - private: /** the data type of this segment */ AliHLTComponentDataType fDataType; // see above /** offset in byte within the data buffer */ @@ -234,17 +227,15 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging * @brief Descriptor of the raw data buffer which can host several segments. */ class AliHLTRawBuffer { - friend class AliHLTDataBuffer; public: /** standard constructor */ AliHLTRawBuffer() : fSize(0), fTotalSize(0), fPtr(NULL) {} /** not a valid copy constructor, defined according to effective C++ style */ AliHLTRawBuffer(const AliHLTRawBuffer&) : fSize(0), fTotalSize(0), fPtr(NULL) {} /** not a valid assignment op, but defined according to effective C++ style */ - AliHLTRawBuffer& operator=(const AliHLTRawBuffer&) {return *this;} + AliHLTRawBuffer& operator=(const AliHLTRawBuffer&) {return *this;} /** standard destructor */ virtual ~AliHLTRawBuffer() {} - private: /** size of the currently occupied partition of the buffer */ AliHLTUInt32_t fSize; // see above /** total size of the buffer, including safety margin */ diff --git a/HLT/BASE/AliHLTDataSink.h b/HLT/BASE/AliHLTDataSink.h index 94ea512443c..0141869f18b 100644 --- a/HLT/BASE/AliHLTDataSink.h +++ b/HLT/BASE/AliHLTDataSink.h @@ -13,12 +13,6 @@ @note The class is used in Offline (AliRoot) context */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include "AliHLTComponent.h" /** diff --git a/HLT/BASE/AliHLTDataSource.h b/HLT/BASE/AliHLTDataSource.h index 6977695cacf..07726bdeb94 100644 --- a/HLT/BASE/AliHLTDataSource.h +++ b/HLT/BASE/AliHLTDataSource.h @@ -13,12 +13,6 @@ @note The class is used in Offline (AliRoot) context */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include "AliHLTComponent.h" /** diff --git a/HLT/BASE/AliHLTModuleAgent.h b/HLT/BASE/AliHLTModuleAgent.h index 1171aeb4cea..fddcc96765d 100644 --- a/HLT/BASE/AliHLTModuleAgent.h +++ b/HLT/BASE/AliHLTModuleAgent.h @@ -1,4 +1,3 @@ -//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTMODULEAGENT_H @@ -13,12 +12,6 @@ @note The class is used in Offline (AliRoot) context */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include #include #include "AliHLTLogging.h" diff --git a/HLT/BASE/AliHLTOfflineDataSink.h b/HLT/BASE/AliHLTOfflineDataSink.h index 9050858bafc..b70d058293f 100644 --- a/HLT/BASE/AliHLTOfflineDataSink.h +++ b/HLT/BASE/AliHLTOfflineDataSink.h @@ -12,12 +12,6 @@ @brief AliRoot data sink component base class. */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include "AliHLTDataSink.h" #include "AliHLTOfflineInterface.h" diff --git a/HLT/BASE/AliHLTOfflineDataSource.h b/HLT/BASE/AliHLTOfflineDataSource.h index 5f4ffc149b7..7e0bcc767dd 100644 --- a/HLT/BASE/AliHLTOfflineDataSource.h +++ b/HLT/BASE/AliHLTOfflineDataSource.h @@ -12,12 +12,6 @@ @brief AliRoot data sink component base class. */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include "AliHLTDataSource.h" #include "AliHLTOfflineInterface.h" diff --git a/HLT/BASE/AliHLTOfflineInterface.h b/HLT/BASE/AliHLTOfflineInterface.h index cbd3af96860..7e853bc3d22 100644 --- a/HLT/BASE/AliHLTOfflineInterface.h +++ b/HLT/BASE/AliHLTOfflineInterface.h @@ -12,12 +12,6 @@ @brief the HLT interface to AliRoot */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include #include diff --git a/HLT/BASE/AliHLTProcessor.h b/HLT/BASE/AliHLTProcessor.h index 3f8cb0ed5c3..1d74711dbf9 100644 --- a/HLT/BASE/AliHLTProcessor.h +++ b/HLT/BASE/AliHLTProcessor.h @@ -11,12 +11,6 @@ @date @brief Base class declaration for HLT analysis components. */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include "AliHLTComponent.h" /** diff --git a/HLT/BASE/AliHLTSystem.h b/HLT/BASE/AliHLTSystem.h index 6478ef29a26..7a130133406 100644 --- a/HLT/BASE/AliHLTSystem.h +++ b/HLT/BASE/AliHLTSystem.h @@ -1,4 +1,3 @@ -//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTSYSTEM_H @@ -13,12 +12,6 @@ @note The class is used in Offline (AliRoot) context */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - /** * @defgroup alihlt_system HLT integration into AliRoot * This section describes the HLT integration into AliRoot. diff --git a/HLT/BASE/AliHLTTask.h b/HLT/BASE/AliHLTTask.h index b4075d2be96..c6d6bd0245c 100644 --- a/HLT/BASE/AliHLTTask.h +++ b/HLT/BASE/AliHLTTask.h @@ -1,4 +1,3 @@ -//-*- Mode: C++ -*- // $Id$ #ifndef ALIHLTTASK_H @@ -12,12 +11,6 @@ @brief base class for HLT tasks */ -// see below for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt - #include #include #include diff --git a/HLT/BASE/Makefile.am b/HLT/BASE/Makefile.am index 28bd52b2125..7da3c74e5e7 100644 --- a/HLT/BASE/Makefile.am +++ b/HLT/BASE/Makefile.am @@ -8,7 +8,7 @@ # e.g. for libHLTbase, MODULE=HLTbase MODULE = HLTbase -SUBDIRS = . util interface +SUBDIRS = . util EXTRA_DIST = HLTbaseLinkDef.h @@ -20,7 +20,7 @@ bin_SCRIPTS = setenv.sh setenv.csh lib_LTLIBRARIES = libHLTbase.la # version info for the library -LIBRARY_VERSION = '4:0:1' +LIBRARY_VERSION = '3:1:1' # MODDIR is set by the AliRoot build system and denotes the topdir # of the module, we must set it since the package definition libHLTbase.pkg diff --git a/HLT/BASE/interface/AliHLTExternalInterface.cxx b/HLT/BASE/interface/AliHLTExternalInterface.cxx deleted file mode 100644 index a7a8b6ff95a..00000000000 --- a/HLT/BASE/interface/AliHLTExternalInterface.cxx +++ /dev/null @@ -1,123 +0,0 @@ -// $Id$ - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Matthias Richter * - * Timm Steinbeck * - * for The ALICE Off-line Project. * - * * - * 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. * - **************************************************************************/ - -/** @file AliHLTExternalInterface.cxx - @author Matthias Richter, Timm Steinbeck - @date - @brief Pure C interface to the AliRoot HLT component handler -*/ - -#if __GNUC__>= 3 -using namespace std; -#endif - -#include "AliHLT_C_Component_WrapperInterface.h" -#include "AliHLTComponentHandler.h" -#include "AliHLTComponent.h" -#include - -static AliHLTComponentHandler *gComponentHandler_C = NULL; - - -int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ ) -{ - if ( gComponentHandler_C ) - { - return EINPROGRESS; - } - gComponentHandler_C = new AliHLTComponentHandler(environ); - if ( !gComponentHandler_C ) - return EFAULT; - gComponentHandler_C->InitAliLogTrap(gComponentHandler_C); - gComponentHandler_C->AnnounceVersion(); - return 0; -} - -int AliHLT_C_Component_DeinitSystem() -{ - if ( gComponentHandler_C ) - { - delete gComponentHandler_C; - gComponentHandler_C = NULL; - } - return 0; -} - -int AliHLT_C_Component_LoadLibrary( const char* libraryPath ) -{ - if ( !gComponentHandler_C ) - return ENXIO; - return gComponentHandler_C->LoadLibrary( libraryPath ); -} - -int AliHLT_C_Component_UnloadLibrary( const char* libraryPath ) -{ - if ( !gComponentHandler_C ) - return ENXIO; - return gComponentHandler_C->UnloadLibrary( libraryPath ); -} - -int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponentHandle* handle ) -{ - if ( !gComponentHandler_C ) - return ENXIO; - AliHLTComponent* comp; - int ret = gComponentHandler_C->CreateComponent( componentType, environ_param, argc, argv, comp ); - *handle = reinterpret_cast( comp ); - return ret; -} - -void AliHLT_C_DestroyComponent( AliHLTComponentHandle handle ) -{ - if ( !handle ) - return; - - AliHLTComponent* pComp=reinterpret_cast( handle ); - pComp->Deinit(); - delete pComp; -} - -int AliHLT_C_ProcessEvent( AliHLTComponentHandle handle, const AliHLTComponent_EventData* evtData, const AliHLTComponent_BlockData* blocks, - AliHLTComponent_TriggerData* trigData, AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt, - AliHLTComponent_BlockData** outputBlocks, - AliHLTComponent_EventDoneData** edd ) -{ - if ( !handle ) - return ENXIO; - AliHLTComponent* comp = reinterpret_cast( handle ); - return comp->ProcessEvent( *evtData, blocks, *trigData, outputPtr, *size, *outputBlockCnt, *outputBlocks, *edd ); -} - -int AliHLT_C_GetOutputDataType( AliHLTComponentHandle handle, AliHLTComponent_DataType* dataType ) -{ - if ( !handle ) - return ENXIO; - AliHLTComponent* comp = reinterpret_cast( handle ); - *dataType = comp->GetOutputDataType(); - return 0; -} - -int AliHLT_C_GetOutputSize( AliHLTComponentHandle handle, unsigned long* constBase, double* inputMultiplier ) -{ - if ( !handle ) - return ENXIO; - AliHLTComponent* comp = reinterpret_cast( handle ); - comp->GetOutputDataSize( *constBase, *inputMultiplier ); - return 0; -} diff --git a/HLT/BASE/interface/AliHLTExternalInterface.h b/HLT/BASE/interface/AliHLTExternalInterface.h deleted file mode 100644 index 2cecbf4a1b4..00000000000 --- a/HLT/BASE/interface/AliHLTExternalInterface.h +++ /dev/null @@ -1,153 +0,0 @@ -// @(#) $Id$ - -#ifndef ALIHLT_EXTERNALINTERFACE_H -#define ALIHLT_EXTERNALINTERFACE_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/** @file AliHLTExternalInterface.h - @author Matthias Richter, Timm Steinbeck - @date - @brief Pure and dynamic C interface to the AliRoot HLT component handler - @note Utilized by the HLT Online (PubSub) framework -*/ - -#include -/* Matthias Dec 2006 - * The names have been changed for Aliroot's coding conventions sake - * The old names are defined for backward compatibility with the - * PublisherSubscriber framework - */ -typedef AliHLTComponentLogSeverity AliHLTComponent_LogSeverity; -typedef AliHLTComponentEventData AliHLTComponent_EventData; -typedef AliHLTComponentShmData AliHLTComponent_ShmData; -typedef AliHLTComponentDataType AliHLTComponent_DataType; -typedef AliHLTComponentBlockData AliHLTComponent_BlockData; -typedef AliHLTComponentTriggerData AliHLTComponent_TriggerData; -typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData; -const AliHLTUInt32_t gkAliHLTComponent_InvalidShmType = gkAliHLTComponentInvalidShmType; -const AliHLTUInt64_t gkAliHLTComponent_InvalidShmID = gkAliHLTComponentInvalidShmID; - -typedef int (*AliHLTExtFctInitSystem)( AliHLTComponentEnvironment* ); - -typedef int (*AliHLTExtFctDeinitSystem)(); - -typedef int (*AliHLTExtFctLoadLibrary)( const char* ); - -typedef int (*AliHLTExtFctUnloadLibrary)( const char* ); - -typedef int (*AliHLTExtFctCreateComponent)( const char*, void*, int, const char**, AliHLTComponentHandle* ); - -typedef void (*AliHLTExtFctDestroyComponent)( AliHLTComponentHandle ); - -typedef int (*AliHLTExtFctProcessEvent)( AliHLTComponentHandle, const AliHLTComponentEventData*, const AliHLTComponentBlockData*, - AliHLTComponentTriggerData*, AliHLTUInt8_t*, - AliHLTUInt32_t*, AliHLTUInt32_t*, - AliHLTComponentBlockData**, - AliHLTComponentEventDoneData** ); - -typedef int (*AliHLTExtFctGetOutputDataType)( AliHLTComponentHandle, AliHLTComponentDataType* ); - -typedef int (*AliHLTExtFctGetOutputSize)( AliHLTComponentHandle, unsigned long*, double* ); - -struct AliHLTExternalFuctions_t { - AliHLTExtFctInitSystem fctInitSystem; - AliHLTExtFctDeinitSystem fctDeinitSystem; - AliHLTExtFctLoadLibrary fctLoadLibrary; - AliHLTExtFctUnloadLibrary fctUnloadLibrary; - AliHLTExtFctCreateComponent fctCreateComponent; - AliHLTExtFctDestroyComponent fctDestroyComponent; - AliHLTExtFctProcessEvent fctProcessEvent; - AliHLTExtFctGetOutputDataType fctGetOutputDataType; - AliHLTExtFctGetOutputSize fctGetOutputSize; -}; - -#define ALIHLT_FCT_ENTRY_INITSYSTEM "AliHLT_C_Component_InitSystem" -#define ALIHLT_FCT_ENTRY_DEINITSYSTEM "AliHLT_C_Component_DeinitSystem" -#define ALIHLT_FCT_ENTRY_LOADLIBRARY "AliHLT_C_Component_LoadLibrary" -#define ALIHLT_FCT_ENTRY_UNLOADLIBRARY "AliHLT_C_Component_UnloadLibrary" -#define ALIHLT_FCT_ENTRY_CREATECOMPONENT "AliHLT_C_Component_CreateComponent" -#define ALIHLT_FCT_ENTRY_DESTROYCOMPONENT "AliHLT_C_Component_DestroyComponent" -#define ALIHLT_FCT_ENTRY_PROCESSEVENT "AliHLT_C_Component_ProcessEvent" -#define ALIHLT_FCT_ENTRY_GETOUTPUTDATATYPE "AliHLT_C_Component_GetOutputDataType" -#define ALIHLT_FCT_ENTRY_GETOUTPUTSIZE "AliHLT_C_Component_GetOutputSize" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * - * @ingroup alihlt_wrapper_interface - */ -typedef void* AliHLTComponentHandle; - -/** - * - * @ingroup alihlt_wrapper_interface - */ -const AliHLTComponentHandle kEmptyHLTComponentHandle = 0; - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ ); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_Component_DeinitSystem(); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_Component_LoadLibrary( const char* libraryPath ); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_Component_UnloadLibrary( const char* libraryPath ); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponentHandle* handle ); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -void AliHLT_C_DestroyComponent( AliHLTComponentHandle ); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_ProcessEvent( AliHLTComponentHandle handle, const AliHLTComponent_EventData* evtData, const AliHLTComponent_BlockData* blocks, - AliHLTComponent_TriggerData* trigData, AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt, - AliHLTComponent_BlockData** outputBlocks, - AliHLTComponent_EventDoneData** edd ); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_GetOutputDataType( AliHLTComponentHandle, AliHLTComponent_DataType* dataType ); - -/** - * - * @ingroup alihlt_wrapper_interface - */ -int AliHLT_C_GetOutputSize( AliHLTComponentHandle, unsigned long* constBase, double* inputMultiplier ); - -#ifdef __cplusplus -} -#endif - -#endif //ALIHLT_EXTERNALINTERFACE_H diff --git a/HLT/BASE/interface/Makefile.am b/HLT/BASE/interface/Makefile.am deleted file mode 100644 index d2c60560086..00000000000 --- a/HLT/BASE/interface/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -# $Id$ -# Makefile template for the Alice HLT external interface - -# be aware of the two different meanings of 'MODULE' -# 1. AliRoot classifies each detector and main sub-package as a module -# so for all HLT library packages MODULE is equal HLT -# 2. The HLT stand-alone build system knows about sub-modules -# e.g. for libHLTinterface, MODULE=HLTinterface -MODULE = HLTinterface - -SUBDIRS = - -AM_CPPFLAGS = -DMODULE=$(MODULE) \ - -I$(top_srcdir)/BASE - -# library definition -lib_LTLIBRARIES = libHLTinterface.la - -# version info for the library -LIBRARY_VERSION = '0:0:0' - -# MODDIR is set by the AliRoot build system and denotes the topdir -# of the module, we must set it since the package definition libHLTinterface.pkg -# includes another common configuration file -MODDIR = $(top_srcdir) -PKGDEF = $(MODDIR)/libHLTinterface.pkg -include $(top_srcdir)/libHLTinterface.pkg - -# library sources -libHLTinterface_la_SOURCES = $(MODULE_SRCS) - -# library headers -pkginclude_HEADERS = $(MODULE_HDRS) - -# linker flags -libHLTinterface_la_LDFLAGS = -version-info $(LIBRARY_VERSION) - -# automatic generation of data and time of library build -COMPILE_INFO = HLTinterfaceCompileInfo.cxx - -# set the file name for the generated root dictionary -DICTCPP = HLTinterface-DICT.cxx -nodist_libHLTinterface_la_SOURCES = $(COMPILE_INFO) \ - $(DICTCPP) - -CLEANFILES = $(COMPILE_INFO) - -include $(top_srcdir)/make.dict - -$(COMPILE_INFO): Makefile.am - @echo '//automatically generated compilation info' > $@ - @echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@ - @echo '//add changes in Makefile.am' >> $@ - @echo 'void $(MODULE)CompileInfo( char*& date, char*& time)' >> $@ - @echo '{date=__DATE__; time=__TIME__; return;}' >> $@ diff --git a/HLT/BASE/util/AliHLTFileWriter.cxx b/HLT/BASE/util/AliHLTFileWriter.cxx index 24dfaa9c87a..e0cfd10b9b4 100644 --- a/HLT/BASE/util/AliHLTFileWriter.cxx +++ b/HLT/BASE/util/AliHLTFileWriter.cxx @@ -27,8 +27,8 @@ using namespace std; #include "AliHLTFileWriter.h" #include #include -//#include -//#include +#include +#include /** the global object for component registration */ AliHLTFileWriter gAliHLTFileWriter; @@ -171,12 +171,6 @@ int AliHLTFileWriter::DoInit( int argc, const char** argv ) int AliHLTFileWriter::InitWriter() { // see header file for class documentation - - // fCurrentFileName is used in dump event, just touched her to avoid - // coding convention violation RC11. The function can not be declared - // const since it is just the default implementation, overloaded - // virtual function might not be const - fCurrentFileName=""; return 0; // note: this doesn't mean 'error' } @@ -188,11 +182,6 @@ int AliHLTFileWriter::ScanArgument(int argc, const char** argv) if (argc==0 && argv==NULL) { // this is just to get rid of the warning "unused parameter" } - // fCurrentFileName is used in dump event, just touched her to avoid - // coding convention violation RC11. The function can not be declared - // const since it is just the default implementation, overloaded - // virtual function might not be const - fCurrentFileName=""; return -EINVAL; } @@ -207,12 +196,6 @@ int AliHLTFileWriter::DoDeinit() int AliHLTFileWriter::CloseWriter() { // see header file for class documentation - - // fCurrentFileName is used in dump event, just touched her to avoid - // coding convention violation RC11. The function can not be declared - // const since it is just the default implementation, overloaded - // virtual function might not be const - fCurrentFileName=""; return 0; // note: this doesn't mean 'error' } @@ -312,7 +295,7 @@ int AliHLTFileWriter::ClearMode(Short_t mode) return fMode; } -int AliHLTFileWriter::CheckMode(Short_t mode) const +int AliHLTFileWriter::CheckMode(Short_t mode) { // see header file for class documentation diff --git a/HLT/BASE/util/AliHLTFileWriter.h b/HLT/BASE/util/AliHLTFileWriter.h index b116baa8b57..bd994c75aba 100644 --- a/HLT/BASE/util/AliHLTFileWriter.h +++ b/HLT/BASE/util/AliHLTFileWriter.h @@ -12,8 +12,7 @@ */ #include "AliHLTDataSink.h" -#include -//#include +#include /** * @class AliHLTFileWriter @@ -149,7 +148,7 @@ class AliHLTFileWriter : public AliHLTDataSink { * Check a mode flag. * @return 1 if flag is set, 0 if not */ - int CheckMode(Short_t mode) const; + int CheckMode(Short_t mode); /** * Working modes of the writer diff --git a/HLT/BASE/util/AliHLTRootFilePublisherComponent.cxx b/HLT/BASE/util/AliHLTRootFilePublisherComponent.cxx index 6c05eab4f17..612373647c1 100644 --- a/HLT/BASE/util/AliHLTRootFilePublisherComponent.cxx +++ b/HLT/BASE/util/AliHLTRootFilePublisherComponent.cxx @@ -128,12 +128,10 @@ int AliHLTRootFilePublisherComponent::GetEvent( const AliHLTComponentEventData& TH1F *hpx = new TH1F("hpx","px distribution",100,-4,4); hpx->FillRandom("gaus",1000); PushBack(hpx, "TH1F", "ROOT"); - delete hpx; } else { TH1F *hpy = new TH1F("hpy","py distribution",100,-10,10); hpy->FillRandom("gaus",10000); PushBack(hpy, "TH1F", "ROOT"); - delete hpy; } return iResult; diff --git a/HLT/BASE/util/AliHLTRootFileWriterComponent.h b/HLT/BASE/util/AliHLTRootFileWriterComponent.h index e02ea1948c3..9f9a0ff821e 100644 --- a/HLT/BASE/util/AliHLTRootFileWriterComponent.h +++ b/HLT/BASE/util/AliHLTRootFileWriterComponent.h @@ -13,7 +13,7 @@ */ #include "AliHLTFileWriter.h" -//#include "TObject.h" +#include "TObject.h" class TFile; @@ -34,7 +34,7 @@ class AliHLTRootFileWriterComponent : public AliHLTFileWriter /** not a valid assignment op, but defined according to effective C++ style */ AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&); /** destructor */ - virtual ~AliHLTRootFileWriterComponent(); + ~AliHLTRootFileWriterComponent(); /** * The id of the component. diff --git a/HLT/ChangeLog b/HLT/ChangeLog index 77a561299e6..906adb9028b 100644 --- a/HLT/ChangeLog +++ b/HLT/ChangeLog @@ -1,25 +1,8 @@ -2007-05-09 version HLT-v0-6 tagged - Highlights - BASE libHLTbase version 3.1.0 - - High level component interface implemeted - - framework for AliRoot reconstruction added - - HLT logging converted to AliLog, AliLog trap added in order to - be able to redirect messages written to AliLog - - module agents for HLT libraries imlemented - - all utility components now moved from HLTbase to AliHLTUtil - TPC libAliHLTTPC version 3.1.1 - - DigitReaderPacked revived - - merger added to slice tracker - - improvements on the ESD conversion - TRD - - first version of components using offline reconstruction added - PHOS - - 2007-04-27 HLT base - memory leaks corrected - AliLog support moved to libAliHLTUtil in order to keep - libHLTbase free of AliRoot dependencies - - dynamic loading of AliLog support + - dynamic loeding of AliLog support - AliHLTFileWriter moved to libAliHLTUtil - workaround for ROOT bug: in order to avoid crashes when unloading dynamic libraries via gSystem, the libraries are not unloaded diff --git a/HLT/Makefile.am b/HLT/Makefile.am index e016667c5ac..da4c5af9427 100644 --- a/HLT/Makefile.am +++ b/HLT/Makefile.am @@ -26,7 +26,6 @@ SUBDIRS = BASE \ doc EXTRA_DIST = libHLTbase.pkg \ - libHLTinterface.pkg \ libAliHLTUtil.pkg \ libAliHLTSample.pkg \ libAliHLTPHOS.pkg \ diff --git a/HLT/PHOS/AliHLTPHOSClusterDataStruct.h b/HLT/PHOS/AliHLTPHOSClusterDataStruct.h deleted file mode 100644 index 8e647c4f55f..00000000000 --- a/HLT/PHOS/AliHLTPHOSClusterDataStruct.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef ALIHLTPHOSCLUSTERDATASTRUCT -#define ALIHLTPHOSCLUSTERDATASTRUCT - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Øystein Djuvsland * - * * - * 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" -#include "AliHLTPHOSCommonDefs.h" -#include "AliHLTDataTypes.h" - -struct AliHLTPHOSClusterDataStruct -{ - Float_t fClusterEnergy; - Float_t fLocalPositionPtr[2]; - AliHLTUInt8_t fPHOSModule; -}; - -#endif diff --git a/HLT/PHOS/AliHLTPHOSClusterizer.cxx b/HLT/PHOS/AliHLTPHOSClusterizer.cxx deleted file mode 100644 index 4281f3161de..00000000000 --- a/HLT/PHOS/AliHLTPHOSClusterizer.cxx +++ /dev/null @@ -1,304 +0,0 @@ - - - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Øystein Djuvsland * - * * - * 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. * - **************************************************************************/ - - -/** @file AliHLTPHOSClusterizer.cxx - @author Øystein Djuvsland - @date - @brief A temporary clusterizer for PHOS -*/ - - - -#include "AliHLTPHOSPhysicsDefinitions.h" -#include "AliHLTPHOSClusterizer.h" -#include "AliHLTPHOSCommonDefs.h" -#include "TVector3.h" -#include -#include "TMath.h" - - -ClassImp(AliHLTPHOSClusterizer); - -/** -* Main constructor -**/ -AliHLTPHOSClusterizer::AliHLTPHOSClusterizer():fStructArray(NULL), fPHOSModule(-1), fThreshold(0), - fClusterThreshold(0), fHighGainFactor(0.005), fLowGainFactor(0.08), - fArraySize(3), fMultiplicity(fArraySize*fArraySize) -{ - -}//end - -AliHLTPHOSClusterizer::AliHLTPHOSClusterizer(const AliHLTPHOSClusterizer &):fStructArray(NULL), fPHOSModule(-1), fThreshold(0), - fClusterThreshold(0), fHighGainFactor(0.005), fLowGainFactor(0.08), - fArraySize(3), fMultiplicity(fArraySize*fArraySize) -{ - -}//end - -AliHLTPHOSClusterizer:: ~AliHLTPHOSClusterizer() -{ - -} - -/** -* Building a 2D array of cell energies of the PHOS detector -* @param cellData object containing the cell energies from one event -* @param recPointList list to be filled with coordinates of local maxima in the detector -**/ - -Int_t -AliHLTPHOSClusterizer::BuildCellEnergyArray(AliHLTPHOSRcuCellEnergyDataStruct* cellData, - AliHLTPHOSRecPointListDataStruct* recPointList) -{ - - Int_t x = 0; - Int_t z = 0; - Int_t gain = 0; - Int_t xMod = 0; - Int_t zMod = 0; - Int_t index = 0; - Double_t energyCount = 0; - - for(Int_t cell = 0; cell < cellData->fCnt; cell++) - { - - z = (cellData->fValidData[cell]).fZ; - x = (cellData->fValidData[cell]).fX; - gain = (cellData->fValidData[cell]).fGain; - - zMod = z + (cellData->fRcuZ)*N_ROWS_RCU; - xMod = x + (cellData->fRcuX)*N_COLUMNS_RCU; - - energyCount = (cellData->fValidData[cell]).fEnergy; - - if(gain == 0 && energyCount < 1023) - { - fEnergyArray[xMod][zMod] = fHighGainFactor * energyCount; - - if(fEnergyArray[xMod][zMod] > fClusterThreshold) - { - recPointList[index].fZ = zMod; - recPointList[index].fX = xMod; - - for(Int_t j = 0; j < index; j++) - { - if(recPointList[j].fZ == zMod && recPointList[j].fX == xMod) - recPointList[j].fZ = -1; - } - index++; - } - - } - else if(gain == 1 && fEnergyArray[xMod][zMod] == 0) - { - fEnergyArray[xMod][zMod] = fLowGainFactor * energyCount; - if(fEnergyArray[xMod][zMod] > fClusterThreshold) - { - recPointList[index].fZ = zMod; - recPointList[index].fX = xMod; - recPointList[index].fModule = cellData->fModuleID; - index++; - } - } - - } - - fPHOSModule = cellData->fModuleID; - - return index; -}//end BuildCellEnergyArray - - - -/** -* Creating an array of rec points -* @param recPointStructArrayPtr array to store the rec points -* @param list list of rec points -* @param nPoints number of points -**/ -Int_t -AliHLTPHOSClusterizer::CreateRecPointStructArray(AliHLTPHOSRecPointDataStruct* recPointStructArrayPtr, - AliHLTPHOSRecPointListDataStruct* list, - Int_t nPoints) - -{ - Int_t flag = 0; - Int_t edgeFlagRows = 0; - Int_t edgeFlagCols = 0; - Int_t k = 0; - Int_t nRecPoints = 0; - Int_t z = 0; - Int_t x = 0; - - Float_t* energiesList = NULL; - - for(Int_t point = 0; point < nPoints; point++) - { - z = list[point].fZ; - x = list[point].fX; - if(z == -1) continue; - - if((z-fArraySize/2) < 0/*= - N_ROWS_MOD/2*/ || (z+fArraySize/2) >= N_ROWS_MOD/*/2*/) - { - edgeFlagRows = 1; - continue; - } - if((x-fArraySize/2) < 0/*= - N_COLUMNS_MOD/2*/ || (x+fArraySize/2) >= N_COLUMNS_MOD) - { - edgeFlagCols = 1; - continue; - } - - - if(!flag) energiesList = new Float_t[fMultiplicity]; - flag = 0; - k = 0; - - for(Int_t i = -fArraySize/2; i <= fArraySize/2; i++) - { - if(flag) break; - for(Int_t j = -fArraySize/2; j <= fArraySize/2; j++) - { - - if(fEnergyArray[x+i][z+j] > fEnergyArray[x][z] && abs(i) < 2 && abs(j) < 2) - { - flag = 1; - break; - } - energiesList[k] = fEnergyArray[x+i][z+j]; - k++; - } - } - - - if(!flag && k) - { - recPointStructArrayPtr[nRecPoints].fEnergiesListPtr = energiesList; - recPointStructArrayPtr[nRecPoints].fCoordinatesPtr[0] = x; - recPointStructArrayPtr[nRecPoints].fCoordinatesPtr[1] = z; - recPointStructArrayPtr[nRecPoints].fX = x; - recPointStructArrayPtr[nRecPoints].fZ = z; - recPointStructArrayPtr[nRecPoints].fMultiplicity = fMultiplicity; - recPointStructArrayPtr[nRecPoints].fPHOSModule = list[point].fModule; - nRecPoints++; - } - } - - - - energiesList = NULL; - - return nRecPoints; - -}//end CreateRecPointStructArray - - -/** -* Calculating the center of gravity of a rec point -* Not working well at this point! -* @param recPointPtr pointer to the rec point -**/ -Int_t -AliHLTPHOSClusterizer::CalculateCenterOfGravity(AliHLTPHOSRecPointDataStruct* recPointPtr) -{ - Float_t xt = 0; - Float_t zt = 0; - Float_t xi = 0; - Float_t zj = 0; - Float_t w = 0; - Float_t w0 = 4.5; - Float_t wtot = 0; - - Int_t x = recPointPtr->fCoordinatesPtr[0]; - Int_t z = recPointPtr->fCoordinatesPtr[1]; - - for(Int_t i = -fArraySize/2; i <= fArraySize/2; i++) - { - for(Int_t j = -fArraySize/2; j <= fArraySize/2; j++) - { - xi = x + i; - zj = z + j; - w = TMath::Max( (Float_t)0., (Float_t)(w0 + log( fEnergyArray[x+i][z+j] / fEnergyArray[x][z]) ) ) ; - xt += xi * w ; - zt += zj * w ; - wtot += w ; - - } - } - xt /= wtot ; - zt /= wtot ; - - recPointPtr->fX = xt; - recPointPtr->fZ = zt; - - return 0; - -}//end CalculateCenterOfGravity - - - -/** -* Create a simpler data struct for a rec point, containing -* only coordinates, energy and timing -* @param recPointPtr pointer to the rec point -* @clusterStructPtr pointer to the cluster struct -**/ -Int_t -AliHLTPHOSClusterizer::ClusterizeStruct(AliHLTPHOSRecPointDataStruct* recPointPtr, AliHLTPHOSClusterDataStruct* clusterStructPtr) -{ - - Float_t clusterEnergy = 0; - Float_t* energiesListPtr = recPointPtr->fEnergiesListPtr; - - for(Int_t i = 0; i < recPointPtr->fMultiplicity; i++) - { - clusterEnergy += energiesListPtr[i]; - } - - clusterStructPtr->fLocalPositionPtr[0] = recPointPtr->fX; - clusterStructPtr->fLocalPositionPtr[1] = recPointPtr->fZ; - clusterStructPtr->fClusterEnergy = clusterEnergy; - clusterStructPtr->fPHOSModule = recPointPtr->fPHOSModule; - - return 0; - -}//end ClusterizeStruct - - - - -/** -* Resets the cell energy array -**/ -Int_t -AliHLTPHOSClusterizer::ResetCellEnergyArray() - -{ - for(Int_t x = 0; x < N_ROWS_MOD; x++) - { - for(Int_t z = 0; z < N_COLUMNS_MOD; z++) - { - fEnergyArray[x][z] = 0; - } - } - - return 0; - -}//end ResetCellEnergyArray - diff --git a/HLT/PHOS/AliHLTPHOSClusterizer.h b/HLT/PHOS/AliHLTPHOSClusterizer.h deleted file mode 100644 index 0a7e40540d0..00000000000 --- a/HLT/PHOS/AliHLTPHOSClusterizer.h +++ /dev/null @@ -1,69 +0,0 @@ - - -#ifndef ALIHLTPHOSCLUSTERIZER -#define ALIHLTPHOSCLUSTERIZER - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/** @file AliHLTPHOSClusterizer.h - @author Øystein Djuvsland - @date - @brief A temporary clusterizer for PHOS -*/ - - -#include "AliHLTPHOSCommonDefs.h" -#include "AliHLTPHOSRcuCellEnergyDataStruct.h" -#include "AliHLTPHOSClusterDataStruct.h" -#include "AliHLTPHOSRecPointDataStruct.h" -#include "AliHLTPHOSValidCellDataStruct.h" -#include "AliHLTPHOSRecPointListDataStruct.h" - -class AliHLTPHOSClusterizer -{ - - public: - - AliHLTPHOSClusterizer(); - virtual ~AliHLTPHOSClusterizer(); - AliHLTPHOSClusterizer(const AliHLTPHOSClusterizer &); - AliHLTPHOSClusterizer & operator = (const AliHLTPHOSClusterizer &) {return *this;} - - void SetThreshold(Float_t threshold) {fThreshold = threshold;} - void SetClusterThreshold(Float_t clusterThreshold) {fClusterThreshold = clusterThreshold;} - - void SetHighGainFactor(Float_t highGain) {fHighGainFactor = highGain;} - void SetLowGainFactor(Float_t lowGain) {fLowGainFactor = lowGain;} - void SetArraySize(Int_t size) - { - fArraySize = size; - fMultiplicity = fArraySize * fArraySize; - } - - Float_t GetHighGainFactor() {return fHighGainFactor;} - Float_t GetLowGainFactor() {return fLowGainFactor;} - - Int_t BuildCellEnergyArray(AliHLTPHOSRcuCellEnergyDataStruct *structPtr, AliHLTPHOSRecPointListDataStruct* recPointList); - Int_t CreateRecPointStructArray(AliHLTPHOSRecPointDataStruct* rectStructsPtr, AliHLTPHOSRecPointListDataStruct* list, Int_t nPoints); - Int_t CalculateCenterOfGravity(AliHLTPHOSRecPointDataStruct* recPointPtr); - Int_t ClusterizeStruct(AliHLTPHOSRecPointDataStruct* recArrayPtr, AliHLTPHOSClusterDataStruct* clusterArrayPtr); - Int_t ResetCellEnergyArray(); - - - private: - - AliHLTPHOSRcuCellEnergyDataStruct* fStructArray; /** -#include "stdio.h" -#include - - -const AliHLTComponentDataType AliHLTPHOSClusterizerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; -int AliHLTPHOSClusterizerComponent::fEventCount = 0; - -AliHLTPHOSClusterizerComponent gAliHLTPHOSClusterizerComponent; - -AliHLTPHOSClusterizerComponent::AliHLTPHOSClusterizerComponent():AliHLTProcessor(), fClusterizerPtr(0), fOutPtr(0), - fRecPointStructArrayPtr(0), fRecPointListPtr(0) -{ - -} - -AliHLTPHOSClusterizerComponent::~AliHLTPHOSClusterizerComponent() -{ -} - -AliHLTPHOSClusterizerComponent::AliHLTPHOSClusterizerComponent(const AliHLTPHOSClusterizerComponent &):AliHLTProcessor(), - fClusterizerPtr(0), - fOutPtr(0), - fRecPointStructArrayPtr(0), - fRecPointListPtr(0) -{ - -} - -Int_t -AliHLTPHOSClusterizerComponent::Deinit() -{ - return 0; -} - -Int_t -AliHLTPHOSClusterizerComponent::DoDeinit() -{ - Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSClusterizerComponent DoDeinit"); - - return 0; -} - - -const Char_t* -AliHLTPHOSClusterizerComponent::GetComponentID() -{ - return "AliHltPhosClusterizer"; -} - -void -AliHLTPHOSClusterizerComponent::GetInputDataTypes( vector& list) -{ - const AliHLTComponentDataType* pType=inputDataTypes; - while (pType->fID!=0) { - list.push_back(*pType); - pType++; - } -} - -AliHLTComponentDataType -AliHLTPHOSClusterizerComponent::GetOutputDataType() -{ - return AliHLTPHOSPhysicsDefinitions::fgkAliHLTClusterDataType; -} - -void -AliHLTPHOSClusterizerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) - -{ - constBase = 30; - inputMultiplier = 1; -} - -Int_t -AliHLTPHOSClusterizerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, - AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, - std::vector& outputBlocks) -{ - - UInt_t tSize = 0; - UInt_t offset = 0; - UInt_t mysize = 0; - Int_t nRecPoints = 0; - Int_t index = 0; - - AliHLTUInt8_t* outBPtr; - outBPtr = outputPtr; - const AliHLTComponentBlockData* iter = 0; - unsigned long ndx; - - for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) - { - iter = blocks+ndx; - - if(iter->fDataType != AliHLTPHOSDefinitions::fgkCellEnergyDataType) - { - cout << "Warning: data type is not fgkCellEnergyDataType " << endl; - continue; - } - index = fClusterizerPtr->BuildCellEnergyArray( reinterpret_cast(iter->fPtr), - fRecPointListPtr); - - } - - nRecPoints = fClusterizerPtr->CreateRecPointStructArray(fRecPointStructArrayPtr, fRecPointListPtr, index); - - for(Int_t i = 0; i < nRecPoints; i++) - { - mysize = 0; - offset = tSize; - - fOutPtr = (AliHLTPHOSClusterDataStruct*)outBPtr; - fClusterizerPtr->CalculateCenterOfGravity(&fRecPointStructArrayPtr[i]); - fClusterizerPtr->ClusterizeStruct(&fRecPointStructArrayPtr[i], fOutPtr); - - mysize += sizeof(AliHLTPHOSClusterDataStruct); - - AliHLTComponentBlockData bd; - FillBlockData( bd ); - bd.fOffset = offset; - bd.fSize = mysize; - bd.fDataType = AliHLTPHOSPhysicsDefinitions::fgkAliHLTClusterDataType; - bd.fSpecification = 0xFFFFFFFF; - outputBlocks.push_back( bd ); - - tSize += mysize; - outBPtr += mysize; - - if( tSize > size ) - { - Logging( kHLTLogFatal, "HLT::AliHLTPHOSClusterizerComponent::DoEvent", "Too much data", - "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." - , tSize, size ); - return EMSGSIZE; - } - } - - fEventCount++; - if(fEventCount%100==0) cout << "Analyzing event: " << fEventCount << endl; - size = tSize; - fClusterizerPtr->ResetCellEnergyArray(); - - return 0; - -} - -Int_t -AliHLTPHOSClusterizerComponent::DoInit(Int_t argc, const Char_t** argv ) -{ - - fClusterizerPtr = new AliHLTPHOSClusterizer(); - fClusterizerPtr->SetThreshold(atof(argv[0])); - fClusterizerPtr->SetClusterThreshold(atof(argv[1])); - fClusterizerPtr->SetHighGainFactor(atof(argv[2])); - fClusterizerPtr->SetLowGainFactor(atof(argv[3])); - fClusterizerPtr->SetArraySize(atoi(argv[4])); - fClusterizerPtr->ResetCellEnergyArray(); - fRecPointListPtr = new AliHLTPHOSRecPointListDataStruct[N_ROWS_MOD*N_COLUMNS_MOD]; - fRecPointStructArrayPtr = new AliHLTPHOSRecPointDataStruct[1000]; - - if (argc==0 && argv==NULL) { - // this is currently just to get rid of the warning "unused parameter" - } - - return 0; -} - -AliHLTComponent* -AliHLTPHOSClusterizerComponent::Spawn() -{ - return new AliHLTPHOSClusterizerComponent(); -} diff --git a/HLT/PHOS/AliHLTPHOSClusterizerComponent.h b/HLT/PHOS/AliHLTPHOSClusterizerComponent.h deleted file mode 100644 index 6736bd35849..00000000000 --- a/HLT/PHOS/AliHLTPHOSClusterizerComponent.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef ALIHLTPHOSCLUSTERIZERCOMPONENT -#define ALIHLTPHOSCLUSTERIZERCOMPONENT - -#include "AliHLTProcessor.h" - -#include "AliHLTPHOSClusterizer.h" -#include "AliHLTPHOSRcuCellEnergyDataStruct.h" -#include "AliHLTPHOSClusterDataStruct.h" -#include "AliHLTPHOSRecPointDataStruct.h" -#include "Rtypes.h" - - -class AliHLTPHOSClusterizerComponent: public AliHLTProcessor -{ - public: - - AliHLTPHOSClusterizerComponent(); - ~AliHLTPHOSClusterizerComponent(); - AliHLTPHOSClusterizerComponent(const AliHLTPHOSClusterizerComponent &); - AliHLTPHOSClusterizerComponent & operator = (const AliHLTPHOSClusterizerComponent &) - { - return *this; - } - const char* GetComponentID(); - void GetInputDataTypes(std::vector >&); - - AliHLTComponentDataType GetOutputDataType(); - - void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); - - Int_t DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*, - AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, - std::vector&); - - AliHLTComponent* Spawn(); - - protected: - - Int_t DoInit(int argc, const char** argv); - Int_t Deinit(); - Int_t DoDeinit(); - - private: - AliHLTPHOSClusterizer* fClusterizerPtr; - AliHLTPHOSClusterDataStruct* fOutPtr; - AliHLTPHOSRecPointDataStruct* fRecPointStructArrayPtr; - AliHLTPHOSRecPointListDataStruct* fRecPointListPtr; - static const AliHLTComponentDataType inputDataTypes[]; - static int fEventCount; - -}; - -#endif diff --git a/HLT/PHOS/AliHLTPHOSCommonDefs.h b/HLT/PHOS/AliHLTPHOSCommonDefs.h index f2f794292d7..89361dafb5c 100644 --- a/HLT/PHOS/AliHLTPHOSCommonDefs.h +++ b/HLT/PHOS/AliHLTPHOSCommonDefs.h @@ -41,13 +41,6 @@ #define DEFAULT_TAU 2 /** +#include "stdio.h" #include "AliRawReaderMemory.h" #include "AliCaloRawStream.h" +#include #include "AliHLTPHOSRcuChannelDataStruct.h" -#include "AliHLTPHOSPulseGenerator.h" -#include "AliHLTPHOSDataCorruptor.h" - - -using namespace std; + AliHLTPHOSDDLDecoderComponent gAliHLTPHOSDDLDecoderComponent; -AliHLTPHOSDDLDecoderComponent gAliHLTPHOSDDLDecoderComponent; +const AliHLTComponentDataType AliHLTPHOSDDLDecoderComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array +int AliHLTPHOSDDLDecoderComponent::fgEventCount = 0; -AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent():AliHLTPHOSProcessor(), fPHOSRawStream(0), fRawMemoryReader(0), -fOutPtr(0), fDataCorruptorPtr(0) +/** + * @class AliHLTPHOSDDLDecoderComponent + */ +AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent():AliHLTProcessor(), fEquippmentID(0), fRcuX(0), +fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0), fModuleID(0), fSendChannelData(kFALSE), fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0) { - //Default constructor - fDataCorruptorPtr = new AliHLTPHOSDataCorruptor(); + } AliHLTPHOSDDLDecoderComponent::~AliHLTPHOSDDLDecoderComponent() { - //Destructor - delete fRawMemoryReader; - delete fPHOSRawStream; - delete fDataCorruptorPtr; + if(fRawMemoryReader != 0) + { + delete fRawMemoryReader; + } + if(fPHOSRawStream != 0) + { + delete fPHOSRawStream; + } } -AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent(const AliHLTPHOSDDLDecoderComponent & ) : AliHLTPHOSProcessor(), -fPHOSRawStream(0),fRawMemoryReader(0), fOutPtr(0), fDataCorruptorPtr(0) +AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent(const AliHLTPHOSDDLDecoderComponent & ) : AliHLTProcessor(), +fEquippmentID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0), fModuleID(0), fSendChannelData(kFALSE), fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0) { - } +/* + *Deinit function called by the HLT framwork at end of run + *@return 0 if the denitialzation was sucessfull. + */ int AliHLTPHOSDDLDecoderComponent::Deinit() { - //Se html documentation of base class cout << "Deinit" << endl; + return 0; +} + + +/* + *Deinit function called by the HLT framwork at end of run + *@return 0 if the denitialzation was sucessfull. + */ +int +AliHLTPHOSDDLDecoderComponent::DoDeinit() +{ + cout << "DoDeinit" << endl; Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit"); if(fRawMemoryReader !=0) @@ -73,23 +91,22 @@ AliHLTPHOSDDLDecoderComponent::Deinit() } return 0; - return 0; } - +/* + *Function called by the HLT framework during initialization + *@return the ID of the component + */ const char* AliHLTPHOSDDLDecoderComponent::GetComponentID() { - //Se html documentation of base class return "PhosDDLDecoder"; } - void -AliHLTPHOSDDLDecoderComponent::GetInputDataTypes(vector& list) +AliHLTPHOSDDLDecoderComponent::GetInputDataTypes( vector& list) { - //Se html documentation of base class const AliHLTComponentDataType* pType=fgkInputDataTypes; while (pType->fID!=0) { list.push_back(*pType); @@ -100,45 +117,36 @@ AliHLTPHOSDDLDecoderComponent::GetInputDataTypes(vector AliHLTComponentDataType AliHLTPHOSDDLDecoderComponent::GetOutputDataType() { - //See html documentation of base class - return AliHLTPHOSDefinitions::fgkCellEnergyDataType; + return AliHLTPHOSDefinitions::gkCellEnergyDataType; } void AliHLTPHOSDDLDecoderComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) { - //Se html documentation of base class constBase = 30; inputMultiplier = 1; } -int -AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, +int AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector& outputBlocks ) { - //See html documentation of base class - double testPulse[70]; - fDataCorruptorPtr->MakeCorruptedDataTest(testPulse,70); - - // AliHLTUInt8_t tmpMod = 0; - // AliHLTUInt8_t tmpZ = 0; - // AliHLTUInt8_t tmpX = 0; - // AliHLTUInt8_t tmpGain = 0; + AliHLTUInt8_t tmpMod = 0; + AliHLTUInt8_t tmpZ = 0; + AliHLTUInt8_t tmpX = 0; + AliHLTUInt8_t tmpGain = 0; Int_t sampleCnt = 0; Int_t processedChannels = 0; UInt_t offset = 0; UInt_t mysize = 0; UInt_t tSize = 0; - Int_t tmpChannelCnt = 0; - // Int_t tmpStartIndex = 0; - + Int_t tmpStartIndex = 0; AliHLTUInt8_t* outBPtr; - //unsigned long first; - // unsigned long last; + unsigned long first; + unsigned long last; outBPtr = outputPtr; const AliHLTComponentBlockData* iter = NULL; unsigned long ndx; @@ -150,7 +158,7 @@ AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, tmpChannelCnt = 0; offset = tSize; - if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType ) + if ( iter->fDataType != AliHLTPHOSDefinitions::gkDDLPackedRawDataType ) { continue; } @@ -181,13 +189,13 @@ AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, } fOutPtr->fNValidChannels = tmpChannelCnt-1;; - + int tmpSampleCnt=0; AliHLTComponentBlockData bd; FillBlockData( bd ); bd.fOffset = offset; bd.fSize = mysize; - bd.fDataType = AliHLTPHOSDefinitions::fgkCellChannelDataDataType; + bd.fDataType = AliHLTPHOSDefinitions::gkCellChannelDataDataType; bd.fSpecification = 0xeFFFFFFF; outputBlocks.push_back( bd); tSize += mysize; @@ -202,13 +210,13 @@ AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, return EMSGSIZE; } - fPhosEventCount++; + fgEventCount++; if(fPrintInfo == kTRUE) { - if(fPhosEventCount%fPrintInfoFrequncy == 0) + if(fgEventCount%fPrintInfoFrequncy == 0) { - cout <<"Analyzing event " << fPhosEventCount << "for Equippment " << fkEquippmentID << endl; + cout <<"Analyzing event " << fgEventCount << "for Equippment " << fEquippmentID << endl; } } size = tSize; @@ -219,29 +227,154 @@ AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, int AliHLTPHOSDDLDecoderComponent::DoInit( int argc, const char** argv ) { - //See html documentation of base class + fSendChannelData = kFALSE; fPrintInfo = kFALSE; fRawMemoryReader = new AliRawReaderMemory(); fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS"); fPHOSRawStream->SetOldRCUFormat(kFALSE); int iResult=0; TString argument=""; - ScanArguments(argc, argv); + Bool_t isSetEquippmentID = kFALSE; - if(fIsSetEquippmentID == kFALSE) + for(int i=0; i=0; i++) + { + argument=argv[i]; + + if (argument.IsNull()) + { + continue; + } + + if (argument.CompareTo("-equipmentID") == 0) + { + cout << "AliHLTPHOSDDLDecoderComponent:DoInit argument = -equipmentID " <SetEquipmentID(fEquippmentID); + SetEquippmentID(fEquippmentID); + SetCoordinates(fEquippmentID); + isSetEquippmentID = kTRUE; + } + else + { + iResult= -1; + Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", + "The argument -equippmentID expects a number"); + return iResult; + } + } + + + if (argument.CompareTo("-datatype") == 0) + { + if(i+1 <= argc) + { + // i++; + argument=argv[i+1]; + if(argument.CompareTo("channeldata") == 0) + { + cout << "AliHLTPHOSDDLDecoderComponent::DoIni setting sendChannelData = kTRUE "<< endl; + fSendChannelData = kTRUE; + } + } + } + + + if (argument.CompareTo("-printinfo") == 0) + { + if(i+1 <= argc) + { + argument=argv[i+1]; + fPrintInfoFrequncy = atoi(argv[i+1]); + fPrintInfo = kTRUE; + cout << "AliHLTPHOSDDLDecoderComponent::DoIni setting printinfo = kTRUE, with update frequency every "<< fPrintInfoFrequncy << "th event" <"); iResult = -2; } - return iResult; + + return 0; +} + + + +void +AliHLTPHOSDDLDecoderComponent::SetEquippmentID(AliHLTUInt16_t id) +{ + fEquippmentID = id; +} + + +AliHLTUInt16_t +AliHLTPHOSDDLDecoderComponent::GetEquippmentID() +{ + return fEquippmentID; +} + + +void +AliHLTPHOSDDLDecoderComponent::SetCoordinates(AliHLTUInt16_t equippmentID) +{ + int rcuIndex = (fEquippmentID - 1792)%N_RCUS_PER_MODULE; + fModuleID = (fEquippmentID -1792 -rcuIndex)/N_RCUS_PER_MODULE; + + if(rcuIndex == 0) + { + fRcuX = 0; + fRcuZ = 0; + } + + if(rcuIndex == 1) + { + fRcuX = 0; + fRcuZ = 1; + } + + if(rcuIndex == 2) + { + fRcuX = 1; + fRcuZ = 0; + } + + if(rcuIndex == 3) + { + fRcuX = 1; + fRcuZ = 1; + } + + + + fRcuZOffset = N_ZROWS_RCU*fRcuZ; + fRcuXOffset = N_XCOLUMNS_RCU*fRcuX; + + cout <<"********InitInfo************"<< endl; + cout <<"AliHLTPHOSDDLDecoderComponent::SetCoordinate"<< endl; + cout <<"Equpippment ID =\t"<< fEquippmentID <& list); + virtual void GetInputDataTypes(std::vector >&); virtual AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); virtual AliHLTComponent* Spawn(); - - virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, - AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, vector& outputBlocks ); + + virtual int DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector >&); private: - AliHLTPHOSDataCorruptor *fDataCorruptorPtr; /** #include "AliHLTDataTypes.h" + using std::string; class AliHLTPHOSDDLPackedFileWriter: public AliHLTPHOSFileWriter { public: AliHLTPHOSDDLPackedFileWriter(); - virtual ~AliHLTPHOSDDLPackedFileWriter(); + ~AliHLTPHOSDDLPackedFileWriter(); + +virtual int WriteFile(const AliHLTComponentEventData& evtData, + const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, int evntCnt); - const virtual int WriteFile(const AliHLTComponentEventData& evtData, - const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, int evntCnt) const; - }; diff --git a/HLT/PHOS/AliHLTPHOSDataCorruptor.cxx b/HLT/PHOS/AliHLTPHOSDataCorruptor.cxx deleted file mode 100644 index 8de7a66bbf0..00000000000 --- a/HLT/PHOS/AliHLTPHOSDataCorruptor.cxx +++ /dev/null @@ -1,112 +0,0 @@ -#include "AliHLTPHOSDataCorruptor.h" -#include "AliHLTPHOSPulseGenerator.h" - -#include "TRandom.h" - -#include - -using namespace std; - - -AliHLTPHOSDataCorruptor::AliHLTPHOSDataCorruptor():fPulseGeneratorPtr(0), fRandomGeneratorPtr(0) -{ - cout << " AliHLTPHOSDataCorruptor::AliHLTPHOSDataCorruptor() creating new datacorruptor" << endl; - fPulseGeneratorPtr = new AliHLTPHOSPulseGenerator(100, 0, 300, 2, 10); - fRandomGeneratorPtr = new TRandom(); -} - - -AliHLTPHOSDataCorruptor::AliHLTPHOSDataCorruptor(const AliHLTPHOSDataCorruptor & ):fPulseGeneratorPtr(0), fRandomGeneratorPtr(0) -{ - -} - - -AliHLTPHOSDataCorruptor::~AliHLTPHOSDataCorruptor() -{ - delete fPulseGeneratorPtr; -} - - -/** - * Takes as input good data from an altro and makes - * bad data from it by flipping bits in individual samples, adding noise - * add a double pulse.. etc - * @param dataArray data that should be corrupted - * @param N the number of samples in the array - */ -void -AliHLTPHOSDataCorruptor::MakeCorruptedData(Double_t *dataArray, int N) -{ - - -} - - -void -AliHLTPHOSDataCorruptor::MakeCorruptedDataTest(Double_t *dataArray, int N) -{ - // double testPulse[300]; - // dataArray[300]; - int* quantisized = new int[N]; - - fPulseGeneratorPtr->SetSampleFreq(10); - fPulseGeneratorPtr->SetAmplitude(100); - fPulseGeneratorPtr->SetTZero(0); - fPulseGeneratorPtr->MakePulse(dataArray, N); - - cout <Integer(10); - - cout << "AliHLTPHOSDataCorruptor::MakeCorruptedDataTest: printing data flipping sample 20, bit " << bit < - -class AliHLTPHOSPulseGenerator; -class TRandom; - -class AliHLTPHOSDataCorruptor -{ - public: - AliHLTPHOSDataCorruptor(); - virtual ~ AliHLTPHOSDataCorruptor(); - AliHLTPHOSDataCorruptor(const AliHLTPHOSDataCorruptor & ); - AliHLTPHOSDataCorruptor & operator = (const AliHLTPHOSDataCorruptor &) - { - return *this; - }; - - AliHLTPHOSPulseGenerator *fPulseGeneratorPtr; - TRandom *fRandomGeneratorPtr; - - void MakeCorruptedData(Double_t *dataArray, int N); - void MakeCorruptedDataTest(Double_t *dataArray, int N); - void FlipBit(int *sample, int n); -}; - - - -#endif diff --git a/HLT/PHOS/AliHLTPHOSDataQualityMonitor.cxx b/HLT/PHOS/AliHLTPHOSDataQualityMonitor.cxx deleted file mode 100644 index fa69d2b6c99..00000000000 --- a/HLT/PHOS/AliHLTPHOSDataQualityMonitor.cxx +++ /dev/null @@ -1,12 +0,0 @@ -#include "AliHLTPHOSDataQualityMonitor.h" - - -AliHLTPHOSDataQualityMonitor::AliHLTPHOSDataQualityMonitor() -{ - -} - -AliHLTPHOSDataQualityMonitor::~AliHLTPHOSDataQualityMonitor() -{ - -} diff --git a/HLT/PHOS/AliHLTPHOSDataQualityMonitor.h b/HLT/PHOS/AliHLTPHOSDataQualityMonitor.h deleted file mode 100644 index 6d52587f8f5..00000000000 --- a/HLT/PHOS/AliHLTPHOSDataQualityMonitor.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef ALIHLTPHOSDQM_H -#define ALIHLTPHOSDQM_H - -class AliHLTPHOSDataQualityMonitor -{ - AliHLTPHOSDataQualityMonitor(); - virtual ~AliHLTPHOSDataQualityMonitor(); - AliHLTPHOSDataQualityMonitor(const AliHLTPHOSDataQualityMonitor & ); - AliHLTPHOSDataQualityMonitor & operator = (const AliHLTPHOSDataQualityMonitor &) - { - return *this; - }; - -}; - -#endif diff --git a/HLT/PHOS/AliHLTPHOSDefinitions.cxx b/HLT/PHOS/AliHLTPHOSDefinitions.cxx index d21c7fafbef..2ceeed65bfc 100644 --- a/HLT/PHOS/AliHLTPHOSDefinitions.cxx +++ b/HLT/PHOS/AliHLTPHOSDefinitions.cxx @@ -1,4 +1,3 @@ - // $Id$ /************************************************************************** @@ -30,13 +29,11 @@ #include "AliHLTPHOSDefinitions.h" - - -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkDDLPackedRawDataType = { sizeof(AliHLTComponentDataType), {'D','D','L','_','R','W','P','K'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkCellEnergyDataType = { sizeof(AliHLTComponentDataType), {'C','E','L','L','E','N','E','R'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkCellEnergyHistogramDataType = { sizeof(AliHLTComponentDataType), {'E','N','E','R','H','I','S','T'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkCellAverageEnergyDataType = { sizeof(AliHLTComponentDataType), {'E','N','E','R','A','V','E','R'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType = { sizeof(AliHLTComponentDataType), {'E','N','E','R','A','C','C','U'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkCellTimingHistogramDataType = { sizeof(AliHLTComponentDataType), {'T','I','M','E','H','I','S','T'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkCellTimingAverageDataType = { sizeof(AliHLTComponentDataType), {'T','I','M','E','A','V','E','R'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSDefinitions::fgkCellChannelDataDataType = { sizeof(AliHLTComponentDataType), {'C','H','A','N','D','A','T','A'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkDDLPackedRawDataType = { sizeof(AliHLTComponentDataType), {'D','D','L','_','R','W','P','K'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkCellEnergyDataType = { sizeof(AliHLTComponentDataType), {'C','E','L','L','E','N','E','R'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkCellEnergyHistogramDataType = { sizeof(AliHLTComponentDataType), {'E','N','E','R','H','I','S','T'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkCellAverageEnergyDataType = { sizeof(AliHLTComponentDataType), {'E','N','E','R','A','V','E','R'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkCellAccumulatedEnergyDataType = { sizeof(AliHLTComponentDataType), {'E','N','E','R','A','C','C','U'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkCellTimingHistogramDataType = { sizeof(AliHLTComponentDataType), {'T','I','M','E','H','I','S','T'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkCellTimingAverageDataType = { sizeof(AliHLTComponentDataType), {'T','I','M','E','A','V','E','R'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkCellChannelDataDataType = { sizeof(AliHLTComponentDataType), {'C','H','A','N','D','A','T','A'},{'P','H','O','S'}};; diff --git a/HLT/PHOS/AliHLTPHOSDefinitions.h b/HLT/PHOS/AliHLTPHOSDefinitions.h index 9d39cd588d6..b4cb530c572 100644 --- a/HLT/PHOS/AliHLTPHOSDefinitions.h +++ b/HLT/PHOS/AliHLTPHOSDefinitions.h @@ -1,4 +1,3 @@ - // XEmacs -*-C++-*- // @(#) $Id$ @@ -7,20 +6,23 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ +/* AliHLTPHOSDefinitions + */ #include "AliHLTDataTypes.h" +#include "Rtypes.h" class AliHLTPHOSDefinitions { public: - static const AliHLTComponentDataType fgkCellEnergyDataType; /** #include -using namespace std; +using std::string; -//_________________________________________________________________________________________________ AliHLTPHOSFileWriter::AliHLTPHOSFileWriter():fCurrentEvntCnt(0), fCurrentFile(0), fDirectory(""), fCurrentFilename("") { } -//_________________________________________________________________________________________________ AliHLTPHOSFileWriter::~AliHLTPHOSFileWriter() { } -//_________________________________________________________________________________________________ void AliHLTPHOSFileWriter::SetDirectory(string& directory) { } - -//_________________________________________________________________________________________________ void AliHLTPHOSFileWriter::MakeFilename(int eventNr, const AliHLTComponentDataType& dataType) { diff --git a/HLT/PHOS/AliHLTPHOSFileWriter.h b/HLT/PHOS/AliHLTPHOSFileWriter.h index e24404aaf71..82a4c9ba9bb 100644 --- a/HLT/PHOS/AliHLTPHOSFileWriter.h +++ b/HLT/PHOS/AliHLTPHOSFileWriter.h @@ -1,27 +1,29 @@ #ifndef ALIHLTPHOSFILEWRITER_H #define ALIHLTPHOSFILEWRITER_H +#include "AliHLTPHOSFileWriter.h" +#include #include "AliHLTDataTypes.h" #include -using std::string; +using std::string; class AliHLTPHOSFileWriter { public: AliHLTPHOSFileWriter(); virtual ~AliHLTPHOSFileWriter(); - void MakeFilename(int eventNr =0, const AliHLTComponentDataType& dataType = kAliHLTVoidDataType); + void MakeFilename(int eventNr, const AliHLTComponentDataType& dataType); void SetDirectory(string& directory); protected: int fCurrentEvntCnt; - FILE *fCurrentFile; /** #include @@ -25,22 +24,23 @@ #include "AliHLTPHOSRcuCellEnergyDataStruct.h" #include "AliHLTPHOSDataHeaderStruct.h" #include "AliHLTDataTypes.h" -#include "AliHLTPHOSDDLPackedFileWriter.h" -#include "AliHLTPHOSCellEnergiesFileWriter.h" -const AliHLTComponentDataType AliHLTPHOSFileWriterComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array + +class AliRawReaderMemory; +class AliCaloRawStream; +class AliHLTPHOSRcuCellEnergyDataStruct; + + +const AliHLTComponentDataType AliHLTPHOSFileWriterComponent::fInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array AliHLTPHOSFileWriterComponent gAliHLTPHOSFileWriterComponent; -//____________________________________________________________________________________ AliHLTPHOSFileWriterComponent::AliHLTPHOSFileWriterComponent(): AliHLTFileWriter(), fCellEnergiesFileWriterPtr(0) \ , fDDLPackedFileWriterPtr(0), fDirectory(""),fFilename(""), fEventCount(0) { - /* - *Default constructor - */ + // see header file for documentation for(int i=0; i& list) { - const AliHLTComponentDataType* pType=fgkInputDataTypes; + // see header file for documentation + const AliHLTComponentDataType* pType=fInputDataTypes; while (pType->fID!=0) { list.push_back(*pType); pType++; } } -//____________________________________________________________________________________ AliHLTComponentDataType AliHLTPHOSFileWriterComponent::GetOutputDataType() { - return AliHLTPHOSDefinitions::fgkCellEnergyDataType; + // see header file for documentation + return AliHLTPHOSDefinitions::gkCellEnergyDataType; } -//____________________________________________________________________________________ void AliHLTPHOSFileWriterComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) @@ -157,7 +155,6 @@ AliHLTPHOSFileWriterComponent::GetOutputDataSize(unsigned long& constBase, doubl inputMultiplier = 0.1; } -//____________________________________________________________________________________ Bool_t AliHLTPHOSFileWriterComponent::IsRegisteredDataType(const AliHLTComponentDataType& dataType) { diff --git a/HLT/PHOS/AliHLTPHOSFileWriterComponent.h b/HLT/PHOS/AliHLTPHOSFileWriterComponent.h index b2000a889a4..8a4d638db30 100644 --- a/HLT/PHOS/AliHLTPHOSFileWriterComponent.h +++ b/HLT/PHOS/AliHLTPHOSFileWriterComponent.h @@ -1,21 +1,20 @@ #ifndef ALIHLTPHOSFILEWRITERCOMPONENT_H #define ALIHLTPHOSFILEWRITERCOMPONENT_H -//#include "AliHLTPHOSDefinitions.h" +#include "AliHLTPHOSDefinitions.h" #include #include "AliHLTPHOSCommonDefs.h" +#include "AliHLTPHOSFileWriter.h" +#include "AliHLTPHOSCellEnergiesFileWriter.h" +#include "AliHLTPHOSDDLPackedFileWriter.h" #include "Rtypes.h" #include "AliHLTFileWriter.h" -#include class AliRawReaderMemory; class AliCaloRawStream; class AliHLTPHOSRcuCellEnergyDataStruct; class AliHLTPHOSFileWriterComponent; -class AliHLTPHOSDDLPackedFileWriter; -class AliHLTPHOSCellEnergiesFileWriter; -//class AliHLTFileWriter; class AliHLTPHOSFileWriterComponent:public AliHLTFileWriter { @@ -26,7 +25,7 @@ class AliHLTPHOSFileWriterComponent:public AliHLTFileWriter virtual int Deinit(); virtual int DoDeinit(); virtual const char* GetComponentID(); - virtual void GetInputDataTypes( std::vector &); + virtual void GetInputDataTypes(std::vector >&); virtual AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); virtual AliHLTComponent* Spawn(); @@ -40,12 +39,12 @@ class AliHLTPHOSFileWriterComponent:public AliHLTFileWriter { return *this; }; - AliHLTPHOSCellEnergiesFileWriter *fCellEnergiesFileWriterPtr; /** +//#include "stdio.h" #include "AliRawReaderMemory.h" #include "AliCaloRawStream.h" -//#include "cstdio" -#include +#include "cstdio" +//#include + #include "AliHLTPHOSRcuCellEnergyDataStruct.h" #include "AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h" -using namespace std; const AliHLTComponentDataType AliHLTPHOSHistogramProducerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array @@ -38,24 +40,24 @@ AliHLTPHOSHistogramProducerComponent gAliHLTPHOSHistogramProducerComponent; * and it fills the histograms with amplitudes per channel. * * Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C * **************************************************************************/ -AliHLTPHOSHistogramProducerComponent:: AliHLTPHOSHistogramProducerComponent():AliHLTPHOSProcessor() +AliHLTPHOSHistogramProducerComponent:: AliHLTPHOSHistogramProducerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0) { Reset(); } -//________________________________________________________________________________________ + AliHLTPHOSHistogramProducerComponent::~ AliHLTPHOSHistogramProducerComponent() { } -//________________________________________________________________________________________ -AliHLTPHOSHistogramProducerComponent::AliHLTPHOSHistogramProducerComponent(const AliHLTPHOSHistogramProducerComponent & ) : AliHLTPHOSProcessor() + +AliHLTPHOSHistogramProducerComponent::AliHLTPHOSHistogramProducerComponent(const AliHLTPHOSHistogramProducerComponent & ) : AliHLTProcessor(), fEventCount(0), fEquippmentID(0) { } -//________________________________________________________________________________________ + int AliHLTPHOSHistogramProducerComponent::Deinit() { @@ -63,16 +65,23 @@ AliHLTPHOSHistogramProducerComponent::Deinit() } -//________________________________________________________________________________________ +int +AliHLTPHOSHistogramProducerComponent::DoDeinit() +{ + Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSHistogramProducer DoDeinit"); + return 0; +} + + const char* AliHLTPHOSHistogramProducerComponent::GetComponentID() { return "HistogramProducer"; } -//________________________________________________________________________________________ + void -AliHLTPHOSHistogramProducerComponent::GetInputDataTypes( vector& list) + AliHLTPHOSHistogramProducerComponent::GetInputDataTypes( vector& list) { const AliHLTComponentDataType* pType=fgkInputDataTypes; while (pType->fID!=0) @@ -82,15 +91,14 @@ AliHLTPHOSHistogramProducerComponent::GetInputDataTypes( vector& outputBlocks ) { - /** - *This fucntion takes as input cell energies as input and accumulates - *Energy and the number of hits on a per channel basis and fills a four - *dimensional array [N_MODULES][N_ROWS_MOD][N_COLUMNS_MOD][N_GAINS]. - *Energy distribution histograms (root) are updatet continioulsy and written to - *root files at the end of run command (actually the "stop" command) - */ - unsigned long ndx; UInt_t offset = 0; UInt_t mysize = 0; @@ -142,6 +141,7 @@ AliHLTPHOSHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& e int tmpZ; int tmpX; + // for(int i= 0; i< tmpCnt; i ++) for(int i= 0; i <= tmpCnt; i ++) { tmpZ = cellDataPtr->fValidData[i].fZ + N_ZROWS_RCU*tmpRcuZ; @@ -160,6 +160,7 @@ AliHLTPHOSHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& e } } + for(int z=0; z < N_ZROWS_MOD; z ++ ) { for(int x = 0; x < N_XCOLUMNS_MOD; x ++) @@ -172,13 +173,14 @@ AliHLTPHOSHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& e } } + //pushing data to shared output memory mysize += sizeof(AliHLTPHOSModuleCellAccumulatedEnergyDataStruct); AliHLTComponentBlockData bd; FillBlockData( bd ); bd.fOffset = offset; bd.fSize = mysize; - bd.fDataType = AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType; + bd.fDataType = AliHLTPHOSDefinitions::gkCellAccumulatedEnergyDataType; bd.fSpecification = 0xFFFFFFFF; outputBlocks.push_back( bd ); tSize += mysize; @@ -191,13 +193,12 @@ AliHLTPHOSHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& e , tSize, size ); return EMSGSIZE; } - // fPhosEventCount; - fPhosEventCount++; + + fEventCount++; return 0; }//end DoEvent -//________________________________________________________________________________________ int AliHLTPHOSHistogramProducerComponent::DoInit( int argc, const char** argv ) { @@ -209,7 +210,6 @@ AliHLTPHOSHistogramProducerComponent::DoInit( int argc, const char** argv ) } -//________________________________________________________________________________________ void AliHLTPHOSHistogramProducerComponent::DumpData(int gain) { @@ -245,7 +245,6 @@ AliHLTPHOSHistogramProducerComponent::DumpData(int gain) -//________________________________________________________________________________________ void AliHLTPHOSHistogramProducerComponent::Reset() { @@ -270,8 +269,6 @@ AliHLTPHOSHistogramProducerComponent::Reset() } } // end Reset - -//________________________________________________________________________________________ void AliHLTPHOSHistogramProducerComponent::ResetDataPtr() { @@ -281,7 +278,20 @@ AliHLTPHOSHistogramProducerComponent::ResetDataPtr() } } -//________________________________________________________________________________________ + +void +AliHLTPHOSHistogramProducerComponent::SetEquippmentId(int id) +{ + fEquippmentID = id; +} + +int +AliHLTPHOSHistogramProducerComponent::GetEquippmentId() +{ + return fEquippmentID; +} + + AliHLTComponent* AliHLTPHOSHistogramProducerComponent::Spawn() { diff --git a/HLT/PHOS/AliHLTPHOSHistogramProducerComponent.h b/HLT/PHOS/AliHLTPHOSHistogramProducerComponent.h index 4b9e5af3fbb..1f293ec5ec1 100644 --- a/HLT/PHOS/AliHLTPHOSHistogramProducerComponent.h +++ b/HLT/PHOS/AliHLTPHOSHistogramProducerComponent.h @@ -5,17 +5,22 @@ /* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -#include "AliHLTPHOSProcessor.h" +#include "AliHLTProcessor.h" #include "AliHLTPHOSDefinitions.h" #include "AliHLTPHOSCommonDefs.h" +//#include "TH2.h" +//#include "AliHLTPHOSCommonDefs.h" +//#include "AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h" - +//class TH2; class AliHLTPHOSModuleCellAccumulatedEnergyDataStruct; -class AliHLTPHOSHistogramProducerComponent:public AliHLTPHOSProcessor +class AliHLTPHOSHistogramProducerComponent:public AliHLTProcessor { public: AliHLTPHOSHistogramProducerComponent(); + + // ~AliHLTPHOSHistogramProducerComponent(); virtual ~AliHLTPHOSHistogramProducerComponent(); AliHLTPHOSHistogramProducerComponent(const AliHLTPHOSHistogramProducerComponent & ); AliHLTPHOSHistogramProducerComponent & operator = (const AliHLTPHOSHistogramProducerComponent &) @@ -24,29 +29,32 @@ class AliHLTPHOSHistogramProducerComponent:public AliHLTPHOSProcessor }; virtual int DoInit( int argc = 0, const char** argv = 0); virtual int Deinit(); - virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, - AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, vector& outputBlocks ); - + virtual int DoDeinit(); + virtual int DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector >&); void DumpData(int gain = 0); + int GetEquippmentId(); virtual const char* GetComponentID(); - virtual void GetInputDataTypes( std::vector & list); + virtual void GetInputDataTypes(std::vector >&); virtual AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); + void SetEquippmentId(int id = 0); virtual AliHLTComponent* Spawn(); + protected: void Reset(); void ResetDataPtr(); private: - Double_t fEnergyAverageValues[N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS]; /** +//#include "stdio.h" #include "AliRawReaderMemory.h" #include "AliCaloRawStream.h" +//#include #include #include "AliHLTPHOSRcuCellEnergyDataStruct.h" @@ -23,30 +26,26 @@ const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array const AliHLTComponentDataType AliHLTPHOSModuleMergerComponent::fgkOutputDataType=kAliHLTVoidDataType; -AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent; -//_____________________________________________________________________________________________________ -AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTProcessor(), fPhosEventCount(0), fEquippmentID(0) +AliHLTPHOSModuleMergerComponent gAliHLTPHOSModuleMergerComponent; +AliHLTPHOSModuleMergerComponent:: AliHLTPHOSModuleMergerComponent():AliHLTProcessor(), fEventCount(0), fEquippmentID(0) { } -//_____________________________________________________________________________________________________ AliHLTPHOSModuleMergerComponent::~ AliHLTPHOSModuleMergerComponent() { } -//_____________________________________________________________________________________________________ -AliHLTPHOSModuleMergerComponent::AliHLTPHOSModuleMergerComponent(const AliHLTPHOSModuleMergerComponent & ) : AliHLTProcessor(), fPhosEventCount(0), fEquippmentID(0) +AliHLTPHOSModuleMergerComponent::AliHLTPHOSModuleMergerComponent(const AliHLTPHOSModuleMergerComponent & ) : AliHLTProcessor(), fEventCount(0), fEquippmentID(0) { } -//_____________________________________________________________________________________________________ int AliHLTPHOSModuleMergerComponent::Deinit() { @@ -54,7 +53,6 @@ AliHLTPHOSModuleMergerComponent::Deinit() } -//_____________________________________________________________________________________________________ int AliHLTPHOSModuleMergerComponent::DoDeinit() { @@ -64,7 +62,6 @@ AliHLTPHOSModuleMergerComponent::DoDeinit() } -//_____________________________________________________________________________________________________ const char* AliHLTPHOSModuleMergerComponent::GetComponentID() { @@ -72,10 +69,10 @@ AliHLTPHOSModuleMergerComponent::GetComponentID() } -//_____________________________________________________________________________________________________ void -AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector& list) + AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector& list) { + /// const AliHLTComponentDataType* pType=fgkInputDataTypes; while (pType->fID!=0) { @@ -85,15 +82,14 @@ AliHLTPHOSModuleMergerComponent::GetInputDataTypes( vector& outputBlocks ); - + virtual int DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector >&); void DumpData(int gain =0); - const int GetEquippmentId() const; + int GetEquippmentId(); virtual const char* GetComponentID(); - virtual void GetInputDataTypes( std::vector & list); + virtual void GetInputDataTypes(std::vector >&); virtual AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); void SetEquippmentId(int id = 0); @@ -39,7 +36,7 @@ class AliHLTPHOSModuleMergerComponent:public AliHLTProcessor void ResetDataPtr(); private: - int fPhosEventCount; /** * - * * - * 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 "AliHLTPHOSPhysicsAnalyzer.h" -#include "TVector3.h" -#include "TFile.h" -#include "TMath.h" -#include -#include "AliPHOSGeometry.h" -#include - -ClassImp(AliHLTPHOSPhysicsAnalyzer); - -AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():fClustersPtr(NULL) - - -{ - - AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV"); - - fPHOSRadius = geom->GetIPtoCrystalSurface(); - - for(Int_t i = 0; i < N_MODULES; i++) - { - fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); - - fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); - } -} - -AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(NULL) - -{ - AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV"); - - fPHOSRadius = geom->GetIPtoCrystalSurface(); - - for(Int_t i = 0; i < N_MODULES; i++) - { - fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); - - fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); - } - cout << "Copy constructor not tested!\n"; -} - - -AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer() -{ - -} - -void -AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* locPositionPtr) -{ - - locPositionPtr[0] = clusterPtr->fLocalPositionPtr[0]; - locPositionPtr[1] = clusterPtr->fLocalPositionPtr[1]; - -} - -void -AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* positionPtr) -{ - - Float_t tempPosX = 0; - - Int_t module = clusterPtr->fPHOSModule; - - tempPosX = CRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[0]-N_COLUMNS_MOD/2) + CRYSTAL_SIZE/2; - - positionPtr[0] = tempPosX*fRotParametersSin[module] + fPHOSRadius*fRotParametersCos[module]; - - positionPtr[1] = tempPosX*fRotParametersCos[module] - fPHOSRadius*fRotParametersSin[module]; - - positionPtr[2] = CRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[1]-N_ROWS_MOD/2) + CRYSTAL_SIZE/2; - -} - -void -AliHLTPHOSPhysicsAnalyzer::GlobalPosition(Float_t* locPositionPtr, Float_t* positionPtr, Int_t module) -{ - - positionPtr[0] = CRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersCos[module-1] + fPHOSRadius*fRotParametersSin[module-1]; - - positionPtr[1] = CRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersSin[module-1] - fPHOSRadius*fRotParametersCos[module-1]; - - positionPtr[2] = CRYSTAL_SIZE*(locPositionPtr[1]-N_ROWS_MOD); - -} - -void -AliHLTPHOSPhysicsAnalyzer::WriteHistogram(Char_t* fileName) -{ - TFile *outfile = new TFile(fileName,"recreate"); - - fRootHistPtr->Write(); - - outfile->Close(); - -} - - diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.h deleted file mode 100644 index 9ec54d02e5d..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.h +++ /dev/null @@ -1,47 +0,0 @@ - -#ifndef ALIHLTPHOSPHYSICSANALYZER_H -#define ALIHLTPHOSPHYSICSANALYZER_H - -/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - - -#include -#include -#include "TH2F.h" -#include "AliHLTPHOSClusterDataStruct.h" - -const Float_t CRYSTAL_SIZE = 2.25; - -class AliHLTPHOSPhysicsAnalyzer -{ - public: - AliHLTPHOSPhysicsAnalyzer(); - virtual ~AliHLTPHOSPhysicsAnalyzer(); - - AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer & ); - AliHLTPHOSPhysicsAnalyzer & operator = (const AliHLTPHOSPhysicsAnalyzer &) {return *this;} - - void SetHistogram(TH1F* histPtr) {fRootHistPtr = histPtr;} - - void LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* locPositionPtr); - void GlobalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* positionPtr); - void GlobalPosition(Float_t* locPositionPtr , Float_t* positionPtr, Int_t module); - - virtual void WriteHistogram(Char_t* fileName = "histogram.root"); - virtual void Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters) = 0; - - protected: - - TObjArray* fClustersPtr; - TH1F* fRootHistPtr; - - private: - Float_t fRotParametersCos[5]; - Float_t fRotParametersSin[5]; - Float_t fPHOSRadius; - - ClassDef(AliHLTPHOSPhysicsAnalyzer,1); -}; - -#endif diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx deleted file mode 100644 index f9f1ffb731e..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx +++ /dev/null @@ -1,84 +0,0 @@ - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Øystein Djuvsland * - * * - * 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 "AliHLTPHOSPhysicsAnalyzerPeakFitter.h" -#include "TMath.h" -#include "TF1.h" -#include "TFile.h" - - -ClassImp(AliHLTPHOSPhysicsAnalyzerPeakFitter); - -AliHLTPHOSPhysicsAnalyzerPeakFitter::AliHLTPHOSPhysicsAnalyzerPeakFitter() : fGainLow(80), fGainHigh(5), - fRootHistPtr(0) -{ -} - -AliHLTPHOSPhysicsAnalyzerPeakFitter::~AliHLTPHOSPhysicsAnalyzerPeakFitter() -{ -} - -Int_t -AliHLTPHOSPhysicsAnalyzerPeakFitter::FitGaussian() -{ - Int_t maxBin = fRootHistPtr->GetMaximumBin(); - Float_t binWidth = fRootHistPtr->GetBinWidth(maxBin); - Float_t maxBinValue = (Float_t)(maxBin * binWidth); - Float_t lowRange = maxBinValue - 0.03; - Float_t highRange = maxBinValue + 0.03; - - TF1* gaussian = new TF1("gaussian", "gaus", 0.1, 0.2); - Double_t params[3] = {maxBinValue, 0}; - - - fRootHistPtr->Fit(gaussian->GetName(), "", "",lowRange, highRange); - - return 0; - -} - -Int_t -AliHLTPHOSPhysicsAnalyzerPeakFitter::FitLorentzian() -{ - - - Int_t maxBin = fRootHistPtr->GetMaximumBin(); - Float_t binWidth = fRootHistPtr->GetBinWidth(maxBin); - Float_t maxBinValue = (Float_t)(maxBin * binWidth); - Double_t lowRange = maxBinValue - 0.03; - Double_t highRange = maxBinValue + 0.03; - - Int_t npar = 3; - - char* name = "lorentzian"; - - TF1* lorentzian = new TF1(name, "([0]*1/TMath::Pi())*[1]/((x[0]-[2])*(x[0]-[2])+[1]*[1])", lowRange, highRange); - - Double_t params[3] = {fRootHistPtr->GetBinContent(maxBin)/20, 0.01, 0.135}; - lorentzian->SetParameters(params); - - fRootHistPtr->Fit(lorentzian->GetName(), "", "", lowRange, highRange); - - lorentzian->GetParameters(params); - - TFile *outfile = new TFile("/home/odjuvsla/pi0HistFit.root","recreate"); - fRootHistPtr->Write(); - outfile->Close(); - - return 0; -} - diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h deleted file mode 100644 index 06fad9d2a93..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef ALIHLTPHOSPHYSICSANALYZERPEAKFITTER_H -#define ALIHLTPHOSPHYSICSANALYZERPEAKFITTER_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - - -#include "Rtypes.h" -#include "AliHLTPHOSClusterDataStruct.h" -#include "AliHLTDataTypes.h" -#include "TH1F.h" -#include "TMath.h" - - -class AliHLTPHOSPhysicsAnalyzerPeakFitter -{ - - public: - - AliHLTPHOSPhysicsAnalyzerPeakFitter(); - virtual ~AliHLTPHOSPhysicsAnalyzerPeakFitter(); - - void SetHistogram(TH1F* histPtr) { fRootHistPtr = histPtr; } - - Int_t FitGaussian(); - Int_t FitLorentzian(); - - - private: - - Float_t fGainLow; - Float_t fGainHigh; - TH1F* fRootHistPtr; - - ClassDef(AliHLTPHOSPhysicsAnalyzerPeakFitter, 1); - -}; - - - - - - -#endif diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx deleted file mode 100644 index 693a4ee5b0d..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx +++ /dev/null @@ -1,154 +0,0 @@ - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Ãystein Djuvsland * - * * - * 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 "AliHLTPHOSPhysicsAnalyzerSpectrum.h" -#include "AliHLTPHOSClusterDataStruct.h" -#include -#include - -ClassImp(AliHLTPHOSPhysicsAnalyzerSpectrum); - -AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum():AliHLTPHOSPhysicsAnalyzer() -{ - - fEnergyPtr = new Float_t[2]; - fPos0Ptr = new Float_t[3]; - fPos1Ptr = new Float_t[3]; - fThresholdPtr = new Float_t[2]; - fThresholdPtr[0] = 0; - fThresholdPtr[1] = 0; - -} - -AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum(const AliHLTPHOSPhysicsAnalyzerSpectrum &):AliHLTPHOSPhysicsAnalyzer() -{ - - cout << "AliHLTPHOSPhysicsAnalyzerSpectrum: Copy constructor not implemented yet!" << endl; - -} - -AliHLTPHOSPhysicsAnalyzerSpectrum::~AliHLTPHOSPhysicsAnalyzerSpectrum() -{ - - if(fClustersPtr) fClustersPtr = 0; - - if(fRootHistPtr) fRootHistPtr = 0; - - if(fThresholdPtr) - { - delete [] fThresholdPtr; - fThresholdPtr = 0; - } - if(fEnergyPtr) - { - delete [] fEnergyPtr; - fEnergyPtr = 0; - } - if(fPos0Ptr) - { - delete [] fPos0Ptr; - fPos0Ptr = 0; - } - if(fPos1Ptr) - { - delete [] fPos1Ptr; - fPos1Ptr = 0; - } - -} - -void -AliHLTPHOSPhysicsAnalyzerSpectrum::Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters) -{ - - Float_t cosOpeningAngle = 0; - - cout << "number of clusters: " << nClusters << endl; - - if(nClusters > 1) - { - for(Int_t i = 0; i < nClusters-1; i++) - { - - fEnergyPtr[0] = clustersPtr[i]->fClusterEnergy; - - if(fEnergyPtr[0] > fThresholdPtr[0]) - { - - for(Int_t j = i+1; j < nClusters; j++) - { - - fEnergyPtr[1] = clustersPtr[j]->fClusterEnergy; - - if(fEnergyPtr[1] > fThresholdPtr[1]) - { - GlobalPosition(clustersPtr[i], fPos0Ptr); - - GlobalPosition(clustersPtr[j], fPos1Ptr); - - cosOpeningAngle = (fPos0Ptr[0]*fPos1Ptr[0] + fPos0Ptr[1]*fPos1Ptr[1] + fPos0Ptr[2]*fPos1Ptr[2])/ - (sqrt(fPos0Ptr[0]*fPos0Ptr[0] + fPos0Ptr[1]*fPos0Ptr[1] + fPos0Ptr[2]*fPos0Ptr[2])* - sqrt(fPos1Ptr[0]*fPos1Ptr[0] + fPos1Ptr[1]*fPos1Ptr[1] + fPos1Ptr[2]*fPos1Ptr[2])); - - fRootHistPtr->Fill(sqrt(2*fEnergyPtr[0]*fEnergyPtr[1]*(1 - cosOpeningAngle))); - - - } - - } - - } - - } - - } - -} - - -Float_t -AliHLTPHOSPhysicsAnalyzerSpectrum::EvalDistance() -{ - - return sqrt(pow(fPos1Ptr[0]-fPos0Ptr[0],2) + pow(fPos1Ptr[1]-fPos0Ptr[1],2) + pow(fPos1Ptr[2]-fPos0Ptr[2],2)); - -} - -Float_t -AliHLTPHOSPhysicsAnalyzerSpectrum::EvalCutDistance(Float_t cutMass) -{ - - Float_t cosCutOpeningAngle = 0; - - cosCutOpeningAngle = 1 - cutMass*cutMass/(2*fEnergyPtr[0]*fEnergyPtr[1]); - - return 1.5*2*sin(acos(cosCutOpeningAngle)); - -} - -Int_t -AliHLTPHOSPhysicsAnalyzerSpectrum::SetThreshold(Float_t photonEnergy0, Float_t photonEnergy1) -{ - - if(!fThresholdPtr) fThresholdPtr = new Float_t[2]; - - fThresholdPtr[0] = photonEnergy0; - - fThresholdPtr[1] = photonEnergy1; - - return 0; - -} diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h deleted file mode 100644 index 314a8f6a72a..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H -#define ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - - - -#include "AliHLTPHOSPhysicsAnalyzer.h" - - -const Int_t USE_DISTANCE_CUT = 0; - -class AliHLTPHOSPhysicsAnalyzerSpectrum : public AliHLTPHOSPhysicsAnalyzer -{ - public: - AliHLTPHOSPhysicsAnalyzerSpectrum(); - AliHLTPHOSPhysicsAnalyzerSpectrum(const AliHLTPHOSPhysicsAnalyzerSpectrum &); - AliHLTPHOSPhysicsAnalyzerSpectrum & operator = (const AliHLTPHOSPhysicsAnalyzerSpectrum) - { - return *this; - } - - virtual ~AliHLTPHOSPhysicsAnalyzerSpectrum(); - - Int_t SetThreshold(Float_t photonEnergy0, Float_t photonEnergy1); - Float_t EvalDistance(); - Float_t EvalCutDistance(Float_t cutMass); - - virtual void Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters); - - private: - Float_t* fPos0Ptr; - Float_t* fPos1Ptr; - Float_t* fThresholdPtr; - Float_t* fEnergyPtr; - Bool_t fUseDistanceCut; - - ClassDef(AliHLTPHOSPhysicsAnalyzerSpectrum, 1); - -}; - - -#endif diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx deleted file mode 100644 index 1344e278ab2..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx +++ /dev/null @@ -1,168 +0,0 @@ - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Øystein Djuvsland * - * * - * 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 "AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h" -#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h" -#include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h" -#include "AliHLTPHOSPhysicsDefinitions.h" -#include "AliHLTPHOSDefinitions.h" -#include "TCanvas.h" -#include "TFile.h" -#include -#include "stdio.h" -#include - -const AliHLTComponentDataType AliHLTPHOSPhysicsAnalyzerSpectrumComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; -int AliHLTPHOSPhysicsAnalyzerSpectrumComponent::fEventCount = 0; - -AliHLTPHOSPhysicsAnalyzerSpectrumComponent gAliHLTPHOSPhysicsAnalyzerSpectrumComponent; - -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent():AliHLTProcessor(), fAnalyzerPtr(0), - fRootHistPtr(0) -{ -} - -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::~AliHLTPHOSPhysicsAnalyzerSpectrumComponent() -{ -} - -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent(const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &):AliHLTProcessor(), - fAnalyzerPtr(0), - fRootHistPtr(0) -{ - - cout << "AliHLTPHOSPhysicsAnalyzerSpectrumComponent: Copy constructor not implemented yet!" << endl; - -} - -Int_t -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Deinit() -{ - - - fPeakFitter->SetHistogram(fRootHistPtr); - cout << "Fitting..." << endl; - //pf->FitGaussian(); - fPeakFitter->FitLorentzian(); - - return 0; -} - -Int_t -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoDeinit() -{ - Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSPhysicsAnalyzerSpectrumComponent DoDeinit"); - - return 0; -} - - -const Char_t* -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetComponentID() -{ - return "AliHltPhosPhysicsAnalyzerSpectrum"; -} - -void -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetInputDataTypes( vector& list) -{ - const AliHLTComponentDataType* pType=inputDataTypes; - while (pType->fID!=0) { - list.push_back(*pType); - pType++; - } -} - -AliHLTComponentDataType -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataType() -{ - return AliHLTPHOSPhysicsDefinitions::fgkAliHLTSpectrumDataType; -} - -void -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) - -{ - constBase = 30; - inputMultiplier = 1; -} - - -Int_t -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, - AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, - std::vector& outputBlocks) -{ - - const AliHLTComponentBlockData* iter = NULL; - unsigned long ndx; - - for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) - { - iter = blocks+ndx; - - if(iter->fDataType != AliHLTPHOSPhysicsDefinitions::fgkAliHLTClusterDataType) - { - cout << "Warning: data type is not fgkAliHLTClusterDataType " << endl; - continue; - } - - fClusterArrayPtr[ndx] = reinterpret_cast(iter->fPtr); - - } - - fAnalyzerPtr->Analyze(fClusterArrayPtr, ndx); - - if(fEventCount%fWriteInterval == 0 && fEventCount != 0) - { - PushBack(fRootHistPtr, kAliHLTAnyDataType, (AliHLTUInt32_t)0); - } - - fEventCount++; - - return 0; - -} - -Int_t -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoInit(Int_t argc, const Char_t** argv ) -{ - - Float_t firstThreshold = atof(argv[0]); - Float_t secondThreshold = atof(argv[1]); - fWriteInterval = atoi(argv[2]); - Int_t nBins = atoi(argv[3]); - Float_t lowLimit = atof(argv[4]); - Float_t highLimit = atof(argv[5]); - - fPeakFitter = new AliHLTPHOSPhysicsAnalyzerPeakFitter(); - fRootHistPtr = new TH1F("hist", "hist", nBins, lowLimit, highLimit); - fAnalyzerPtr = new AliHLTPHOSPhysicsAnalyzerSpectrum(); - fAnalyzerPtr->SetThreshold(firstThreshold,secondThreshold); - fAnalyzerPtr->SetHistogram(fRootHistPtr); - - if (argc==0 && argv==NULL) { - // this is currently just to get rid of the warning "unused parameter" - } - - return 0; -} - -AliHLTComponent* -AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Spawn() -{ - return new AliHLTPHOSPhysicsAnalyzerSpectrumComponent(); -} diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h deleted file mode 100644 index f64c8b0b743..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h +++ /dev/null @@ -1,63 +0,0 @@ - -#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT -#define ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT - -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - - -#include "AliHLTProcessor.h" -#include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h" -#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h" -#include "AliHLTPHOSClusterDataStruct.h" -#include "TH1F.h" -#include "TH2F.h" -#include "Rtypes.h" - - -class AliHLTPHOSPhysicsAnalyzerSpectrumComponent: public AliHLTProcessor -{ - public: - - AliHLTPHOSPhysicsAnalyzerSpectrumComponent(); - ~AliHLTPHOSPhysicsAnalyzerSpectrumComponent(); - AliHLTPHOSPhysicsAnalyzerSpectrumComponent(const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &); - AliHLTPHOSPhysicsAnalyzerSpectrumComponent & operator = (const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &) - { - return *this; - } - const char* GetComponentID(); - void GetInputDataTypes(std::vector >&); - - AliHLTComponentDataType GetOutputDataType(); - - void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); - - - Int_t DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*, - AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, - std::vector&); - - - AliHLTComponent* Spawn(); - - protected: - - Int_t DoInit(int argc, const char** argv); - Int_t Deinit(); - Int_t DoDeinit(); - - private: - - AliHLTPHOSPhysicsAnalyzerSpectrum* fAnalyzerPtr; - AliHLTPHOSPhysicsAnalyzerPeakFitter* fPeakFitter; - TH1F* fRootHistPtr; - AliHLTPHOSClusterDataStruct* fClusterArrayPtr[10000]; - Int_t fWriteInterval; - - static const AliHLTComponentDataType inputDataTypes[]; - static int fEventCount; - -}; - -#endif diff --git a/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.cxx b/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.cxx deleted file mode 100644 index 2240d800ea4..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.cxx +++ /dev/null @@ -1,22 +0,0 @@ - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Øystein Djuvsland * - * * - * 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 "AliHLTPHOSPhysicsDefinitions.h" - - -const AliHLTComponentDataType AliHLTPHOSPhysicsDefinitions::fgkAliHLTClusterDataType = { sizeof(AliHLTComponentDataType), {'C','L','U','S','T','R','T','Y'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSPhysicsDefinitions::fgkAliHLTHistDataType = { sizeof(AliHLTComponentDataType), {'H','I','S','T','T','Y','P','E'},{'P','H','O','S'}};; -const AliHLTComponentDataType AliHLTPHOSPhysicsDefinitions::fgkAliHLTSpectrumDataType = { sizeof(AliHLTComponentDataType), {'S','P','E','C','T','Y','P','E'},{'P','H','O','S'}};; diff --git a/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.h b/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.h deleted file mode 100644 index 7d575718cb6..00000000000 --- a/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.h +++ /dev/null @@ -1,24 +0,0 @@ - -#ifndef ALIHLTPHOSPHYSICSDEFINITIONS_H -#define ALIHLTPHOSPHYSICSDEFINITIONS_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* AliHLTPHOSPhysicsDefinitions - */ - -#include "AliHLTDataTypes.h" -#include "Rtypes.h" -#include "TROOT.h" -#include "TH1F.h" - -class AliHLTPHOSPhysicsDefinitions - { - public: - static const AliHLTComponentDataType fgkAliHLTClusterDataType; - static const AliHLTComponentDataType fgkAliHLTHistDataType; - static const AliHLTComponentDataType fgkAliHLTSpectrumDataType; - }; - -#endif - diff --git a/HLT/PHOS/AliHLTPHOSProcessor.cxx b/HLT/PHOS/AliHLTPHOSProcessor.cxx deleted file mode 100644 index 8e147d250d9..00000000000 --- a/HLT/PHOS/AliHLTPHOSProcessor.cxx +++ /dev/null @@ -1,149 +0,0 @@ -#include "AliHLTPHOSProcessor.h" -#include "AliHLTPHOSCommonDefs.h" -#include "TString.h" - -const AliHLTComponentDataType AliHLTPHOSProcessor::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array - -AliHLTPHOSProcessor::AliHLTPHOSProcessor():AliHLTProcessor(), fkEquippmentID(0), - fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0), - fPrintInfo(kFALSE), fIsSetEquippmentID(kFALSE), fPrintInfoFrequncy(1000) -{ - -} - - -AliHLTPHOSProcessor::~AliHLTPHOSProcessor() -{ - -} - - -AliHLTPHOSProcessor::AliHLTPHOSProcessor(const AliHLTPHOSProcessor & ):AliHLTProcessor(), fkEquippmentID(0), - fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0), - fPrintInfo(kFALSE), fIsSetEquippmentID(kFALSE), fPrintInfoFrequncy(1000) -{ - -} - -const AliHLTUInt16_t -AliHLTPHOSProcessor::GetEquippmentID() const -{ - return fkEquippmentID; -} - -void -AliHLTPHOSProcessor::SetEquippmentID(AliHLTUInt16_t id) -{ - AliHLTUInt16_t &ref = const_cast(fkEquippmentID); - ref = id; -} - - -int -AliHLTPHOSProcessor::ScanArguments(int argc, const char** argv) -{ - fPrintInfo = kFALSE; - int iResult=0; - TString argument=""; - - for(int i=0; i=0; i++) - { - argument=argv[i]; - - if (argument.IsNull()) - { - continue; - } - - if (argument.CompareTo("-equipmentID") == 0) - { - cout << "AliHLTPHOSProcessor:DoInit argument = -equipmentID " <"); - iResult = -2; - } - return iResult; -} - - -void -AliHLTPHOSProcessor::SetCoordinates(AliHLTUInt16_t equippmentID) -{ - int rcuIndex = (fkEquippmentID - 1792)%N_RCUS_PER_MODULE; - fModuleID = (fkEquippmentID -1792 -rcuIndex)/N_RCUS_PER_MODULE; - - if(rcuIndex == 0) - { - fRcuX = 0; - fRcuZ = 0; - } - - if(rcuIndex == 1) - { - fRcuX = 0; - fRcuZ = 1; - } - - if(rcuIndex == 2) - { - fRcuX = 1; - fRcuZ = 0; - } - - if(rcuIndex == 3) - { - fRcuX = 1; - fRcuZ = 1; - } - - fRcuZOffset = N_ZROWS_RCU*fRcuZ; - fRcuXOffset = N_XCOLUMNS_RCU*fRcuX; - - cout <<"********InitInfo************"<< endl; - cout <<"AliHLTPHOSRawAnalyzerComponent::SetCoordinate casted"<< endl; - cout <<"Equpippment ID =\t"<< fkEquippmentID <& list) =0; - virtual AliHLTComponentDataType GetOutputDataType() =0; - virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) =0; - virtual AliHLTComponent* Spawn() = 0; - protected: - int fPhosEventCount; /** divide by 1000 } -void -AliHLTPHOSPulseGenerator::SetSampleFreq(int fs) -{ - //See header file for documentation - fSampleFreq = fs; - SetDT(fs); -} - - void AliHLTPHOSPulseGenerator::MakePulse(double *dtaPtr) { - //See header file for documentation - for(int i=0; i - class AliHLTPHOSPulseGenerator { public: AliHLTPHOSPulseGenerator(); virtual ~AliHLTPHOSPulseGenerator(); - - /** - * Contruct a pulsegenrator object an initializes all necessary parameters - * @param a Amplitude in ADC levels (0 -1023) - * @param t0 Timedelay in nanoseconds of signal relative the first sample. This value should be between 0 and Ts - * @param N the number of samples - * @param tau Rise time of the semi Gaussian signal - * @param fs samling rate - **/ - AliHLTPHOSPulseGenerator(double a, double t0, const int N , const double tau, const double fs); - + AliHLTPHOSPulseGenerator(double a, double t0, const int N, const double t, const double f); AliHLTPHOSPulseGenerator(const AliHLTPHOSPulseGenerator & ); - - - AliHLTPHOSPulseGenerator & operator = (const AliHLTPHOSPulseGenerator &) + AliHLTPHOSPulseGenerator & operator = (const AliHLTPHOSPulseGenerator) { return *this; } - - /** - * Adds a baseline offset to the signal - * @param baselineLevel The basline level to add - * @param *samples The sample array for which to add te basline offset - **/ - void AddBaseline(double baselineLevel = 0, double *samples = 0); - - /** - * Adds Gaussian white noise to the sample array given by *dataPtr. - * @param dataPtr array of samples - * @param sigma the noise amplitude in entities of ADC levels - **/ + void AddBaseline(double baselineLevel, double *samples); void AddNoise(double *dataPtr, double *sigma); - - /** - * Adds correlated Gaussian noise with cutof frequency "cutoff" - * @param dataPtr array of values - * @param sigma noise amplitude in entities of ADC levels - * @param cutoff -30DB cutoff frequency of the noise in entities of sampling frequency - **/ - void AddNoise(double *dataPtr, double *sigma, double cutoff); - - - /** - * Adds pretrigger samples to the sample array and returns - * a new array containing the pretrigger samples concatenatet - * in front of the samples given by "samples" - * @param baselineLevel The baseline value of the pretrigger samples - * @param samples The sample array for which to add the pretrigger samples - **/ - double *AddPretriggerSamples(double baslineLevel = 0, double *samples = 0); - - - /** - * Returns a Pulse with new amplidude and t0 - * @param a new amplidude, overriding the one given in the constructor - * @param t0 start time of the pulse relative to the sampling clock. - **/ - double *GetPulse(double a = 1, double t0 = 0); - - - /** - * Emulates the ADC. Rounds down to nearest Integerevalue all entries given by - * dataPtr - **/ - void Quantisize(double *dataPtr) const; - - void SetAmplitude(double a = 1); - void SetDT(double fs = 10); - void SetTZero(double t0 = 0); - void SetSampleFreq(int fs); - void MakePulse(double *dtaPtr, int N); - void MakePulse(double *dtaPtr); + void AddNoise(double *dataPtr, double *sigma, double cutoff); + double *AddPretriggerSamples(double baslineLevel, double *samples); + double *GetPulse(); + double *GetPulse(double a, double t0); + void Quantisize(double *dataPtr); + void SetAmplitude(double a); + void SetDT(double fs); + void SetTZero(double t0); private: - double fAmplitude; /** +#include #include "TObject.h" #include "AliHLTPHOSRawAnalyzer.h" diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx index d9b1c56e20f..838c54014b1 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx @@ -35,23 +35,30 @@ #include "AliHLTPHOSRawAnalyzerComponent.h" #include "AliRawReaderMemory.h" #include "AliCaloRawStream.h" +#include #include "AliHLTPHOSRcuCellEnergyDataStruct.h" #include "AliHLTPHOSRcuChannelDataStruct.h" +const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array +int AliHLTPHOSRawAnalyzerComponent::fgEventCount = 0; -using namespace std; -//_________________________________________________________________________________________________ -AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTPHOSProcessor(), fAnalyzerPtr(0), -fSendChannelData(kFALSE),fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0) +AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTProcessor(), fAnalyzerPtr(0), +fEquippmentID(0), fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0),fPrintInfo(kFALSE),fSendChannelData(kFALSE),fPrintInfoFrequncy(1000), +fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0) { + + + } -//_________________________________________________________________________________________________ + AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent() { + ///Default destructor + if(fRawMemoryReader != 0) { delete fRawMemoryReader; @@ -60,20 +67,31 @@ AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent() { delete fPHOSRawStream; } + } -//_________________________________________________________________________________________________ -AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTPHOSProcessor(), fAnalyzerPtr(0), -fSendChannelData(kFALSE),fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0) -{ +AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTProcessor(), fAnalyzerPtr(0), +fEquippmentID(0), fModuleID(0), fRcuX(0), fRcuZ(0),fRcuZOffset(0), fRcuXOffset(0),fPrintInfo(kFALSE),fSendChannelData(kFALSE),fPrintInfoFrequncy(1000), +fPHOSRawStream(0), fRawMemoryReader(0), fOutPtr(0) +{ + //Copy Constructor } -//_________________________________________________________________________________________________ int AliHLTPHOSRawAnalyzerComponent::Deinit() { - Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen Deinit"); + //See base class for documentation + cout << "Deinit" << endl; + return 0; +} + +int +AliHLTPHOSRawAnalyzerComponent::DoDeinit() +{ + //See base class for documentation + cout << "DoDeinit" << endl; + Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit"); if(fRawMemoryReader !=0) { @@ -86,21 +104,20 @@ AliHLTPHOSRawAnalyzerComponent::Deinit() } return 0; - return 0; } -//_________________________________________________________________________________________________ const char* AliHLTPHOSRawAnalyzerComponent::GetComponentID() { + ///Returns the component ID return "AliPhosTestRaw"; } -//_________________________________________________________________________________________________ void AliHLTPHOSRawAnalyzerComponent::GetInputDataTypes( vector& list) { + //See Base class for documentation const AliHLTComponentDataType* pType=fgkInputDataTypes; while (pType->fID!=0) { list.push_back(*pType); @@ -108,27 +125,30 @@ AliHLTPHOSRawAnalyzerComponent::GetInputDataTypes( vector& outputBlocks ) +int AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, + AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, vector& outputBlocks ) { + /// Function that proceesses the raw date to give Energy and TOF for the + /// Individual cells/crystals. + AliHLTUInt8_t tmpMod = 0; AliHLTUInt8_t tmpZ = 0; AliHLTUInt8_t tmpX = 0; @@ -153,7 +173,7 @@ AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData mysize = 0; offset = tSize; - if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType ) + if ( iter->fDataType != AliHLTPHOSDefinitions::gkDDLPackedRawDataType ) { continue; } @@ -218,7 +238,7 @@ AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData FillBlockData( bd ); bd.fOffset = offset; bd.fSize = mysize; - bd.fDataType = AliHLTPHOSDefinitions::fgkCellEnergyDataType; + bd.fDataType = AliHLTPHOSDefinitions::gkCellEnergyDataType; bd.fSpecification = 0xFFFFFFFF; outputBlocks.push_back( bd ); tSize += mysize; @@ -235,13 +255,13 @@ AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData } - fPhosEventCount++; + fgEventCount++; if(fPrintInfo == kTRUE) { - if(fPhosEventCount%fPrintInfoFrequncy == 0) + if(fgEventCount%fPrintInfoFrequncy == 0) { - cout <<"Analyzing event " << fPhosEventCount << "for Equippment " << fkEquippmentID << endl; + cout <<"Analyzing event " << fgEventCount << "for Equippment " << fEquippmentID << endl; } } size = tSize; @@ -249,10 +269,11 @@ AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData }//end DoEvent -//_________________________________________________________________________________________________ + int AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) { + /// See base class for documentation fSendChannelData = kFALSE; fPrintInfo = kFALSE; Reset(); @@ -261,27 +282,85 @@ AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) fPHOSRawStream->SetOldRCUFormat(kFALSE); int iResult=0; TString argument=""; - iResult = ScanArguments(argc, argv); + Bool_t isSetEquippmentID = kFALSE; + + for(int i=0; i=0; i++) + { + argument=argv[i]; + + if (argument.IsNull()) + { + continue; + } + + if (argument.CompareTo("-equipmentID") == 0) + { + cout << "AliHLTPHOSRawAnalyzerComponent:DoInit argument = -equipmentID " <SetEquipmentID(fEquippmentID); + SetEquippmentID(fEquippmentID); + SetCoordinates(fEquippmentID); + isSetEquippmentID = kTRUE; + } + else + { + iResult= -1; + Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", + "The argument -equippmentID expects a number"); + return iResult; + } + } + + + if (argument.CompareTo("-datatype") == 0) + { + if(i+1 <= argc) + { + argument=argv[i+1]; + if(argument.CompareTo("channeldata") == 0) + { + cout << "AliHLTPHOSRawAnalyzerComponent::DoIni setting sendChannelData = kTRUE "<< endl; + fSendChannelData = kTRUE; + } + } + } + + if (argument.CompareTo("-printinfo") == 0) + { + if(i+1 <= argc) + { + argument=argv[i+1]; + fPrintInfoFrequncy = atoi(argv[i+1]); + fPrintInfo = kTRUE; + cout << "AliHLTPHOSRawAnalyzerComponent::DoIni setting printinfo = kTRUE, with update frequency every "<< fPrintInfoFrequncy << "th event" <"); iResult = -2; } - else - { - fRawMemoryReader->SetEquipmentID(fkEquippmentID); - } - return iResult; + return 0; } -//_________________________________________________________________________________________________ -void -AliHLTPHOSRawAnalyzerComponent::DumpData(int gain) const + +const void +AliHLTPHOSRawAnalyzerComponent::DumpData(int gain) { + //Dumping data to std out for(int mod = 0; mod < N_MODULES; mod ++) { printf("\n *********** MODULE %d ************\n", mod); @@ -299,32 +378,31 @@ AliHLTPHOSRawAnalyzerComponent::DumpData(int gain) const } -//_________________________________________________________________________________________________ -void -AliHLTPHOSRawAnalyzerComponent::DumpChannelData(Double_t *data) const +const void +AliHLTPHOSRawAnalyzerComponent::DumpChannelData(Double_t *data) { - cout << endl; - for(int i=0; i< ALTRO_MAX_SAMPLES; i++) - { - if (data[i] != 0) + cout << endl; + for(int i=0; i< ALTRO_MAX_SAMPLES; i++) { - cout <& list); + virtual void GetInputDataTypes(std::vector >&); virtual AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); - virtual AliHLTComponent* Spawn() = 0; + virtual AliHLTComponent* Spawn() = 0; + virtual int DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector >&); + protected: AliHLTPHOSRawAnalyzer *fAnalyzerPtr; /**& outputBlocks ); void Reset(); void ResetDataPtr(int startindex = 0, int sampleCnt = 0); + static int fgEventCount; /** @@ -23,7 +22,6 @@ using std::endl; ClassImp(AliHLTPHOSRawAnalyzerCrude) -//____________________________________________________________________________ AliHLTPHOSRawAnalyzerCrude::AliHLTPHOSRawAnalyzerCrude(const AliHLTPHOSRawAnalyzerCrude&):AliHLTPHOSRawAnalyzer() { @@ -35,14 +33,13 @@ AliHLTPHOSRawAnalyzerCrude::AliHLTPHOSRawAnalyzerCrude(const AliHLTPHOSRawAnalyz * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in * calculation is of type double. **/ -//____________________________________________________________________________ AliHLTPHOSRawAnalyzerCrude::AliHLTPHOSRawAnalyzerCrude():AliHLTPHOSRawAnalyzer() { } -//____________________________________________________________________________ + AliHLTPHOSRawAnalyzerCrude::~AliHLTPHOSRawAnalyzerCrude() { @@ -60,8 +57,9 @@ AliHLTPHOSRawAnalyzerCrude::~AliHLTPHOSRawAnalyzerCrude() * "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 +* @param tVector the peakfinder vector for timing +* @param aVector the peakfinder vector for amplitude (energy) **/ -//____________________________________________________________________________ void AliHLTPHOSRawAnalyzerCrude::Evaluate(int start, int length) { diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.h b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.h index 986737f84a9..8dad1d5ce75 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.h +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.h @@ -1,11 +1,10 @@ #ifndef ALIHLTPHOSRAWANALYZERCRUDE_H #define ALIHLTPHOSRAWANALYZERCRUDE_H -//#include -//#include "TObject.h" +#include +#include "TObject.h" #include "AliHLTPHOSRawAnalyzer.h" - /* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.cxx index 4bf127a78c4..0d7b3946574 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.cxx @@ -14,38 +14,33 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - #include "AliHLTPHOSRawAnalyzerCrudeComponent.h" #include "AliHLTPHOSRawAnalyzerCrude.h" AliHLTPHOSRawAnalyzerCrudeComponent gAliHLTPHOSRawAnalyzerCrudeComponent; -//___________________________________________________________________________ AliHLTPHOSRawAnalyzerCrudeComponent::AliHLTPHOSRawAnalyzerCrudeComponent() { fAnalyzerPtr = new AliHLTPHOSRawAnalyzerCrude(); } -//___________________________________________________________________________ AliHLTPHOSRawAnalyzerCrudeComponent::~AliHLTPHOSRawAnalyzerCrudeComponent() { } -//___________________________________________________________________________ + AliHLTPHOSRawAnalyzerCrudeComponent::AliHLTPHOSRawAnalyzerCrudeComponent(const AliHLTPHOSRawAnalyzerCrudeComponent & ):AliHLTPHOSRawAnalyzerComponent() { } -//___________________________________________________________________________ const char* AliHLTPHOSRawAnalyzerCrudeComponent::GetComponentID() { return "PhosRawCrude"; } -//___________________________________________________________________________ AliHLTComponent* AliHLTPHOSRawAnalyzerCrudeComponent::Spawn() { diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.h b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.h index e6b7efbcada..cec758f6f6a 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.h +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrudeComponent.h @@ -7,7 +7,6 @@ * See cxx source for full Copyright notice */ - class AliHLTPHOSRawAnalyzerCrudeComponent: public AliHLTPHOSRawAnalyzerComponent { public: diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerKLevel.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzerKLevel.cxx index 9ec1b03b8bc..f5a2366432c 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerKLevel.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerKLevel.cxx @@ -22,10 +22,10 @@ using std::endl; ClassImp(AliHLTPHOSRawAnalyzerKLevel) -//________________________________________________________________________________________________________ -AliHLTPHOSRawAnalyzerKLevel::AliHLTPHOSRawAnalyzerKLevel(const AliHLTPHOSRawAnalyzerKLevel&):AliHLTPHOSRawAnalyzer(), fTKLevel(0) + +AliHLTPHOSRawAnalyzerKLevel::AliHLTPHOSRawAnalyzerKLevel(const AliHLTPHOSRawAnalyzerKLevel&):AliHLTPHOSRawAnalyzer(), tKLevel(0) { - + } @@ -35,14 +35,12 @@ AliHLTPHOSRawAnalyzerKLevel::AliHLTPHOSRawAnalyzerKLevel(const AliHLTPHOSRawAnal * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in * calculation is of type double. **/ -//________________________________________________________________________________________________________ -AliHLTPHOSRawAnalyzerKLevel::AliHLTPHOSRawAnalyzerKLevel():AliHLTPHOSRawAnalyzer(), fTKLevel(0) +AliHLTPHOSRawAnalyzerKLevel::AliHLTPHOSRawAnalyzerKLevel():AliHLTPHOSRawAnalyzer(), tKLevel(0) { cout <<"You cannot invoke the Fitter without arguments"< -//#include "stdio.h" -#//include +#include "stdio.h" +#include #include "AliHLTPHOSRcuCellEnergyDataStruct.h" #include "TFile.h" -using namespace std; - - /************************************************************************* * Class AliHLTPHOSRcuHistogramProducer accumulating histograms * * with amplitudes per PHOS channel * @@ -31,20 +28,16 @@ using namespace std; * and it fills the histograms with amplitudes per channel. * * Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C * **************************************************************************/ - - -AliHLTPHOSRcuHistogramProducer:: AliHLTPHOSRcuHistogramProducer(): fModuleID(0), fRcuX(0), fRcuZ(0) - +AliHLTPHOSRcuHistogramProducer:: AliHLTPHOSRcuHistogramProducer(): fEventCount(0), fEquippmentID(0), fModuleID(0), fRcuX(0), fRcuZ(0) { - //Default constructor cout << "WARNING: You cannot invoke the AliHLTPHOSRcuHistogramProducer without arguments" << endl; cout << "Usage AliHLTPHOSRcuHistogramProducer(ModuleID, X. Z)" << endl; + // Reset(); + // Init(); } -//AliHLTPHOSRcuHistogramProducer::AliHLTPHOSRcuHistogramProducer(AliHLTUInt8_t moduleID, AliHLTUInt8_t rcuX, AliHLTUInt8_t rcuZ) AliHLTPHOSRcuHistogramProducer::AliHLTPHOSRcuHistogramProducer(AliHLTUInt8_t moduleID, AliHLTUInt8_t rcuX, AliHLTUInt8_t rcuZ) { - //Se header file for documentation SetModuleID(moduleID); SetRcuX(rcuX); SetRcuZ(rcuZ); @@ -53,14 +46,13 @@ AliHLTPHOSRcuHistogramProducer::AliHLTPHOSRcuHistogramProducer(AliHLTUInt8_t mod AliHLTPHOSRcuHistogramProducer::~ AliHLTPHOSRcuHistogramProducer() { - //Destructor + } void AliHLTPHOSRcuHistogramProducer::Init() { - //See header file for documentation char tmpHistoName[256]; int geomx; int geomz; @@ -100,40 +92,46 @@ AliHLTPHOSRcuHistogramProducer::Init() } } +int +AliHLTPHOSRcuHistogramProducer::GetEquippmentId() +{ + return fEquippmentID; +} + void AliHLTPHOSRcuHistogramProducer::SetRcuX(AliHLTUInt8_t X) { - //See header file for documentation fRcuX = X; fCellAccEnergy.fRcuX = X; } - void AliHLTPHOSRcuHistogramProducer::SetRcuZ(AliHLTUInt8_t Z) { - //See header file for documentation fRcuZ = Z; fCellAccEnergy.fRcuZ = Z; } - - void AliHLTPHOSRcuHistogramProducer::SetModuleID(AliHLTUInt8_t moduleID) { - //See header file for documentation fModuleID = moduleID; } +void +AliHLTPHOSRcuHistogramProducer::SetEquippmentId(int id) +{ + fEquippmentID = id; +} + + void AliHLTPHOSRcuHistogramProducer::FillEnergy(AliHLTUInt8_t x, AliHLTUInt8_t z, AliHLTUInt8_t gain, float energy) { - //See header file for documentation fCellAccEnergy.fAccumulatedEnergies[x][z][gain] += energy; fCellAccEnergy.fHits[x][z][gain] ++; fEnergyHistogramPtrs[x][z][gain]->Fill(energy); @@ -143,7 +141,6 @@ AliHLTPHOSRcuHistogramProducer::FillEnergy(AliHLTUInt8_t x, AliHLTUInt8_t z, Al void AliHLTPHOSRcuHistogramProducer::FillTime(AliHLTUInt8_t x, AliHLTUInt8_t z, AliHLTUInt8_t gain, float time) { - //See header file for documentation fTimingHistogramPtrs[x][z][gain]->Fill(time); } @@ -154,11 +151,17 @@ AliHLTPHOSRcuHistogramProducer::GetCellAccumulatedEnergies() return fCellAccEnergy ; } +int +AliHLTPHOSRcuHistogramProducer::IncrementEventCounter() +{ + fEventCount ++; + return fEventCount; +} + void AliHLTPHOSRcuHistogramProducer::Reset() { - //See header file for documentation for(int x = 0; x < N_XCOLUMNS_RCU; x ++) { for(int z = 0; z < N_ZROWS_RCU; z ++) @@ -179,11 +182,9 @@ AliHLTPHOSRcuHistogramProducer::Reset() } } - void AliHLTPHOSRcuHistogramProducer::WriteEnergyHistograms() { - //See header file for documentation char tmpFileName[256]; sprintf(tmpFileName,"/home/aliphoshlt/rundir/outdata/calibHisto_%d_%d_%d.root", (int)fModuleID, (int)fRcuX, (int)fRcuZ); TFile *histoFile = new TFile(tmpFileName,"update"); diff --git a/HLT/PHOS/AliHLTPHOSRcuHistogramProducer.h b/HLT/PHOS/AliHLTPHOSRcuHistogramProducer.h index eedfa9e7142..ccbf60510d8 100644 --- a/HLT/PHOS/AliHLTPHOSRcuHistogramProducer.h +++ b/HLT/PHOS/AliHLTPHOSRcuHistogramProducer.h @@ -7,6 +7,7 @@ #include "AliHLTPHOSDefinitions.h" #include "AliHLTPHOSCommonDefs.h" #include "TH1.h" +//#include "AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h" #include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" #define XBIN_LOW 0 @@ -18,9 +19,13 @@ class AliHLTPHOSRcuHistogramProducer public: AliHLTPHOSRcuHistogramProducer(); AliHLTPHOSRcuHistogramProducer(AliHLTUInt8_t moduleID, AliHLTUInt8_t rcuX, AliHLTUInt8_t rcuZ); + virtual ~AliHLTPHOSRcuHistogramProducer(); + int GetEquippmentId(); const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct& GetCellAccumulatedEnergies(); + int IncrementEventCounter(); void Init(); + void SetEquippmentId(int id); void SetRcuX(AliHLTUInt8_t X); void SetRcuZ(AliHLTUInt8_t Z); void SetModuleID(AliHLTUInt8_t moduleID); @@ -29,6 +34,7 @@ class AliHLTPHOSRcuHistogramProducer void Reset(); void WriteEnergyHistograms(); + protected: private: @@ -38,18 +44,22 @@ class AliHLTPHOSRcuHistogramProducer return *this; }; - TH1F *fEnergyHistogramPtrs[N_XCOLUMNS_RCU][N_ZROWS_RCU][N_GAINS]; /** +#include "stdio.h" +#include #include "AliHLTPHOSRcuCellEnergyDataStruct.h" +//#include "AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h" #include "AliHLTPHOSRcuHistogramProducer.h" #include "AliHLTPHOSRcuHistogramProducerComponent.h" -#include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" -//const AliHLTComponentDataType AliHLTPHOSRcuHistogramProducerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array -//const AliHLTComponentDataType AliHLTPHOSRcuHistogramProducerComponent::fgkOutputDataType=kAliHLTVoidDataType; +const AliHLTComponentDataType AliHLTPHOSRcuHistogramProducerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array +const AliHLTComponentDataType AliHLTPHOSRcuHistogramProducerComponent::outputDataType=kAliHLTVoidDataType; AliHLTPHOSRcuHistogramProducerComponent gAliHLTPHOSRcuHistogramProducerComponent; - - +//AliHLTPHOSHistogramProducerComponent gAliHLTPHOSHistogramProducerComponent; /************************************************************************* * Class AliHLTPHOSRcuHistogramProducerComponent accumulating histograms * * with amplitudes per PHOS channel * @@ -35,19 +36,20 @@ AliHLTPHOSRcuHistogramProducerComponent gAliHLTPHOSRcuHistogramProducerComponent * and it fills the histograms with amplitudes per channel. * * Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C * **************************************************************************/ -AliHLTPHOSRcuHistogramProducerComponent:: AliHLTPHOSRcuHistogramProducerComponent():AliHLTPHOSProcessor(), fRcuHistoProducerPtr(0) +AliHLTPHOSRcuHistogramProducerComponent:: AliHLTPHOSRcuHistogramProducerComponent():AliHLTProcessor(), fEventCount(0), fRcuHistoProducerPtr(0) { - //Default constructor + // Reset(); } + AliHLTPHOSRcuHistogramProducerComponent::~ AliHLTPHOSRcuHistogramProducerComponent() { - //Destructor + } -AliHLTPHOSRcuHistogramProducerComponent::AliHLTPHOSRcuHistogramProducerComponent(const AliHLTPHOSRcuHistogramProducerComponent & ) : AliHLTPHOSProcessor(), fRcuHistoProducerPtr(0) +AliHLTPHOSRcuHistogramProducerComponent::AliHLTPHOSRcuHistogramProducerComponent(const AliHLTPHOSRcuHistogramProducerComponent & ) : AliHLTProcessor(), fEventCount(0), fRcuHistoProducerPtr(0) { } @@ -56,26 +58,31 @@ AliHLTPHOSRcuHistogramProducerComponent::AliHLTPHOSRcuHistogramProducerComponent int AliHLTPHOSRcuHistogramProducerComponent::Deinit() { - //See html documentation of base class cout << "AliHLTPHOSRcuHistogramProducerComponent::Deinit()" << endl; fRcuHistoProducerPtr->WriteEnergyHistograms(); return 0; } +int +AliHLTPHOSRcuHistogramProducerComponent::DoDeinit() +{ + Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRcuHistogramProducer DoDeinit"); + return 0; +} + + const char* AliHLTPHOSRcuHistogramProducerComponent::GetComponentID() { - //See html documentation of base class return "RcuHistogramProducer"; } void -AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector& list) + AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector& list) { - //See html documentation of base class - const AliHLTComponentDataType* pType=fgkInputDataTypes; + const AliHLTComponentDataType* pType=inputDataTypes; while (pType->fID!=0) { list.push_back(*pType); @@ -87,15 +94,13 @@ AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector& outputBlocks ) { - //See html documentation of base class unsigned long ndx = 0; UInt_t offset = 0; UInt_t mysize = 0; @@ -113,6 +117,9 @@ int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEven const AliHLTComponentBlockData* iter = NULL; AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr; AliHLTUInt8_t* outBPtr; + + // outBPtr = outputPtr; + // fOutPtr = (AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)outBPtr; int tmpCnt; for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) @@ -158,7 +165,7 @@ int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEven FillBlockData( bd ); bd.fOffset = offset; bd.fSize = mysize; - bd.fDataType = AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType; + bd.fDataType = AliHLTPHOSDefinitions::gkCellAccumulatedEnergyDataType; bd.fSpecification = 0xFFFFFFFF; outputBlocks.push_back( bd ); tSize += mysize; @@ -172,38 +179,139 @@ int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEven return EMSGSIZE; } - fPhosEventCount++; + fEventCount++; return 0; - }//end DoEvent int AliHLTPHOSRcuHistogramProducerComponent::DoInit( int argc, const char** argv ) { - //See html documentation of base class - fPrintInfo = kFALSE; int iResult=0; TString argument=""; - iResult = ScanArguments(argc, argv); + // fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer(); + AliHLTUInt8_t tmpRcuX; + AliHLTUInt8_t tmpRcuZ; + AliHLTUInt8_t tmpModuleID; + Bool_t isSetEquippmentID = kFALSE; + + for(int i=0; i=0; i++) + { + argument=argv[i]; + + if (argument.IsNull()) + { + continue; + } + if (argument.CompareTo("-equipmentID") == 0) + { + if(i+1 <= argc) + { + fEquippmentID = atoi(argv[i+1]); + isSetEquippmentID = kTRUE; + } + else + { + iResult= -1; + Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", + "The argument -equippmentID expects a number"); + return iResult; + } + } + + int rcuIndex = (fEquippmentID - 1792)%N_RCUS_PER_MODULE; + // fModuleID = (fEquippmentID -1792 -rcuIndex)/N_RCUS_PER_MODULE; + tmpModuleID = ((fEquippmentID -1792 -rcuIndex)/N_RCUS_PER_MODULE); + SetModuleID(tmpModuleID); + + if(rcuIndex == 0) + { + tmpRcuX = 0; + tmpRcuZ = 0; + } + + if(rcuIndex == 1) + { + tmpRcuX = 0; + tmpRcuZ = 1; + } + + if(rcuIndex == 2) + { + tmpRcuX = 1; + tmpRcuZ = 0; + } + + if(rcuIndex == 3) + { + tmpRcuX = 1; + tmpRcuZ = 1; + } - if(fIsSetEquippmentID == kFALSE) + SetRcuX(tmpRcuX); + SetRcuZ(tmpRcuZ); + cout <<"********InitInfo************"<< endl; + cout <<"AliHLTPHOSRcuHistogramProducerComponent::SetCoordinate"<< endl; + cout <<"Equpippment ID =\t"<< fEquippmentID <"); - iResult = -2; + Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", + "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID "); + iResult = -2; } - fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer( fModuleID, fRcuX, fRcuZ); - return iResult; + fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer( tmpModuleID, tmpRcuX, tmpRcuZ); + + + return iResult; +} + + +void +AliHLTPHOSRcuHistogramProducerComponent::SetRcuX(AliHLTUInt8_t X) +{ + fRcuX = X; +} + + +void +AliHLTPHOSRcuHistogramProducerComponent::SetRcuZ(AliHLTUInt8_t Z) +{ + fRcuZ = Z; +} + + +void +AliHLTPHOSRcuHistogramProducerComponent::SetModuleID(AliHLTUInt8_t moduleID) +{ + fModuleID = moduleID; +} + + +void +AliHLTPHOSRcuHistogramProducerComponent::SetEquippmentId(int id) +{ + fEquippmentID = id; + fRcuHistoProducerPtr->SetEquippmentId(id); +} + + +int +AliHLTPHOSRcuHistogramProducerComponent::GetEquippmentId() +{ + return fEquippmentID; } AliHLTComponent* AliHLTPHOSRcuHistogramProducerComponent::Spawn() { - //See html documentation of base class return new AliHLTPHOSRcuHistogramProducerComponent; } diff --git a/HLT/PHOS/AliHLTPHOSRcuHistogramProducerComponent.h b/HLT/PHOS/AliHLTPHOSRcuHistogramProducerComponent.h index e2c7306d548..3efba03f6ea 100644 --- a/HLT/PHOS/AliHLTPHOSRcuHistogramProducerComponent.h +++ b/HLT/PHOS/AliHLTPHOSRcuHistogramProducerComponent.h @@ -4,31 +4,37 @@ /* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -#include "AliHLTPHOSProcessor.h" +#include "AliHLTProcessor.h" #include "AliHLTPHOSDefinitions.h" #include "AliHLTPHOSCommonDefs.h" -//#include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" +//#include "AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h" +#include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" #include "Rtypes.h" - class AliHLTPHOSRcuHistogramProducer; -class AliHLTPHOSRcuCellAccumulatedEnergyDataStruct; -class AliHLTPHOSRcuHistogramProducerComponent:public AliHLTPHOSProcessor +class AliHLTPHOSRcuHistogramProducerComponent:public AliHLTProcessor { public: AliHLTPHOSRcuHistogramProducerComponent(); virtual ~AliHLTPHOSRcuHistogramProducerComponent(); virtual int DoInit( int argc, const char** argv ); virtual int Deinit(); - virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, - AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, vector& outputBlocks ); - virtual void GetInputDataTypes( std::vector &); + virtual int DoDeinit(); + virtual int DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*, AliHLTComponentTriggerData&, AliHLTUInt8_t*, + AliHLTUInt32_t&, std::vector >&); + virtual void GetInputDataTypes(std::vector >&); virtual AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); virtual AliHLTComponent* Spawn(); + virtual const char* GetComponentID(); + int GetEquippmentId(); + void SetRcuX(AliHLTUInt8_t X); + void SetRcuZ(AliHLTUInt8_t Z); + void SetModuleID(AliHLTUInt8_t moduleID); + void SetEquippmentId(int id); + private: AliHLTPHOSRcuHistogramProducerComponent(const AliHLTPHOSRcuHistogramProducerComponent & ); @@ -36,11 +42,20 @@ class AliHLTPHOSRcuHistogramProducerComponent:public AliHLTPHOSProcessor { return *this; }; + int fEventCount; + AliHLTUInt8_t fRcuX; + AliHLTUInt8_t fRcuZ; + AliHLTUInt8_t fModuleID; + AliHLTPHOSRcuHistogramProducer* fRcuHistoProducerPtr; + AliHLTPHOSRcuCellAccumulatedEnergyDataStruct* fOutPtr; + + // AliHLTPHOSRcuCellAccumulatedEnergyDataStruct* fInnPtr; + // AliHLTPHOSRcuCellAccumulatedEnergyDataStruct& fInnPtr; + + static const AliHLTComponentDataType inputDataTypes[]; + static const AliHLTComponentDataType outputDataType; - AliHLTPHOSRcuHistogramProducer* fRcuHistoProducerPtr; /** * - * * - * 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. * - **************************************************************************/ - -struct AliHLTPHOSRecPointDataStruct -{ - AliHLTUInt8_t fPHOSModule; - AliHLTUInt8_t fMultiplicity; - AliHLTUInt8_t fCoordinatesPtr[2]; - Float_t fX; - Float_t fZ; - Float_t* fEnergiesListPtr; -}; - -#endif diff --git a/HLT/PHOS/AliHLTPHOSRecPointListDataStruct.h b/HLT/PHOS/AliHLTPHOSRecPointListDataStruct.h deleted file mode 100644 index d20f9426278..00000000000 --- a/HLT/PHOS/AliHLTPHOSRecPointListDataStruct.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef ALIHLTPHOSRECPOINTLISTDATASTRUCT -#define ALIHLTPHOSRECPOINTLISTDATASTRUCT - -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Øystein Djuvsland * - * * - * 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. * - **************************************************************************/ - -struct AliHLTPHOSRecPointListDataStruct -{ - int fX; - int fZ; - int fModule; -}; - -#endif diff --git a/HLT/PHOS/Makefile.am b/HLT/PHOS/Makefile.am index 0a6ddb346b2..bea0973b42f 100644 --- a/HLT/PHOS/Makefile.am +++ b/HLT/PHOS/Makefile.am @@ -6,7 +6,6 @@ MODULE = AliHLTPHOS EXTRA_DIST = AliHLTPHOSLinkDef.h AM_CPPFLAGS = @ALIROOT_CPPFLAGS@ \ - -I@ALICE_ROOT@/PHOS \ -I$(top_srcdir)/BASE \ -I$(top_srcdir)/BASE/util @@ -34,18 +33,6 @@ libAliHLTPHOS_la_SOURCES = AliHLTPHOSPulseGenerator.cxx \ AliHLTPHOSHistogramProducerComponent.cxx \ AliHLTPHOSRcuHistogramProducer.cxx \ AliHLTPHOSRcuHistogramProducerComponent.cxx \ - AliHLTPHOSDDLDecoderComponent.cxx \ - AliHLTPHOSDataCorruptor.cxx \ - AliHLTPHOSDataQualityMonitor.cxx \ - AliHLTPHOSRcuDataQualityMonitorComponent.cxx \ - AliHLTPHOSProcessor.cxx \ - AliHLTPHOSClusterizer.cxx \ - AliHLTPHOSClusterizerComponent.cxx \ - AliHLTPHOSPhysicsAnalyzerSpectrum.cxx \ - AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx \ - AliHLTPHOSPhysicsAnalyzer.cxx \ - AliHLTPHOSPhysicsDefinitions.cxx \ - AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx PeakFinderTest.cxx # class header files, the link definition for the root dictionary @@ -68,20 +55,7 @@ CLASS_HDRS = AliHLTPHOSPulseGenerator.h \ AliHLTPHOSCellEnergiesFileWriter.h \ AliHLTPHOSRcuHistogramProducer.h \ AliHLTPHOSRcuHistogramProducerComponent.h \ - AliHLTPHOSHistogramProducerComponent.h \ - AliHLTPHOSDDLDecoderComponent.h \ - AliHLTPHOSDataCorruptor.h \ - AliHLTPHOSDataQualityMonitor.h \ - AliHLTPHOSRcuDataQualityMonitorComponent.h \ - AliHLTPHOSProcessor.h \ - AliHLTPHOSClusterizer.h \ - AliHLTPHOSClusterizerComponent.h \ - AliHLTPHOSPhysicsAnalyzerSpectrum.h \ - AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h \ - AliHLTPHOSPhysicsAnalyzer.h \ - AliHLTPHOSPhysicsDefinitions.h \ - AliHLTPHOSPhysicsAnalyzerPeakFitter.h - + AliHLTPHOSHistogramProducerComponent.h pkginclude_HEADERS = $(CLASS_HDRS) \ AliHLTPHOSCommonDefs.h \ @@ -93,13 +67,8 @@ pkginclude_HEADERS = $(CLASS_HDRS) \ AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h \ AliHLTPHOSModuleCellAverageEnergyDataStruct.h \ AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h \ - AliHLTPHOSRcuCellAverageEnergyDataStruct.h \ - AliHLTPHOSRcuChannelDataStruct.h \ - AliHLTPHOSValidChannelDataStruct.h - AliHLTPHOSClusterDataStruct.h \ - AliHLTPHOSRecPointDataStruct.h \ - AliHLTPHOSPhysicsDefinitions.h \ - AliHLTPHOSRecPointListDataStruct.h + AliHLTPHOSRcuCellAverageEnergyDataStruct.h + # version info and linking flags for the library libAliHLTPHOS_la_LIBADD = $(top_builddir)/BASE/util/libAliHLTUtil.la @@ -107,10 +76,6 @@ libAliHLTPHOS_la_LDFLAGS = -L@ROOTLIBDIR@ \ @ROOTLIBS@ \ @ALIROOT_LDFLAGS@ \ @ALIROOT_LIBS@ \ - -lRAWDatasim \ - -lPHOSbase \ - -lPHOSsim \ - -lPHOSrec \ -version-info 0:0:0 # automatic generation of data and time of library build diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.cxx b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.cxx index b74627806b9..bf9bb99e734 100644 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.cxx +++ b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.cxx @@ -1,3 +1,19 @@ +#include "AliHLTPHOSOnlineDisplay.h" +#include "AliHLTDataTypes.h" +#include "AliHLTPHOSRcuCellEnergyDataStruct.h" +#include +#include "stdio.h" +#include +#include +#include +#include "TH2.h" +#include "TCanvas.h" +//#include "AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h" +#include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" +#include "AliHLTPHOSCommonDefs.h" + +//#include "TGMatrixLayout.h" + /************************************************************************** * This file is property of and copyright by the Experimental Nuclear * * Physics Group, Dep. of Physics * @@ -22,68 +38,111 @@ # include # include "TStyle.h" #endif - -#include "AliHLTPHOSOnlineDisplay.h" -#include "AliHLTDataTypes.h" -#include "AliHLTPHOSRcuCellEnergyDataStruct.h" -#include -#include "stdio.h" -#include -#include -#include -#include "TH2.h" -#include "TCanvas.h" -#include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" -#include "AliHLTPHOSCommonDefs.h" #include -#include "AliHLTPHOSOnlineDisplayEventTab.h" -#include "AliHLTPHOSOnlineDisplayCalibTab.h" - -AliHLTPHOSOnlineDisplayEventTab* AliHLTPHOSOnlineDisplay::fgEventTabPtr = 0; -AliHLTPHOSOnlineDisplayCalibTab* AliHLTPHOSOnlineDisplay::fgCalibTabPtr = 0; -AliHLTPHOSOnlineDisplayRawTab* AliHLTPHOSOnlineDisplay::fgRawTabPtr = 0; -AliHLTPHOSOnlineDisplay* AliHLTPHOSOnlineDisplay::fgInstancePtr = 0; /**SetMaximum( MAX_BIN_VALUE); + fgLegoPlotHGPtr->Reset(); + + fgLegoPlotLGPtr = new TH2D("Homer","HLT: #pi^{0} 5 - 30Gev LG, Low gain", + N_XCOLUMNS_MOD* N_MODULES , 0, N_XCOLUMNS_MOD* N_MODULES, + N_ZROWS_MOD, 0, N_ZROWS_MOD); + fgLegoPlotLGPtr->SetMaximum( MAX_BIN_VALUE); + fgLegoPlotLGPtr->Reset(); + + for(int gain = 0; gain< N_GAINS; gain ++) + { + sprintf(tmpHistoName, "HLT gain %d", gain); + fgCalibHistPtr[gain] = new TH2D(tmpHistoName, tmpHistoName, + N_XCOLUMNS_MOD*N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES , + N_ZROWS_MOD, 0, N_ZROWS_MOD); + fgCalibHistPtr[gain]->Reset(); + + sprintf(tmpHistoName, "Calibration Data HLT: #pi^{0} 5 - 30GeV gain %d", gain); + fgHitsHistPtr[gain] = new TH2I(tmpHistoName, tmpHistoName, + N_XCOLUMNS_MOD* N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES, + N_ZROWS_MOD, 0, N_ZROWS_MOD); + fgHitsHistPtr[gain]->SetMaximum( MAX_BIN_VALUE); + fgHitsHistPtr[gain]->Reset(); + + sprintf(tmpHistoName, "Average Data HLT: #pi^{0} 5 - 30GeV gain %d", gain); + fgAveragePtr[gain] = new TH2D(tmpHistoName,tmpHistoName, + N_XCOLUMNS_MOD* N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES, + N_ZROWS_MOD, 0, N_ZROWS_MOD); + fgAveragePtr[gain]->SetMaximum( MAX_BIN_VALUE); + fgAveragePtr[gain]->Reset(); + } + char tmpChDtaName[256]; + for(int z = 0; z < N_ZROWS_RCU; z ++) + { + for(int x = 0; x < N_XCOLUMNS_RCU; x ++) + { + sprintf(tmpHistoName, "blablaz%d x%d",z, x); + fgChannelDataPlotPtr[z][x] = new TH1D(tmpHistoName, tmpHistoName, 300, 0, 299); + fgChannelDataPlotPtr[z][x]->SetMaximum(MAX_BIN_VALUE); + fgChannelDataPlotPtr[z][x]->Reset(); + } + } + gStyle->SetPalette(1); fTab = new TGTab(this, 100, 100); TGLayoutHints *fL1 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 2, 2, 15, 1); - fgEventTabPtr = new AliHLTPHOSOnlineDisplayEventTab(fTab, fgHomerReaderPtr, fgHomerReadersPtr, fgNHosts); - fgCalibTabPtr = new AliHLTPHOSOnlineDisplayCalibTab(fTab, fgHomerReaderPtr, fgHomerReadersPtr, fgNHosts); - fgRawTabPtr = new AliHLTPHOSOnlineDisplayRawTab(fTab, fgHomerReaderPtr, fgHomerReadersPtr, fgNHosts); - AddFrame(fTab, fL1); - MapSubwindows(); - Resize(); - SetWindowName("online display"); - MapWindow(); - MoveResize(100,100,1200,1000); -} + TGCompositeFrame *tf = fTab->AddTab("Event display"); + fSubTab1 = new TGTab(tf, 100, 100); + TGCompositeFrame *tf2 = fSubTab1->AddTab("LEGO"); + fSubF1 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + fEc1 = new TRootEmbeddedCanvas("ec1", fSubF1, 100, 100); + fSubF1->AddFrame(fEc1, fL1); + fEc2 = new TRootEmbeddedCanvas("ec2", fSubF1, 100, 100); + fSubF1->AddFrame(fEc2, fL1); + tf2->AddFrame(fSubF1, fL1); + tf2 = fSubTab1->AddTab("SCAT"); + fSubF2 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + tf2->AddFrame(fSubF2, fL1); + fEc3 = new TRootEmbeddedCanvas("ec3", fSubF2, 100, 100); + fSubF2->AddFrame(fEc3, fL1); + fEc4 = new TRootEmbeddedCanvas("ec4", fSubF2, 100, 100); + fSubF2->AddFrame(fEc4, fL1); -int -AliHLTPHOSOnlineDisplay::GetNextEvent() -{ - fgEventTabPtr->GetNextEvent(); -} + tf2 = fSubTab1->AddTab("SURF"); + fSubF3 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + tf2->AddFrame(fSubF3, fL1); + fEc5 = new TRootEmbeddedCanvas("ec5", fSubF3, 100, 100); + fSubF3->AddFrame(fEc5, fL1); + fEc6 = new TRootEmbeddedCanvas("ec6", fSubF3, 100, 100); + fSubF3->AddFrame(fEc6, fL1); + fSubTab1->Resize(); + tf->AddFrame(fSubTab1, fL1); + tf = fTab->AddTab("Calibration data"); + // fF1 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame); + + fSubTab2 = new TGTab(tf, 100, 100); -int -AliHLTPHOSOnlineDisplay::GetNextEventRaw() -{ - fgRawTabPtr->GetNextEvent(); -} + tf2 = fSubTab2->AddTab("Accumulated energy"); + fSubF4 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + fEc7 = new TRootEmbeddedCanvas("ec7", fSubF4, 100, 100); + fSubF4->AddFrame(fEc7, fL1); -int -AliHLTPHOSOnlineDisplay::GetHistogram() -{ - fgCalibTabPtr->GetNextEvent(); + fEc8 = new TRootEmbeddedCanvas("ec8", fSubF4, 100, 100); + fSubF4->AddFrame(fEc8, fL1); + + tf2->AddFrame(fSubF4, fL1); + + tf2 = fSubTab2->AddTab("SCAT (hits)"); + fSubF5 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + tf2->AddFrame(fSubF5, fL1); + fEc9 = new TRootEmbeddedCanvas("ec9", fSubF5, 100, 100); + fSubF5->AddFrame(fEc9, fL1); + fEc10 = new TRootEmbeddedCanvas("ec10", fSubF5, 100, 100); + fSubF5->AddFrame(fEc10, fL1); + + tf2 = fSubTab2->AddTab("SURF"); + fSubF6 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + tf2->AddFrame(fSubF6, fL1); + fEc11 = new TRootEmbeddedCanvas("ec11", fSubF6, 100, 100); + fSubF6->AddFrame(fEc11, fL1); + fEc12 = new TRootEmbeddedCanvas("ec12", fSubF6, 100, 100); + fSubF6->AddFrame(fEc12, fL1); + + tf2 = fSubTab2->AddTab("acummulated energy / hits"); + fSubF7 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + tf2->AddFrame(fSubF7, fL1); + fEc13 = new TRootEmbeddedCanvas("ec13", fSubF7, 100, 100); + fSubF7->AddFrame(fEc13, fL1); + fEc14 = new TRootEmbeddedCanvas("ec14", fSubF7, 100, 100); + fSubF7->AddFrame(fEc14, fL1); + + fSubTab2->Resize(); + tf->AddFrame(fSubTab2, fL1); + + + tf = fTab->AddTab("Raw Data Display"); + + fSubTab3 = new TGTab(tf, 100, 100); + TGLayoutHints *hints = new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0); + + char tmpTabName[256]; + char tmpCanvasName[256]; + sprintf(tmpTabName, "Raw data"); + tf2 = fSubTab3->AddTab(tmpTabName); + + fgChannelDataCompositeFramePtr[0][0] = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); + for(int z = 0; z < 4; z ++) + { + for(int x = 0; x < 4; x ++) + { + hints = new TGLayoutHints(kLHintsNormal, x*100, 0, 0, 0); + sprintf(tmpCanvasName, "name"); + fgChannelDataCanvasPtr[z][x] = new TRootEmbeddedCanvas(tmpCanvasName, fgChannelDataCompositeFramePtr[0][0], 100, 100); + fgChannelDataCompositeFramePtr[0][0]->AddFrame(fgChannelDataCanvasPtr[z][x], hints); + } + } + + tf2->AddFrame(fgChannelDataCompositeFramePtr[0][0],hints); + + fgEventButtPtr = new AliHLTPHOSGetEventButton(fgChannelDataCompositeFramePtr[0][0], "Get Rawdata", 'r'); + + fSubTab3->Resize(); + tf->AddFrame(fSubTab3, fL1); + + + + tf = fTab->AddTab("Tab 4"); + + AddFrame(fTab, fL1); + + fgEventButtPtr = new AliHLTPHOSGetEventButton(fSubF1, "get event", 'e'); + fgEventButtPtr = new AliHLTPHOSGetEventButton(fSubF4, "update histograms", 'h'); + + MapSubwindows(); + Resize(); + SetWindowName("online display"); + MapWindow(); + MoveResize(100,100,1200,1000); } @@ -146,6 +336,7 @@ AliHLTPHOSOnlineDisplay::ScanArguments(int argc, char** argv) } fgPorts = new short unsigned[100]; + Bool_t hostIsSet = kFALSE; Bool_t portIsSet = kFALSE; int iResult=0; @@ -165,6 +356,7 @@ AliHLTPHOSOnlineDisplay::ScanArguments(int argc, char** argv) cout << "setting Synchronize to true" << endl; fgSyncronize = kTRUE; } + if (argument.CompareTo("-acc")==0) { @@ -172,6 +364,7 @@ AliHLTPHOSOnlineDisplay::ScanArguments(int argc, char** argv) fgAccumulate = kTRUE; } + if (argument.CompareTo("-host")==0) { if(i+1 <= argc) @@ -179,7 +372,6 @@ AliHLTPHOSOnlineDisplay::ScanArguments(int argc, char** argv) i++; sprintf(fgHosts[fgNHosts],"%s", argv[i]); fgNHosts ++; - cout <<"fgNHosts set to"<< fgNHosts <Reset(); + } + + if(fgLegoPlotLGPtr !=0) + { + fgLegoPlotLGPtr->Reset(); + } + } + + int ret = 0; + unsigned long ndx; + const AliHLTComponentBlockData* iter = NULL; + Bool_t nextSwitch=kTRUE; + cout << "homerreader connectionstatus =" <GetConnectionStatus() << endl;; + + int nLoops=0; + if(fgSyncronize == kTRUE) + { + nLoops = 1; + } + else + { + nLoops = fgNHosts; + } + + for(int reader = 0; reader < nLoops; reader ++) + { + if(fgSyncronize == kTRUE) + { + CurrentReaderPtr =fgHomerReaderPtr; + } + else + { + CurrentReaderPtr =fgHomerReadersPtr[reader]; + } + ret =CurrentReaderPtr->ReadNextEvent(); + cout << "Event ID =\t " << reader <<" = "<< CurrentReaderPtr->GetEventID() << endl;; + + if( ret ) + { + int ndx = fgHomerReaderPtr->GetErrorConnectionNdx(); + printf( "------------ TRY AGAIN --------------->Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret ); + cout << "HOMER getconncetioNdx status = " << ndx << endl; + return ret; + } + + unsigned long blockCnt = CurrentReaderPtr->GetBlockCnt(); + + for ( unsigned long i = 0; i < blockCnt; i++ ) + { + char tmp1[9], tmp2[5]; + memset( tmp1, 0, 9 ); + memset( tmp2, 0, 5); + void *tmp11 = tmp1; + ULong64_t* tmp12 = (ULong64_t*)tmp11; + *tmp12 =fgHomerReadersPtr[reader]->GetBlockDataType( i ); + void *tmp21 = tmp2; + ULong_t* tmp22 = (ULong_t*)tmp21; + *tmp22 = CurrentReaderPtr->GetBlockDataOrigin( i ); + cout << "Dataype for block: "<< i<<" is: "<< tmp1<FindBlockNdx("RENELLEC","SOHP", 0xFFFFFFFF ); + + while ( blk != ~(unsigned long)0 ) + { + Int_t moduleID; + const AliHLTPHOSRcuCellEnergyDataStruct* cellEnergiesPtr = (const AliHLTPHOSRcuCellEnergyDataStruct*) CurrentReaderPtr->GetBlockData( blk ); + moduleID = cellEnergiesPtr->fModuleID ; + Int_t tmpCount = cellEnergiesPtr->fCnt; + Int_t tmpZ; + Int_t tmpX; + Int_t tmpGain; + + // for(int i= 0; ifValidData[i].fZ; + tmpX = cellEnergiesPtr->fValidData[i].fX; + tmpGain = cellEnergiesPtr->fValidData[i].fGain; + + if(tmpGain == HIGH_GAIN) + { + fgLegoPlotHGPtr->Fill(moduleID*N_XCOLUMNS_MOD + tmpX + N_XCOLUMNS_RCU*cellEnergiesPtr->fRcuX, + tmpZ + N_ZROWS_RCU*cellEnergiesPtr->fRcuZ, cellEnergiesPtr->fValidData[i].fEnergy); + } + + else if(tmpGain == LOW_GAIN) + { + fgLegoPlotLGPtr->Fill(moduleID*N_XCOLUMNS_MOD + tmpX + N_XCOLUMNS_RCU*cellEnergiesPtr->fRcuX, + tmpZ + N_ZROWS_RCU*cellEnergiesPtr->fRcuZ, cellEnergiesPtr->fValidData[i].fEnergy); + } + } + + blk = CurrentReaderPtr->FindBlockNdx("RENELLEC","SOHP", 0xFFFFFFFF, blk+1); + } + } + UpdateDisplay(); + fgEvntCnt ++; +} + +int +AliHLTPHOSOnlineDisplay::GetNextEventRaw() +{ + cout << "AliHLTPHOSOnlineDisplay::GetNextEventRaw():updating RawdataDisplay" << endl; + int ret = 0; + unsigned long ndx; + const AliHLTComponentBlockData* iter = NULL; + for(int reader = 0; reader < fgNHosts; reader ++) + { + ret = fgChannelRawReadersPtr[reader]->ReadNextEvent(); + if( ret ) + { + int ndx = fgChannelRawReadersPtr[reader]->GetErrorConnectionNdx(); + printf( "------------ TRY AGAIN --------------->Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret ); + cout << "HOMER getconncetioNdx status = " << ndx << endl; + return ret; + } + + unsigned long blockCnt = fgChannelRawReadersPtr[reader]->GetBlockCnt(); + cout << "AliHLTPHOSOnlineDisplay::NextEventRaw(): blockCnt = " << blockCnt << endl; + + for ( unsigned long i = 0; i < blockCnt; i++ ) + { + char tmp1[9], tmp2[5]; + memset( tmp1, 0, 9 ); + memset( tmp2, 0, 5); + void *tmp11 = tmp1; + ULong64_t* tmp12 = (ULong64_t*)tmp11; + *tmp12 =fgChannelRawReadersPtr[reader]->GetBlockDataType( i ); + void *tmp21 = tmp2; + ULong_t* tmp22 = (ULong_t*)tmp21; + *tmp22 = fgChannelRawReadersPtr[reader]->GetBlockDataOrigin( i ); + cout << "Dataype is: "<< tmp1<<" "<FindBlockNdx("ATADNAHC","SOHP", 0xeFFFFFFF ); + + while ( blk != ~(unsigned long)0 ) + { + cout << ":GetNextEventRaw(): updating block " << endl; + AliHLTUInt16_t moduleID; + const AliHLTPHOSRcuChannelDataStruct* rcuChannelDataPtr = (const AliHLTPHOSRcuChannelDataStruct*)fgChannelRawReadersPtr[reader]->GetBlockData( blk ); + moduleID = rcuChannelDataPtr->fModuleID ; + int tmpx; + int tmpz; + AliHLTUInt32_t tmpChCnt =0; + AliHLTUInt16_t tmpSampleCnt =0; + + tmpChCnt = rcuChannelDataPtr->fNValidChannels; + cout << "tmpChCnt = " << tmpChCnt << endl; + + for( AliHLTUInt32_t ch =0; ch < tmpChCnt; ch ++) + { + { + tmpz = rcuChannelDataPtr->fValidData[ch].fZ; + tmpx = rcuChannelDataPtr->fValidData[ch].fX; + tmpSampleCnt = rcuChannelDataPtr->fValidData[ch].fNSamples; + + for(AliHLTUInt16_t sample =0; sample fValidData[ch].fGain == 0) + { + fgChannelDataPlotPtr[tmpz][tmpx]->SetBinContent(sample, rcuChannelDataPtr->fValidData[ch].fChannelData[sample]); + // cout << " " << rcuChannelDataPtr->fValidData[ch].fChannelData[sample];; + } + } + cout << endl; + } + } + blk = fgChannelRawReadersPtr[reader]->FindBlockNdx("ATADNAHC","SOHP", 0xeFFFFFFF, blk+1); + } + } + + UpdateChanneRawDataDisplay(); + fgEvntCnt ++; +} + + + +int +AliHLTPHOSOnlineDisplay::GetHistogram() +{ + fgCalibHistPtr[LOW_GAIN]->Reset(); + fgCalibHistPtr[HIGH_GAIN]->Reset(); + + int ret = 0; + unsigned long ndx; + const AliHLTComponentBlockData* iter = NULL; + Bool_t nextSwitch=kTRUE; + + for(int reader = 0; reader < fgNHosts; reader ++) + { + ret =fgCalibReadersPtr[reader]->ReadNextEvent(); ; + if( ret ) + { + int ndx = fgCalibReadersPtr[reader]->GetErrorConnectionNdx(); + printf( "------------ TRY AGAIN --------------->Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret ); + cout << "HOMER getconncetioNdx status = " << ndx << endl; + return ret; + } + + unsigned long blockCnt = fgCalibReadersPtr[reader]->GetBlockCnt(); + cout << "AliHLTPHOSOnlineDisplay::GetHistogram(): blockCnt = " << blockCnt << endl; + + for ( unsigned long i = 0; i < blockCnt; i++ ) + { + char tmp1[9], tmp2[5]; + memset( tmp1, 0, 9 ); + memset( tmp2, 0, 5); + void *tmp11 = tmp1; + ULong64_t* tmp12 = (ULong64_t*)tmp11; + *tmp12 =fgCalibReadersPtr[reader]->GetBlockDataType( i ); + void *tmp21 = tmp2; + ULong_t* tmp22 = (ULong_t*)tmp21; + *tmp22 = fgCalibReadersPtr[reader]->GetBlockDataOrigin( i ); + cout << "Dataype is: "<< tmp1<<" "<FindBlockNdx("UCCARENE","SOHP", 0xFFFFFFFF ); + // int tmpWhileCnt = 0; + + + + while ( blk != ~(unsigned long)0 ) + { + cout << "GetHistogram: updating block " << endl; + AliHLTUInt16_t moduleID; + const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct* accCellEnergiesPtr = (const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)fgCalibReadersPtr[reader]->GetBlockData( blk ); + moduleID = accCellEnergiesPtr->fModuleID ; + // int RcuXOffset = (accCellEnergiesPtr->fRcuX)*N_XCOLUMNS_RCU; + // int RcuZOffset = (accCellEnergiesPtr->fRcuZ)*N_ZROWS_RCU; + cout << "(X,Z) =" << "("<< (int)accCellEnergiesPtr->fRcuX <<" , " << (int)accCellEnergiesPtr->fRcuZ << ") " << endl; + + int tmpx; + int tmpz; + + for(int x = 0; x < N_XCOLUMNS_RCU; x ++) + for(int z = 0; z fRcuX)*N_XCOLUMNS_RCU + x; + tmpz = (accCellEnergiesPtr->fRcuZ)*N_ZROWS_RCU +z; + + fgCalibHistPtr[gain]->Fill(tmpx, tmpz, accCellEnergiesPtr->fAccumulatedEnergies[x][z][gain] ); + fgHitsHistPtr[gain]->Fill(tmpx, tmpz, accCellEnergiesPtr->fHits[x][z][gain] ); + + if(fgHitsHistPtr[gain]->GetBinContent(tmpx, tmpz) > 0) + { + fgAveragePtr[gain]->SetBinContent(tmpx, tmpz, fgCalibHistPtr[gain]->GetBinContent(tmpx, tmpz)/fgHitsHistPtr[gain]->GetBinContent(tmpx, tmpz)); + } + } + } + } + + blk = fgCalibReadersPtr[reader]->FindBlockNdx("UCCARENE","SOHP", 0xFFFFFFFF, blk+1); + // tmpWhileCnt ++; + } + } + + UpdateHistograms(); + fgEvntCnt ++; +} + + +void +AliHLTPHOSOnlineDisplay::UpdateDisplay() +{ + fgCanvasHGPtr = fEc1->GetCanvas(); + fgCanvasHGPtr->cd(); + fgLegoPlotHGPtr->Draw("LEGO2Z"); + fgCanvasHGPtr->Update(); + fgCanvasLGPtr = fEc2->GetCanvas(); + fgCanvasLGPtr->cd(); + fgLegoPlotLGPtr->Draw("LEGO2Z"); + fgCanvasLGPtr->Update(); + + fgCanvasHGPtr = fEc3->GetCanvas(); + fgCanvasHGPtr->cd(); + fgLegoPlotHGPtr->Draw("SCAT"); + fgCanvasHGPtr->Update(); + fgCanvasLGPtr = fEc4->GetCanvas(); + fgCanvasLGPtr->cd(); + fgLegoPlotLGPtr->Draw("SCAT"); + fgCanvasLGPtr->Update(); + + fgCanvasHGPtr = fEc5->GetCanvas(); + fgCanvasHGPtr->cd(); + fgLegoPlotHGPtr->Draw("CONTZ"); + fgCanvasHGPtr->Update(); + fgCanvasLGPtr = fEc6->GetCanvas(); + fgCanvasLGPtr->cd(); + fgLegoPlotLGPtr->Draw("CONTZ"); + fgCanvasLGPtr->Update(); +} + +void +AliHLTPHOSOnlineDisplay::UpdateHistograms() +{ + fgCanvasHGPtr = fEc7->GetCanvas(); + fgCanvasHGPtr->cd(); + fgCalibHistPtr[HIGH_GAIN]->Draw("LEGO2Z"); + fgCanvasHGPtr->Update(); + + fgCanvasLGPtr = fEc8->GetCanvas(); + fgCanvasLGPtr->cd(); + fgCalibHistPtr[LOW_GAIN]->Draw("LEGO2Z"); + fgCanvasLGPtr->Update(); + + fgCanvasHGPtr = fEc9->GetCanvas(); + fgCanvasHGPtr->cd(); + fgHitsHistPtr[HIGH_GAIN]->Draw("SCAT"); + fgCanvasHGPtr->Update(); + + fgCanvasLGPtr = fEc10->GetCanvas(); + fgCanvasLGPtr->cd(); + fgHitsHistPtr[LOW_GAIN]->Draw("SCAT"); + fgCanvasLGPtr->Update(); + + fgCanvasHGPtr = fEc11->GetCanvas(); + fgCanvasHGPtr->cd(); + fgCalibHistPtr[HIGH_GAIN]->Draw("COLZ"); + fgCanvasHGPtr->Update(); + + fgCanvasLGPtr = fEc12->GetCanvas(); + fgCanvasLGPtr->cd(); + fgCalibHistPtr[LOW_GAIN]->Draw("COLZ"); + fgCanvasLGPtr->Update(); + + + fgCanvasLGPtr = fEc13->GetCanvas(); + fgCanvasLGPtr->cd(); + fgAveragePtr[HIGH_GAIN]->Draw("COLZ"); + fgCanvasLGPtr->Update(); + + fgCanvasHGPtr = fEc14->GetCanvas(); + fgCanvasHGPtr->cd(); + fgAveragePtr[LOW_GAIN]->Draw("COLZ"); + fgCanvasHGPtr->Update(); + +} + + +void +AliHLTPHOSOnlineDisplay::UpdateChanneRawDataDisplay() +{ + fgTestCanvasPtr = new TCanvas("TEST", "testcanvas", 1200, 1000); + fgTestCanvasPtr->Divide(N_ZROWS_RCU, N_XCOLUMNS_RCU, 0, 0); + // fgTestCanvasPtr->Divide(N_XCOLUMNS_RCU, N_ZROWS_RCU, 0, 0); + + for(int z = 0; z < N_ZROWS_RCU; z ++) + { + for(int x = 0; x < N_XCOLUMNS_RCU; x ++) + { + fgTestCanvasPtr->cd(x*N_ZROWS_RCU +z + 1); + fgChannelDataPlotPtr[z][x]->Draw(); + } + } + + fgTestCanvasPtr->Update(); + +} + + + + diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.h b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.h index 8c143b7350b..15fff1547db 100644 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.h +++ b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplay.h @@ -17,12 +17,11 @@ #include "TGFrame.h" #include "AliHLTPHOSCommonDefs.h" #include "AliHLTPHOSRcuChannelDataStruct.h" -#include "AliHLTPHOSOnlineDisplayEventTab.h" -#include "AliHLTPHOSOnlineDisplayCalibTab.h" -#include "AliHLTPHOSOnlineDisplayRawTab.h" - -#include "AliHLTPHOSCommonDefs.h" +#define MAX_HOSTS 10 +#define MAX_HOSTNAME_LENGTH 64 +#define DEFAULT_EVENT_PORT 42001 +#define DEFAULT_HISTO_PORT 42002 class TCanvas; class AliHLTPHOSRcuCellEnergyDataStruct; @@ -35,21 +34,53 @@ class AliHLTPHOSOnlineDisplay : public TGMainFrame int GetNextEventRaw(); int GetHistogram(); void InitDisplay(); + void UpdateDisplay(); + void UpdateHistograms(); + void UpdateChanneRawDataDisplay(); void EvaluateAverage(); - int ScanArguments(int argc, char** argv); - static AliHLTPHOSOnlineDisplay* Instance(int argc, char** argv); + static int ScanArguments(int argc, char** argv); + static AliHLTPHOSOnlineDisplay* Instance(); + private: AliHLTPHOSOnlineDisplay(); - AliHLTPHOSOnlineDisplay(int argc, char** argv); - static AliHLTPHOSOnlineDisplayEventTab *fgEventTabPtr; - static AliHLTPHOSOnlineDisplayCalibTab *fgCalibTabPtr; - static AliHLTPHOSOnlineDisplayRawTab *fgRawTabPtr; + static TGCompositeFrame *fFrame1, *fF1, *fF2, *fF3, *fF4, *fF5, *fSubF1, *fSubF2, *fSubF3, *fSubF4, *fSubF5, *fSubF6, *fSubF7,*fSubF8; static TGTab *fTab; + static TGTab *fSubTab1, *fSubTab2, *fSubTab3; + static TGTab *fSubTabModule[N_MODULES]; + static TGTab *fSubSubTabRcu[N_MODULES][N_RCUS_PER_MODULE]; + // static TH1D *fgChannelDataPlotPtr[N_MODULES][N_RCUS_PER_MODULE][N_ZROWS_RCU][N_XCOLUMNS_RCU]; + static TH1D *fgChannelDataPlotPtr[N_ZROWS_RCU][N_XCOLUMNS_RCU]; + // static TRootEmbeddedCanvas *fgChannelDataCanvasPtr[N_MODULES][N_RCUS_PER_MODULE]; + // static TRootEmbeddedCanvas *fgChannelDataCanvasPtr[N_MODULES][N_RCUS_PER_MODULE][N_ZROWS_RCU][N_XCOLUMNS_RCU]; + + static TRootEmbeddedCanvas *fgChannelDataCanvasPtr[N_ZROWS_RCU][N_XCOLUMNS_RCU]; + static TRootEmbeddedCanvas *fTest; + + static TGCompositeFrame *fgChannelDataCompositeFramePtr[N_MODULES][N_RCUS_PER_MODULE]; + + // static TGTab *fSubTab2; + static TRootEmbeddedCanvas *fEc1, *fEc2, *fEc3, *fEc4, *fEc5, *fEc6, *fEc7, *fEc8, *fEc9, *fEc10, *fEc11, *fEc12, *fEc13, *fEc14; + static AliHLTPHOSGetEventButton* fgEventButtPtr; static AliHLTPHOSOnlineDisplay* fgInstancePtr; + static TH2D *fgLegoPlotLGPtr; + static TH2D *fgLegoPlotHGPtr; + static TH2D *fgCalibHistPtr[N_GAINS]; + static TH2I *fgHitsHistPtr[N_GAINS]; + static TH2D *fgAveragePtr[N_GAINS]; + static char *fgDefaultDet; + static char *fgDefaultDataType; + static int fgEvntCnt; + static TCanvas *fgCanvasHGPtr; + static TCanvas *fgCanvasLGPtr; + + static TCanvas *fgTestCanvasPtr; + static unsigned int fgNHosts; static unsigned int fgNPorts; static HOMERReader* fgHomerReaderPtr; static HOMERReader* fgHomerReadersPtr[MAX_HOSTS]; + static HOMERReader* fgCalibReadersPtr[MAX_HOSTS]; + static HOMERReader* fgChannelRawReadersPtr[MAX_HOSTS]; static char *fgHosts[MAX_HOSTS]; static short unsigned *fgPorts; static Bool_t fgAccumulate; diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayCalibTab.cxx b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayCalibTab.cxx deleted file mode 100644 index e1e84e19eb4..00000000000 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayCalibTab.cxx +++ /dev/null @@ -1,231 +0,0 @@ -#include "AliHLTPHOSOnlineDisplayCalibTab.h" -#include -#include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" -#include "AliHLTPHOSGetEventButton.h" - -using namespace std; - -AliHLTPHOSOnlineDisplayCalibTab::AliHLTPHOSOnlineDisplayCalibTab() -{ - cout << "AliHLTPHOSOnlineDisplayCalibTab:ERROR: You cannot create a onlinedisplay Tab without arguments" << endl; -} - -AliHLTPHOSOnlineDisplayCalibTab::AliHLTPHOSOnlineDisplayCalibTab(TGTab *tabPtr, HOMERReader *homerSyncPtr, HOMERReader *homerPtrs[MAX_HOSTS], int nHosts) -{ - for(int i=0; iFindBlockNdx("UCCARENE","SOHP", 0xFFFFFFFF ); - - while ( blk != ~(unsigned long)0 ) - { - cout << "AliHLTPHOSOnlineDisplayCalibTab::ReadBlockDat:GetHistogram: updating block " << endl; - AliHLTUInt16_t moduleID; - const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct* accCellEnergiesPtr = (const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)homerReaderPtr->GetBlockData( blk ); - moduleID = accCellEnergiesPtr->fModuleID ; - cout << "(X,Z) =" << "("<< (int)accCellEnergiesPtr->fRcuX <<" , " << (int)accCellEnergiesPtr->fRcuZ << ") " << endl; - - int tmpx; - int tmpz; - - for(int x = 0; x < N_XCOLUMNS_RCU; x ++) - for(int z = 0; z fRcuX)*N_XCOLUMNS_RCU + x; - tmpz = (accCellEnergiesPtr->fRcuZ)*N_ZROWS_RCU +z; - - fgCalibHistPtr[gain]->Fill(tmpx, tmpz, accCellEnergiesPtr->fAccumulatedEnergies[x][z][gain] ); - fgHitsHistPtr[gain]->Fill(tmpx, tmpz, accCellEnergiesPtr->fHits[x][z][gain] ); - - if(fgHitsHistPtr[gain]->GetBinContent(tmpx, tmpz) > 0) - { - fgAveragePtr[gain]->SetBinContent(tmpx, tmpz, fgCalibHistPtr[gain]->GetBinContent(tmpx, tmpz)/fgHitsHistPtr[gain]->GetBinContent(tmpx, tmpz)); - } - } - } - } - - blk = homerReaderPtr->FindBlockNdx("UCCARENE","SOHP", 0xFFFFFFFF, blk+1); - } -} - - -int -AliHLTPHOSOnlineDisplayCalibTab::GetNextEvent() -{ - ResetDisplay(); - DoGetNextEvent(); - UpdateDisplay(); - fgEvntCnt ++; -} - -void -AliHLTPHOSOnlineDisplayCalibTab::ResetDisplay() -{ - -} - -void -AliHLTPHOSOnlineDisplayCalibTab::InitDisplay(TGTab *tabPtr) -{ - char tmpHistoName[256]; - - fgLegoPlotHGPtr = new TH2D("Homer","HLT: #pi^{0} 5 - 30Gev HG, High gain", - N_XCOLUMNS_MOD*N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES, - N_ZROWS_MOD, 0, N_ZROWS_MOD); - fgLegoPlotHGPtr->SetMaximum( MAX_BIN_VALUE); - fgLegoPlotHGPtr->Reset(); - - fgLegoPlotLGPtr = new TH2D("Homer","HLT: #pi^{0} 5 - 30Gev LG, Low gain", - N_XCOLUMNS_MOD* N_MODULES , 0, N_XCOLUMNS_MOD* N_MODULES, - N_ZROWS_MOD, 0, N_ZROWS_MOD); - fgLegoPlotLGPtr->SetMaximum( MAX_BIN_VALUE); - fgLegoPlotLGPtr->Reset(); - - - TGLayoutHints *fL1 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | - kLHintsExpandY, 2, 2, 15, 1); - - - for(int gain = 0; gain< N_GAINS; gain ++) - { - sprintf(tmpHistoName, "TAB a HLT gain %d", gain); - fgCalibHistPtr[gain] = new TH2D(tmpHistoName, tmpHistoName, - N_XCOLUMNS_MOD*N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES , - N_ZROWS_MOD, 0, N_ZROWS_MOD); - fgCalibHistPtr[gain]->Reset(); - - sprintf(tmpHistoName, "TAB b Calibration Data HLT: #pi^{0} 5 - 30GeV gain %d", gain); - fgHitsHistPtr[gain] = new TH2I(tmpHistoName, tmpHistoName, - N_XCOLUMNS_MOD* N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES, - N_ZROWS_MOD, 0, N_ZROWS_MOD); - fgHitsHistPtr[gain]->SetMaximum( MAX_BIN_VALUE); - fgHitsHistPtr[gain]->Reset(); - - sprintf(tmpHistoName, "TAB c Average Data HLT: #pi^{0} 5 - 30GeV gain %d", gain); - fgAveragePtr[gain] = new TH2D(tmpHistoName,tmpHistoName, - N_XCOLUMNS_MOD* N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES, - N_ZROWS_MOD, 0, N_ZROWS_MOD); - fgAveragePtr[gain]->SetMaximum( MAX_BIN_VALUE); - fgAveragePtr[gain]->Reset(); - } - - - TGCompositeFrame *tf = tabPtr->AddTab("Calibration data zzz"); - - - fSubTab2 = new TGTab(tf, 100, 100); - - TGCompositeFrame *tf2 = fSubTab2->AddTab("Accumulated energy"); - fSubF4 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); - - fEc7 = new TRootEmbeddedCanvas("ec7", fSubF4, 100, 100); - fSubF4->AddFrame(fEc7, fL1); - - fEc8 = new TRootEmbeddedCanvas("ec8", fSubF4, 100, 100); - fSubF4->AddFrame(fEc8, fL1); - - tf2->AddFrame(fSubF4, fL1); - - tf2 = fSubTab2->AddTab("SCAT (hits)"); - fSubF5 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); - tf2->AddFrame(fSubF5, fL1); - fEc9 = new TRootEmbeddedCanvas("ec9", fSubF5, 100, 100); - fSubF5->AddFrame(fEc9, fL1); - fEc10 = new TRootEmbeddedCanvas("ec10", fSubF5, 100, 100); - fSubF5->AddFrame(fEc10, fL1); - - tf2 = fSubTab2->AddTab("SURF"); - fSubF6 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); - tf2->AddFrame(fSubF6, fL1); - fEc11 = new TRootEmbeddedCanvas("ec11", fSubF6, 100, 100); - fSubF6->AddFrame(fEc11, fL1); - fEc12 = new TRootEmbeddedCanvas("ec12", fSubF6, 100, 100); - fSubF6->AddFrame(fEc12, fL1); - - tf2 = fSubTab2->AddTab("acummulated energy / hits"); - fSubF7 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); - tf2->AddFrame(fSubF7, fL1); - fEc13 = new TRootEmbeddedCanvas("ec13", fSubF7, 100, 100); - fSubF7->AddFrame(fEc13, fL1); - fEc14 = new TRootEmbeddedCanvas("ec14", fSubF7, 100, 100); - fSubF7->AddFrame(fEc14, fL1); - - fSubTab2->Resize(); - tf->AddFrame(fSubTab2, fL1); - - fgEventButtPtr = new AliHLTPHOSGetEventButton(fSubF4, "update histograms z", 'h'); -} - - -void -AliHLTPHOSOnlineDisplayCalibTab::UpdateDisplay() -{ - - fgCanvasHGPtr = fEc7->GetCanvas(); - fgCanvasHGPtr->cd(); - - fgCalibHistPtr[HIGH_GAIN]->Draw("LEGO2Z"); - fgCanvasHGPtr->Update(); - fgCanvasLGPtr = fEc8->GetCanvas(); - fgCanvasLGPtr->cd(); - fgCalibHistPtr[LOW_GAIN]->Draw("LEGO2Z"); - fgCanvasLGPtr->Update(); - fgCanvasHGPtr = fEc9->GetCanvas(); - - fgCanvasHGPtr->cd(); - fgHitsHistPtr[HIGH_GAIN]->Draw("SCAT"); - fgCanvasHGPtr->Update(); - fgCanvasLGPtr = fEc10->GetCanvas(); - fgCanvasLGPtr->cd(); - fgHitsHistPtr[LOW_GAIN]->Draw("SCAT"); - fgCanvasLGPtr->Update(); - fgCanvasHGPtr = fEc11->GetCanvas(); - fgCanvasHGPtr->cd(); - - fgCalibHistPtr[HIGH_GAIN]->Draw("COLZ"); - fgCanvasHGPtr->Update(); - fgCanvasLGPtr = fEc12->GetCanvas(); - fgCanvasLGPtr->cd(); - fgCalibHistPtr[LOW_GAIN]->Draw("COLZ"); - fgCanvasLGPtr->Update(); - - - fgCanvasLGPtr = fEc13->GetCanvas(); - fgCanvasLGPtr->cd(); - fgAveragePtr[HIGH_GAIN]->Draw("COLZ"); - fgCanvasLGPtr->Update(); - - fgCanvasHGPtr = fEc14->GetCanvas(); - fgCanvasHGPtr->cd(); - fgAveragePtr[LOW_GAIN]->Draw("COLZ"); - fgCanvasHGPtr->Update(); - -} diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayCalibTab.h b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayCalibTab.h deleted file mode 100644 index 2a0d76fd025..00000000000 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayCalibTab.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef ALIHLTPHOSONLINEDISPLAYCALIBTAB_H -#define ALIHLTPHOSONLINEDISPLAYCALIBTAB_H - -#include "TGTab.h" -#include "AliHLTPHOSOnlineDisplayTab.h" -#include "TH2.h" -#include "AliHLTPHOSCommonDefs.h" -#include -#include -#include "AliHLTDataTypes.h" - -class AliHLTPHOSGetEventButton; -class AliHLTPHOSOnlineDisplayCalibTab : public AliHLTPHOSOnlineDisplayTab -{ - public: - AliHLTPHOSOnlineDisplayCalibTab(); - AliHLTPHOSOnlineDisplayCalibTab(TGTab *tabPtr, HOMERReader *homerSyncPtr, HOMERReader *homerPtrs[MAX_HOSTS], int nHosts); - virtual ~AliHLTPHOSOnlineDisplayCalibTab(); - - void InitDisplay(TGTab *tabPtr); - void UpdateDisplay(); - int GetNextEvent(); - virtual void ReadBlockData(HOMERReader *homeReaderPtr); - void ResetDisplay(); - - TH2D *fgCalibHistPtr[N_GAINS]; - TH2I *fgHitsHistPtr[N_GAINS]; - TH2D *fgAveragePtr[N_GAINS]; - TGTab *fTab; - TRootEmbeddedCanvas *fEc7, *fEc8, *fEc9, *fEc10, *fEc11, *fEc12, *fEc13, *fEc14; - TGTab *fSubTab2; - TGCompositeFrame *fSubF4, *fSubF5, *fSubF6, *fSubF7,*fSubF8; - TCanvas *fgCanvasHGPtr; - TCanvas *fgCanvasLGPtr; - TH2D *fgLegoPlotLGPtr; - TH2D *fgLegoPlotHGPtr; - AliHLTPHOSGetEventButton* fgEventButtPtr; -}; - - -#endif diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayEventTab.cxx b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayEventTab.cxx deleted file mode 100644 index 6b01956f350..00000000000 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayEventTab.cxx +++ /dev/null @@ -1,204 +0,0 @@ -#include "AliHLTPHOSOnlineDisplayEventTab.h" -#include -#include "TGFrame.h" -#include "AliHLTPHOSGetEventButton.h" -#include "AliHLTPHOSCommonDefs.h" -#include "AliHLTDataTypes.h" -#include "HOMERData.h" -#include "HOMERReader.h" -#include "HOMERWriter.h" -#include "AliHLTPHOSRcuCellEnergyDataStruct.h" - - -using namespace std; - - -AliHLTPHOSOnlineDisplayEventTab::AliHLTPHOSOnlineDisplayEventTab() -{ - cout << "ERROR: You cannot create a onlinedisplay Tab without arguments" << endl; -} - - -AliHLTPHOSOnlineDisplayEventTab::AliHLTPHOSOnlineDisplayEventTab(TGTab *tabPtr, HOMERReader *homerSyncPtr, HOMERReader *homerPtrs[MAX_HOSTS], int nHosts) -{ - for(int i=0; iFindBlockNdx("RENELLEC","SOHP", 0xFFFFFFFF ); - - while ( blk != ~(unsigned long)0 ) - { - Int_t moduleID; - const AliHLTPHOSRcuCellEnergyDataStruct* cellEnergiesPtr = (const AliHLTPHOSRcuCellEnergyDataStruct*)homeReaderPtr->GetBlockData( blk ); - moduleID = cellEnergiesPtr->fModuleID ; - Int_t tmpCount = cellEnergiesPtr->fCnt; - Int_t tmpZ; - Int_t tmpX; - Int_t tmpGain; - - for(int i= 0; i <= tmpCount; i++) - { - tmpZ = cellEnergiesPtr->fValidData[i].fZ; - tmpX = cellEnergiesPtr->fValidData[i].fX; - tmpGain = cellEnergiesPtr->fValidData[i].fGain; - - if(tmpGain == HIGH_GAIN) - { - fgLegoPlotHGPtr->Fill(moduleID*N_XCOLUMNS_MOD + tmpX + N_XCOLUMNS_RCU*cellEnergiesPtr->fRcuX, - tmpZ + N_ZROWS_RCU*cellEnergiesPtr->fRcuZ, cellEnergiesPtr->fValidData[i].fEnergy); - } - - else if(tmpGain == LOW_GAIN) - { - fgLegoPlotLGPtr->Fill(moduleID*N_XCOLUMNS_MOD + tmpX + N_XCOLUMNS_RCU*cellEnergiesPtr->fRcuX, - tmpZ + N_ZROWS_RCU*cellEnergiesPtr->fRcuZ, cellEnergiesPtr->fValidData[i].fEnergy); - } - } - - blk = homeReaderPtr->FindBlockNdx("RENELLEC","SOHP", 0xFFFFFFFF, blk+1); - } -} - - -void -AliHLTPHOSOnlineDisplayEventTab::ResetDisplay() -{ - if(fgAccumulate == kFALSE) - { - if(fgLegoPlotHGPtr !=0) - { - fgLegoPlotHGPtr->Reset(); - } - - if(fgLegoPlotLGPtr !=0) - { - fgLegoPlotLGPtr->Reset(); - } - } - } - - -void -AliHLTPHOSOnlineDisplayEventTab::InitDisplay(TGTab *tabPtr) -{ - - - fgLegoPlotHGPtr = new TH2D("Homer a eventTAB","xx HLT: #pi^{0} 5 - 30Gev HG, High gain", - N_XCOLUMNS_MOD*N_MODULES , 0, N_XCOLUMNS_MOD*N_MODULES, - N_ZROWS_MOD, 0, N_ZROWS_MOD); - fgLegoPlotHGPtr->SetMaximum( MAX_BIN_VALUE); - fgLegoPlotHGPtr->Reset(); - - fgLegoPlotLGPtr = new TH2D("Homer b eventTab","x HLT: #pi^{0} 5 - 30Gev LG, Low gain", - N_XCOLUMNS_MOD* N_MODULES , 0, N_XCOLUMNS_MOD* N_MODULES, - N_ZROWS_MOD, 0, N_ZROWS_MOD); - fgLegoPlotLGPtr->SetMaximum( MAX_BIN_VALUE); - fgLegoPlotLGPtr->Reset(); - - TGLayoutHints *fL1 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | - kLHintsExpandY, 2, 2, 15, 1); - - TGCompositeFrame *tf = tabPtr->AddTab("Event display TAB"); - fSubTab1 = new TGTab(tf, 100, 100); - TGCompositeFrame *tf2 = fSubTab1->AddTab("LEGO"); - fSubF1 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); - fEc1 = new TRootEmbeddedCanvas("ec1", fSubF1, 100, 100); - fSubF1->AddFrame(fEc1, fL1); - fEc2 = new TRootEmbeddedCanvas("ec2", fSubF1, 100, 100); - fSubF1->AddFrame(fEc2, fL1); - tf2->AddFrame(fSubF1, fL1); - - tf2 = fSubTab1->AddTab("SCAT"); - fSubF2 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); - tf2->AddFrame(fSubF2, fL1); - fEc3 = new TRootEmbeddedCanvas("ec3", fSubF2, 100, 100); - fSubF2->AddFrame(fEc3, fL1); - fEc4 = new TRootEmbeddedCanvas("ec4", fSubF2, 100, 100); - fSubF2->AddFrame(fEc4, fL1); - - tf2 = fSubTab1->AddTab("SURF"); - fSubF3 = new TGCompositeFrame(tf2, 60, 20, kVerticalFrame); - tf2->AddFrame(fSubF3, fL1); - fEc5 = new TRootEmbeddedCanvas("ec5", fSubF3, 100, 100); - fSubF3->AddFrame(fEc5, fL1); - fEc6 = new TRootEmbeddedCanvas("ec6", fSubF3, 100, 100); - fSubF3->AddFrame(fEc6, fL1); - fSubTab1->Resize(); - tf->AddFrame(fSubTab1, fL1); - - fgEventButtPtr = new AliHLTPHOSGetEventButton(fSubF1, "get event", 'e'); -} - - -void -AliHLTPHOSOnlineDisplayEventTab::UpdateDisplay() -{ - fgCanvasHGPtr = fEc1->GetCanvas(); - fgCanvasHGPtr->cd(); - fgLegoPlotHGPtr->Draw("LEGO2Z"); - fgCanvasHGPtr->Update(); - fgCanvasLGPtr = fEc2->GetCanvas(); - fgCanvasLGPtr->cd(); - fgLegoPlotLGPtr->Draw("LEGO2Z"); - fgCanvasLGPtr->Update(); - - fgCanvasHGPtr = fEc3->GetCanvas(); - fgCanvasHGPtr->cd(); - fgLegoPlotHGPtr->Draw("SCAT"); - fgCanvasHGPtr->Update(); - fgCanvasLGPtr = fEc4->GetCanvas(); - fgCanvasLGPtr->cd(); - fgLegoPlotLGPtr->Draw("SCAT"); - fgCanvasLGPtr->Update(); - - fgCanvasHGPtr = fEc5->GetCanvas(); - fgCanvasHGPtr->cd(); - fgLegoPlotHGPtr->Draw("CONTZ"); - fgCanvasHGPtr->Update(); - fgCanvasLGPtr = fEc6->GetCanvas(); - fgCanvasLGPtr->cd(); - fgLegoPlotLGPtr->Draw("CONTZ"); - fgCanvasLGPtr->Update(); - -} diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayEventTab.h b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayEventTab.h deleted file mode 100644 index 40678f76907..00000000000 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayEventTab.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef ALIHLTPHOSONLINEDISPLAYEVENTTAB_H -#define ALIHLTPHOSONLINEDISPLAYEVENTTAB_H - -#include -#include -#include "AliHLTPHOSOnlineDisplayTab.h" -#include -#include - -class AliHLTPHOSGetEventButton; -class HOMERReader; -class AliHLTPHOSRcuCellEnergyDataStruct; - -class AliHLTPHOSOnlineDisplayEventTab : public AliHLTPHOSOnlineDisplayTab -{ - public: - virtual ~AliHLTPHOSOnlineDisplayEventTab(); - AliHLTPHOSOnlineDisplayEventTab(TGTab *tabPtr, HOMERReader *fgHomerReaderPtr, HOMERReader *fgHomerReadersPtr[MAX_HOSTS], int nHosts); - AliHLTPHOSOnlineDisplayEventTab(); - void UpdateDisplay(); - int GetNextEvent(); - virtual void ReadBlockData(HOMERReader *homeReaderPtr); - void ResetDisplay(); - TGTab *fTab; - TGTab *fSubTab1; - TRootEmbeddedCanvas *fEc1, *fEc2, *fEc3, *fEc4, *fEc5, *fEc6; - TGCompositeFrame *fSubF1, *fSubF2, *fSubF3; - TCanvas *fgCanvasHGPtr; - TCanvas *fgCanvasLGPtr; - TH2D *fgLegoPlotLGPtr; - TH2D *fgLegoPlotHGPtr; - - protected: - Bool_t fgAccumulate; - - private: - AliHLTPHOSGetEventButton* fgEventButtPtr; - void InitDisplay(TGTab *tabPtr); -}; - - -#endif diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayRawTab.cxx b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayRawTab.cxx deleted file mode 100644 index de5dd53635c..00000000000 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayRawTab.cxx +++ /dev/null @@ -1,154 +0,0 @@ -#include "AliHLTPHOSOnlineDisplayRawTab.h" -#include -#include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" -#include "AliHLTPHOSGetEventButton.h" -#include "AliHLTPHOSRcuChannelDataStruct.h" - -using namespace std; - -AliHLTPHOSOnlineDisplayRawTab::AliHLTPHOSOnlineDisplayRawTab() -{ - cout << "AliHLTPHOSOnlineDisplayRawTab:ERROR: You cannot create a onlinedisplay Tab without arguments" << endl; -} - -AliHLTPHOSOnlineDisplayRawTab::AliHLTPHOSOnlineDisplayRawTab(TGTab *tabPtr, HOMERReader *homerSyncPtr, HOMERReader *homerPtrs[MAX_HOSTS], int nHosts) -{ - for(int i=0; iFindBlockNdx("ATADNAHC","SOHP", 0xeFFFFFFF ); - - while ( blk != ~(unsigned long)0 ) - { - cout << "GetNextEventRaw(): updating block " << endl; - AliHLTUInt16_t moduleID; - const AliHLTPHOSRcuChannelDataStruct* rcuChannelDataPtr = (const AliHLTPHOSRcuChannelDataStruct*)homerReaderPtr->GetBlockData( blk ); - moduleID = rcuChannelDataPtr->fModuleID ; - int tmpx; - int tmpz; - AliHLTUInt32_t tmpChCnt =0; - AliHLTUInt16_t tmpSampleCnt =0; - - tmpChCnt = rcuChannelDataPtr->fNValidChannels; - cout << "tmpChCnt = " << tmpChCnt << endl; - - for( AliHLTUInt32_t ch =0; ch < tmpChCnt; ch ++) - { - { - tmpz = rcuChannelDataPtr->fValidData[ch].fZ; - tmpx = rcuChannelDataPtr->fValidData[ch].fX; - tmpSampleCnt = rcuChannelDataPtr->fValidData[ch].fNSamples; - - for(AliHLTUInt16_t sample =0; sample fValidData[ch].fGain == 0) - { - fgChannelDataPlotPtr[tmpz][tmpx]->SetBinContent(sample, rcuChannelDataPtr->fValidData[ch].fChannelData[sample]); - } - } - } - } - blk = homerReaderPtr->FindBlockNdx("ATADNAHC","SOHP", 0xeFFFFFFF, blk+1); - } -} - - -int -AliHLTPHOSOnlineDisplayRawTab::GetNextEvent() -{ - cout << "AliHLTPHOSOnlineDisplayRawTab::GetNextEvent()" << endl; - ResetDisplay(); - DoGetNextEvent(); - UpdateDisplay(); - fgEvntCnt ++; -} - - -void -AliHLTPHOSOnlineDisplayRawTab::ResetDisplay() -{ - -} - - -void -AliHLTPHOSOnlineDisplayRawTab::InitDisplay(TGTab *tabPtr) -{ - char tmpHistoName[256]; - // char tmpHistoName[256]; - char tmpChDtaName[256]; - - for(int z = 0; z < N_ZROWS_RCU; z ++) - { - for(int x = 0; x < N_XCOLUMNS_RCU; x ++) - { - sprintf(tmpHistoName, "blablaz%d x%d",z, x); - fgChannelDataPlotPtr[z][x] = new TH1D(tmpHistoName, tmpHistoName, 300, 0, 299); - fgChannelDataPlotPtr[z][x]->SetMaximum(MAX_BIN_VALUE); - fgChannelDataPlotPtr[z][x]->Reset(); - } - } - - - - TGCompositeFrame *tf = tabPtr->AddTab("Raw Data Dislay"); - - fSubTab3 = new TGTab(tf, 100, 100); - TGLayoutHints *hints = new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0); - char tmpTabName[256]; - char tmpCanvasName[256]; - sprintf(tmpTabName, "Raw data zzz"); - TGCompositeFrame *tf2 = fSubTab3->AddTab(tmpTabName); - fgEventButtPtr = new AliHLTPHOSGetEventButton(tf, "Get Rawdata2xxxxx", 'r'); - AliHLTPHOSGetEventButton* EventButtPtr2 = new AliHLTPHOSGetEventButton(tf, "Get Rawdata", 'r'); - EventButtPtr2->Move(200, 200); - -} - - -void -AliHLTPHOSOnlineDisplayRawTab::UpdateDisplay() -{ - - fgTestCanvasPtr = new TCanvas("TEST", "testcanvas", 1200, 1000); - // fgTestCanvasPtr->Divide(N_ZROWS_RCU, N_XCOLUMNS_RCU, 0, 0); - fgTestCanvasPtr->Divide(N_XCOLUMNS_RCU, N_ZROWS_RCU, 0, 0); - - for(int z = 0; z < N_ZROWS_RCU; z ++) - { - for(int x = 0; x < N_XCOLUMNS_RCU; x ++) - { - // fgTestCanvasPtr->cd(x*N_ZROWS_RCU +z + 1); - fgTestCanvasPtr->cd(z*N_XCOLUMNS_RCU +x + 1); - - fgChannelDataPlotPtr[z][x]->Draw(); - } - } - - fgTestCanvasPtr->Update(); - -} diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayRawTab.h b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayRawTab.h deleted file mode 100644 index d1ad97a7d71..00000000000 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayRawTab.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef ALIHLTPHOSONLINEDISPLAYRAWTAB_H -#define ALIHLTPHOSONLINEDISPLAYRAWTAB_H - -#include "TGTab.h" -#include "AliHLTPHOSOnlineDisplayTab.h" -#include "TH2.h" -#include "AliHLTPHOSCommonDefs.h" -#include -#include -#include "AliHLTDataTypes.h" - -class AliHLTPHOSGetEventButton; -class AliHLTPHOSOnlineDisplayRawTab : public AliHLTPHOSOnlineDisplayTab -{ - public: - AliHLTPHOSOnlineDisplayRawTab(); - AliHLTPHOSOnlineDisplayRawTab(TGTab *tabPtr, HOMERReader *homerSyncPtr, HOMERReader *homerPtrs[MAX_HOSTS], int nHosts); - virtual ~AliHLTPHOSOnlineDisplayRawTab(); - - void InitDisplay(TGTab *tabPtr); - void UpdateDisplay(); - int GetNextEvent(); - virtual void ReadBlockData(HOMERReader *homeReaderPtr); - void ResetDisplay(); - - TH2D *fgRawHistPtr[N_GAINS]; - TH2I *fgHitsHistPtr[N_GAINS]; - TH2D *fgAveragePtr[N_GAINS]; - TGTab *fTab; - TGTab *fSubTab3; - TGCompositeFrame *fFrame1; - TCanvas *fgTestCanvasPtr; - TCanvas *fgCanvasHGPtr; - TCanvas *fgCanvasLGPtr; - TH2D *fgLegoPlotLGPtr; - TH2D *fgLegoPlotHGPtr; - AliHLTPHOSGetEventButton* fgEventButtPtr; - TH1D *fgChannelDataPlotPtr[N_ZROWS_RCU][N_XCOLUMNS_RCU]; -}; - - -#endif diff --git a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayTab.cxx b/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayTab.cxx deleted file mode 100644 index a393da9e792..00000000000 --- a/HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayTab.cxx +++ /dev/null @@ -1,104 +0,0 @@ -#include "AliHLTPHOSOnlineDisplayTab.h" -#include "HOMERReader.h" -#include -#include "AliHLTDataTypes.h" - - -using namespace std; - - -AliHLTPHOSOnlineDisplayTab::AliHLTPHOSOnlineDisplayTab():fgSyncronize(kFALSE) -{ - -} - -AliHLTPHOSOnlineDisplayTab::~AliHLTPHOSOnlineDisplayTab() -{ - -} - - -void -AliHLTPHOSOnlineDisplayTab::PrintBlockInfo(HOMERReader *homeReaderPtr, int i) -{ - char tmp1[9], tmp2[5]; - memset( tmp1, 0, 9 ); - memset( tmp2, 0, 5); - void *tmp11 = tmp1; - ULong64_t* tmp12 = (ULong64_t*)tmp11; - *tmp12 =homeReaderPtr->GetBlockDataType( i ); - void *tmp21 = tmp2; - ULong_t* tmp22 = (ULong_t*)tmp21; - *tmp22 = homeReaderPtr->GetBlockDataOrigin( i ); - cout << "Dataype for block: "<< i<<" is: "<< tmp1<ReadNextEvent(); - if( ret ) - { - int ndx = homeReaderPtr->GetErrorConnectionNdx(); - printf( "------------ TRY AGAIN --------------->Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret ); - cout << "HOMER getconncetioNdx status = " << ndx << endl; - return -1; - } - else - { - unsigned long blockCnt = homeReaderPtr->GetBlockCnt(); - cout << "AliHLTPHOSOnlineDisplayEventTab::GetNextEvent: blockCnt =" << blockCnt < #endif -#include - -using namespace std; int main(int argc, char** argv) { - try - { - TApplication app("app", 0, 0); - AliHLTPHOSOnlineDisplay::Instance(argc, argv); - app.Run(); - } + + // AliHLTPHOSOnlineDisplay* onlineDisplay = new AliHLTPHOSOnlineDisplay("alice3", 42001); + + if(!AliHLTPHOSOnlineDisplay::ScanArguments(argc, argv)) + { + + try + { + TApplication app("app", 0, 0); + // AliHLTPHOSOnlineDisplay* phosDisplayPtr = new AliHLTPHOSOnlineDisplay(); + // AliHLTPHOSOnlineDisplay* phosDisplayPtr = AliHLTPHOSOnlineDisplay::Instance(); + AliHLTPHOSOnlineDisplay::Instance(); + app.Run(); + } + + catch (std::exception& e) + { + // std::cerr << e.what() << std::endl; + return 1; + } + return 0; + } + else + { + return -1; + } - catch (std::exception& e) - { - // std::cerr << e.what() << std::endl; - return 1; - } +} - return 0; -} diff --git a/HLT/TPCLib/AliHLTTPCCATracker.cxx b/HLT/TPCLib/AliHLTTPCCATracker.cxx index 63609c05e51..3f8242e3cb2 100644 --- a/HLT/TPCLib/AliHLTTPCCATracker.cxx +++ b/HLT/TPCLib/AliHLTTPCCATracker.cxx @@ -1,13 +1,8 @@ -// @(#) $Id$ /** \class AliHLTTPCCATracker
 //_____________________________________________________________
 // AliHLTTPCCATracker
-// !
-// !
-// !
-// !
-// !
+//
 //
 // Author: Ivan Kisel
 // Copyright © ALICE HLT Group
@@ -16,32 +11,52 @@
 
 #define WRITETRACKS 1
 
+#include 
+
+
+#include "AliHLTTPCRootTypes.h"
 #include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCLogging.h" 
+#include "AliHLTTPCVertex.h"
+#include "AliHLTTPCConfMapTrack.h"
+#include "AliHLTTPCConfMapPoint.h"
+#include "AliHLTTPCTrackArray.h"
+#include "AliHLTTPCTransform.h"
 #include "AliHLTTPCCATracker.h"
 #include "AliHLTTPCTrackSegmentData.h"
 
-#include "TH1.h"
-#include "TH2.h"
+#include "TApplication.h"
+#include "TStyle.h"
+#include "TCanvas.h"
+#include "TFrame.h"
+#include "TMarker.h"
+#include "TPaveText.h"
+#include "TEllipse.h"
+#include "TText.h"
+#include "TROOT.h"
 
-#include "TFile.h"
-#include "TMath.h"
+#include 
 
 #if __GNUC__ >= 3
 using namespace std;
 #endif
 
-#include "TROOT.h"
+static TList *listHisto;
+static TH1F *h_NClusters;
+static TH2F *h_ClustersXY[10];
 
+static Int_t h_Event;
 
-#include "TCanvas.h"
-#include "TMarker.h"
-#include "TLine.h"
-#include "TStyle.h"
-#include "TApplication.h"
+//#define DRAW
 
-#include "AliHLTTPCConfMapPoint.h"
-#include "AliHLTTPCTrackArray.h"
-#include 
+#ifdef DRAW
+
+static TApplication *myapp;
+static TCanvas *YX, *ZX;
+
+static bool ask = false;
+
+#endif //DRAW
 
 ClassImp(AliHLTTPCCATracker)
 
@@ -52,6 +67,8 @@ AliHLTTPCCATracker::AliHLTTPCCATracker()
   fVertex = NULL;
   fTrack = NULL;
   fHit = NULL;
+  fVolume = NULL;
+  fRow = NULL;
   fBench = (Bool_t)true;
   fVertexConstraint = (Bool_t)true;
   fParamSet[0]=0;
@@ -60,54 +77,18 @@ AliHLTTPCCATracker::AliHLTTPCCATracker()
   fOutputPtr= NULL;
   fOutputNTracks=0;
   fOutputSize=0;
-  fDRAW = 0;
-  fAsk = 0;
-}
-
-
-// ----------------------------------------------------------------------------------
-AliHLTTPCCATracker::AliHLTTPCCATracker(const AliHLTTPCCATracker &x )
-{
-  //Copy constructor
-  fVertex = x.fVertex;
-  fTrack = x.fTrack;
-  fHit = x.fHit;
-  fBench = x.fBench;
-  fVertexConstraint = x.fVertexConstraint;
-  fParamSet[0]=x.fParamSet[0];
-  fParamSet[1]=x.fParamSet[1];
-  //JMT 2006/11/13
-  fOutputPtr= x.fOutputPtr;
-  fOutputNTracks=x.fOutputNTracks;
-  fOutputSize=x.fOutputSize;
-  fDRAW = x.fDRAW;
-  fAsk = x.fAsk;
-}
-
-// ----------------------------------------------------------------------------------
-AliHLTTPCCATracker & AliHLTTPCCATracker::operator=( const AliHLTTPCCATracker &x )
-{
-  //Copy operator
-  fVertex = x.fVertex;
-  fTrack = x.fTrack;
-  fHit = x.fHit;
-  fBench = x.fBench;
-  fVertexConstraint = x.fVertexConstraint;
-  fParamSet[0]=x.fParamSet[0];
-  fParamSet[1]=x.fParamSet[1];
-  //JMT 2006/11/13
-  fOutputPtr= x.fOutputPtr;
-  fOutputNTracks=x.fOutputNTracks;
-  fOutputSize=x.fOutputSize;
-  fDRAW = x.fDRAW;
-  fAsk = x.fAsk;
-  return *this;
 }
 
 // ----------------------------------------------------------------------------------
 AliHLTTPCCATracker::~AliHLTTPCCATracker()
 {
   // Destructor.
+  if(fVolume) {
+    delete [] fVolume;
+  }
+  if(fRow) {
+    delete [] fRow;
+  }
   if(fHit) {
     delete [] fHit;
   }
@@ -125,64 +106,65 @@ AliHLTTPCCATracker::~AliHLTTPCCATracker()
 // ----------------------------------------------------------------------------------
 void AliHLTTPCCATracker::CACreateHistos()
 {
+
     // IK histogramming
-    static bool firstCall = kTRUE;
-    if (firstCall){
-      firstCall = kFALSE;
+    static bool first_call = true;
+    if (first_call){
+      first_call = false;
 
-      fHistEvent = 0;
+      h_Event = 0;
 
       TDirectory *curdir = gDirectory;
       TDirectory *histodir = gROOT->mkdir("histodir");
       histodir->cd();
       
-      fHistNClusters  = new TH1F("h_NClusters", "Number of clusters in event", 100, 0.0, 1000.0);
-
-      fHistClustersXY[0] = new TH2F("h_ClustersXY_0", "Clusters in XY plane Ev 0", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[1] = new TH2F("h_ClustersXY_1", "Clusters in XY plane Ev 1", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[2] = new TH2F("h_ClustersXY_2", "Clusters in XY plane Ev 2", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[3] = new TH2F("h_ClustersXY_3", "Clusters in XY plane Ev 3", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[4] = new TH2F("h_ClustersXY_4", "Clusters in XY plane Ev 4", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[5] = new TH2F("h_ClustersXY_5", "Clusters in XY plane Ev 5", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[6] = new TH2F("h_ClustersXY_6", "Clusters in XY plane Ev 6", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[7] = new TH2F("h_ClustersXY_7", "Clusters in XY plane Ev 7", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[8] = new TH2F("h_ClustersXY_8", "Clusters in XY plane Ev 8", 100, 50.0, 300.0, 100, -100.0, 100.0);
-      fHistClustersXY[9] = new TH2F("h_ClustersXY_9", "Clusters in XY plane Ev 9", 100, 50.0, 300.0, 100, -100.0, 100.0);
-
-      fListHisto = gDirectory->GetList();
+      h_NClusters  = new TH1F("h_NClusters", "Number of clusters in event", 100, 0.0, 1000.0);
+
+      h_ClustersXY[0] = new TH2F("h_ClustersXY_0", "Clusters in XY plane Ev 0", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[1] = new TH2F("h_ClustersXY_1", "Clusters in XY plane Ev 1", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[2] = new TH2F("h_ClustersXY_2", "Clusters in XY plane Ev 2", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[3] = new TH2F("h_ClustersXY_3", "Clusters in XY plane Ev 3", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[4] = new TH2F("h_ClustersXY_4", "Clusters in XY plane Ev 4", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[5] = new TH2F("h_ClustersXY_5", "Clusters in XY plane Ev 5", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[6] = new TH2F("h_ClustersXY_6", "Clusters in XY plane Ev 6", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[7] = new TH2F("h_ClustersXY_7", "Clusters in XY plane Ev 7", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[8] = new TH2F("h_ClustersXY_8", "Clusters in XY plane Ev 8", 100, 50.0, 300.0, 100, -100.0, 100.0);
+      h_ClustersXY[9] = new TH2F("h_ClustersXY_9", "Clusters in XY plane Ev 9", 100, 50.0, 300.0, 100, -100.0, 100.0);
+
+      listHisto = gDirectory->GetList();
       curdir->cd();
 
-      if( fDRAW ){
+#ifdef DRAW
 
-      fMyapp = new TApplication("myapp", 0, 0);
+      myapp = new TApplication("myapp", 0, 0);
       
       gStyle->SetCanvasBorderMode(0);
       gStyle->SetCanvasBorderSize(1);
       gStyle->SetCanvasColor(0);
 
 
-      fYX = new TCanvas ("YX", "YX (Pad-Row) window", -10, 0, 680, 400);
-      fYX->Range(-50.0, 80.0, 50.0, 250.0);
-      fYX->Clear();
-      fYX->Draw();
+      YX = new TCanvas ("YX", "YX (Pad-Row) window", -10, 0, 680, 400);
+      YX->Range(-50.0, 80.0, 50.0, 250.0);
+      YX->Clear();
+      YX->Draw();
 
-      fZX = new TCanvas ("ZX", "ZX window", -700, 0, 680, 400);
-      fZX->Range(-250.0, 80.0, 250.0, 250.0);
-      fZX->Clear();
-      fZX->Draw();
+      ZX = new TCanvas ("ZX", "ZX window", -700, 0, 680, 400);
+      ZX->Range(-250.0, 80.0, 250.0, 250.0);
+      ZX->Clear();
+      ZX->Draw();
 
 #ifdef XXX
       char symbol;
-      if (fAsk){
+      if (ask){
         do{
           std::cin.get(symbol);
           if (symbol == 'r')
-            fAsk = 0;
+            ask = false;
         } while (symbol != '\n');
       }
 #endif //XXX
 
-} //fDRAW
+#endif //DRAW
 
     } 
 }
@@ -193,7 +175,7 @@ void AliHLTTPCCATracker::CAWriteHistos()
     // IK Open the output file and write histogramms
 
     TFile *outfile = new TFile("ConfMapper_histo.root", "RECREATE");
-    TIter hiter(fListHisto);
+    TIter hiter(listHisto);
     while (TObject *obj = hiter()) obj->Write();
     outfile->Close();
 }
@@ -205,8 +187,8 @@ Bool_t AliHLTTPCCATracker::ReadHits(UInt_t count, AliHLTTPCSpacePointData* hits
   //read hits
   Int_t nhit=(Int_t)count; 
 
-  vector fVecHits; 
-  fVecHits.clear();
+  vector vec_hits; 
+  vec_hits.clear();
 
   for (Int_t i=0;ifX;
-      hit.fY = pSP->fY;
-      hit.fZ = pSP->fZ;
+      CAHit hit;
+      hit.x = pSP->fX;
+      hit.y = pSP->fY;
+      hit.z = pSP->fZ;
 
-      hit.fErrx = 1.0;//pSP->fSigmaY2;
+      hit.errx = 1.0;//pSP->fSigmaY2;
       if (patch <= 3)
-	hit.fErry = 10.0;//1.0;//pSP->fSigmaY2;
+	hit.erry = 10.0;//1.0;//pSP->fSigmaY2;
       else
-	hit.fErry = 10.0;//pSP->fSigmaY2;
-      hit.fErrz = 1.0;//pSP->fSigmaZ2;
+	hit.erry = 10.0;//pSP->fSigmaY2;
+      hit.errz = 1.0;//pSP->fSigmaZ2;
 
-      hit.fIndex = i;
-      hit.fCounter = 0;
+      hit.index = i;
+      hit.counter = 0;
 
-      fVecHits.push_back(hit);
+      vec_hits.push_back(hit);
     }
 
-  if( fDRAW ){
+#ifdef DRAW
 
   TMarker *mhit = new TMarker(0.0, 0.0, 6);
   mhit->SetMarkerColor(kBlue);
 
-  for (Int_t i = fPatchFirstHitInd; i <= fPatchLastHitInd; i++)
+  for (Int_t i = patch_first_hit_ind; i <= patch_last_hit_ind; i++)
     {
-      fYX->cd();
-      mhit->DrawMarker(fVecHits[i].fY, fVecHits[i].fX);
+      YX->cd();
+      mhit->DrawMarker(vec_hits[i].y, vec_hits[i].x);
       
-      fZX->cd();
-      mhit->DrawMarker(fVecHits[i].fZ, fVecHits[i].fX);
+      ZX->cd();
+      mhit->DrawMarker(vec_hits[i].z, vec_hits[i].x);
     }
 
   delete mhit;
 
-  fYX->cd(); fYX->Update(); fYX->Draw(); 
-  fZX->cd(); fZX->Update(); fZX->Draw();     
+  YX->cd(); YX->Update(); YX->Draw(); 
+  ZX->cd(); ZX->Update(); ZX->Draw();     
 
-  } //fDRAW
+#endif //DRAW
 
   return;
 }
@@ -288,75 +269,74 @@ void AliHLTTPCCATracker::CAReadPatchHits(Int_t patch, UInt_t count, AliHLTTPCSpa
 // ----------------------------------------------------------------------------------
 void AliHLTTPCCATracker::CAFindPatchTracks(Int_t patch)
 {
-//!
 
-//if(fDRAW){
+#ifdef DRAW
 
-TLine *line = new TLine();
-line->SetLineColor(kBlack);
+  TLine *line = new TLine();
+  line->SetLineColor(kBlack);
 
-//} //fDRAW
+#endif //DRAW
 
   Double_t dist01, dist12, dist02, mindist, chi2, minchi2;
-  AliHLTTPCCAHit *ph0, *ph1, *ph2, *phbest, *next;
+  CAHit *ph0, *ph1, *ph2, *phbest, *next;
 
-  Double_t x, y, z, ty, tz, fCovy, fCovty, fCovyty, fCovz, fCovtz, fCovztz, ye, ze, dx, dy, dz, sy2, sz2; 
+  Double_t x, y, z, ty, tz, cov_y, cov_ty, cov_yty, cov_z, cov_tz, cov_ztz, ye, ze, dx, dy, dz, sy2, sz2; 
 
-  for (Int_t i1 = fPatchFirstHitInd; i1 < fPatchLastHitInd; i1++) // fCounter != 0){ // the previous hit exists
-	x = ph1->fX;
-	y = ph1->fY;
-	z = ph1->fZ;
+      if (ph1->counter != 0){ // the previous hit exists
+	x = ph1->x;
+	y = ph1->y;
+	z = ph1->z;
 
-	dx = (ph1->fX-ph0->fX); // assume different x !!!
-	if (TMath::Abs(dx) < 0.0001) dx = 0.0001;
-	ty = (ph1->fY-ph0->fY)/dx;
-	tz = (ph1->fZ-ph0->fZ)/dx;
+	dx = (ph1->x-ph0->x); // assume different x !!!
+	if (abs(dx) < 0.0001) dx = 0.0001;
+	ty = (ph1->y-ph0->y)/dx;
+	tz = (ph1->z-ph0->z)/dx;
 
-	fCovy   = ph1->fErry*ph1->fErry;
-	fCovty  = (ph0->fErry*ph0->fErry + ph1->fErry*ph1->fErry)/(dx*dx);
-	fCovyty = (ph1->fErry*ph1->fErry)/dx;
+	cov_y   = ph1->erry*ph1->erry;
+	cov_ty  = (ph0->erry*ph0->erry + ph1->erry*ph1->erry)/(dx*dx);
+	cov_yty = (ph1->erry*ph1->erry)/dx;
 
-	fCovz   = ph1->fErrz*ph1->fErrz;
-	fCovtz  = (ph0->fErrz*ph0->fErrz + ph1->fErrz*ph1->fErrz)/(dx*dx);
-	fCovztz = (ph1->fErrz*ph1->fErrz)/dx;
+	cov_z   = ph1->errz*ph1->errz;
+	cov_tz  = (ph0->errz*ph0->errz + ph1->errz*ph1->errz)/(dx*dx);
+	cov_ztz = (ph1->errz*ph1->errz)/dx;
 
       }
 
-      for (Int_t i2 = i1+1; i2 <= fPatchLastHitInd; i2++)
+      for (Int_t i2 = i1+1; i2 <= patch_last_hit_ind; i2++)
 	{	
-	  ph2 = &(fVecHits[i2]);
-	  if (ph2->fX < ph1->fX) continue; // no backward direction!
+	  ph2 = &(vec_hits[i2]);
+	  if (ph2->x < ph1->x) continue; // no backward direction!
 
-	  dist12 = TMath::Sqrt((ph1->fX-ph2->fX)*(ph1->fX-ph2->fX) + (ph1->fY-ph2->fY)*(ph1->fY-ph2->fY) + (ph1->fZ-ph2->fZ)*(ph1->fZ-ph2->fZ));
+	  dist12 = sqrt((ph1->x-ph2->x)*(ph1->x-ph2->x) + (ph1->y-ph2->y)*(ph1->y-ph2->y) + (ph1->z-ph2->z)*(ph1->z-ph2->z));
 	  if (dist12 < mindist){
-	    if (ph1->fCounter == 0){
+	    if (ph1->counter == 0){
 	      mindist = dist12;
 	      phbest  = ph2;
 	    }
 	    else{
 	      // calculate chi2 distance between the hit and the line
-	      dx = (ph2->fX-x); // assume different x !!!
-	      if (TMath::Abs(dx) < 0.0001) dx = 0.0001;
+	      dx = (ph2->x-x); // assume different x !!!
+	      if (abs(dx) < 0.0001) dx = 0.0001;
 	      
 	      ye = y + ty*dx;
 	      ze = z + tz*dx;
 
-	      sy2 = fCovy + 2.0*fCovyty*dx + fCovty*dx*dx;
-	      sz2 = fCovz + 2.0*fCovztz*dx + fCovtz*dx*dx;
+	      sy2 = cov_y + 2.0*cov_yty*dx + cov_ty*dx*dx;
+	      sz2 = cov_z + 2.0*cov_ztz*dx + cov_tz*dx*dx;
 
-	      dy = ph2->fY - ye;
-	      dz = ph2->fZ - ze;
+	      dy = ph2->y - ye;
+	      dz = ph2->z - ze;
 	      
-	      chi2 = (dy*dy)/(sy2+ph2->fErry*ph2->fErry) + (dz*dz)/(sz2+ph2->fErrz*ph2->fErrz);
+	      chi2 = (dy*dy)/(sy2+ph2->erry*ph2->erry) + (dz*dz)/(sz2+ph2->errz*ph2->errz);
 
 	      // check the straight line model
 	      if (chi2 < minchi2){
@@ -371,226 +351,224 @@ line->SetLineColor(kBlack);
       if (phbest != NULL){// closest hit found 
 
 	// exchange jbest with the next hit
-	Double_t xtmp = next->fX;
-	Double_t ytmp = next->fY;
-	Double_t ztmp = next->fZ;
+	Double_t x_tmp = next->x;
+	Double_t y_tmp = next->y;
+	Double_t z_tmp = next->z;
 
-	Double_t errxtmp = next->fErrx;
-	Double_t errytmp = next->fErry;
-	Double_t errztmp = next->fErrz;
+	Double_t errx_tmp = next->errx;
+	Double_t erry_tmp = next->erry;
+	Double_t errz_tmp = next->errz;
 
-	Int_t indextmp = next->fIndex;
-	Int_t countertmp = next->fCounter;
+	Int_t index_tmp = next->index;
+	Int_t counter_tmp = next->counter;
 
-	next->fX = phbest->fX;
-	next->fY = phbest->fY;
-	next->fZ = phbest->fZ;
+	next->x = phbest->x;
+	next->y = phbest->y;
+	next->z = phbest->z;
 
-	next->fErrx = phbest->fErrx;
-	next->fErry = phbest->fErry;
-	next->fErrz = phbest->fErrz;
+	next->errx = phbest->errx;
+	next->erry = phbest->erry;
+	next->errz = phbest->errz;
 
-	next->fIndex = phbest->fIndex;
-	next->fCounter = phbest->fCounter;
+	next->index = phbest->index;
+	next->counter = phbest->counter;
 
-	phbest->fX = xtmp;
-	phbest->fY = ytmp;
-	phbest->fZ = ztmp;
+	phbest->x = x_tmp;
+	phbest->y = y_tmp;
+	phbest->z = z_tmp;
 
-	phbest->fErrx = errxtmp;
-	phbest->fErry = errytmp;
-	phbest->fErrz = errztmp;
+	phbest->errx = errx_tmp;
+	phbest->erry = erry_tmp;
+	phbest->errz = errz_tmp;
 
-	phbest->fIndex = indextmp;
-	phbest->fCounter = countertmp;
+	phbest->index = index_tmp;
+	phbest->counter = counter_tmp;
 
-	if (ph1->fCounter == 0)
-	  ph1->fCounter = 1;
-	next->fCounter = ph1->fCounter+1;
+	if (ph1->counter == 0)
+	  ph1->counter = 1;
+	next->counter = ph1->counter+1;
 
 	ph0 = ph1;
 	dist01 = mindist;
 
-if(fDRAW){
+#ifdef DRAW
 
-	fYX->cd();
-	line->DrawLine(ph1->fY, ph1->fX, next->fY, next->fX);
+	YX->cd();
+	line->DrawLine(ph1->y, ph1->x, next->y, next->x);
 	
-	fZX->cd();
-	line->DrawLine(ph1->fZ, ph1->fX, next->fZ, next->fX);
+	ZX->cd();
+	line->DrawLine(ph1->z, ph1->x, next->z, next->x);
 
-}//fDRAW
+#endif //DRAW
 
       }
 
     }
 
-  if(fDRAW){
+#ifdef DRAW
 
   delete line;
 
-  fYX->cd(); fYX->Update(); fYX->Draw(); 
-  fZX->cd(); fZX->Update(); fZX->Draw();     
+  YX->cd(); YX->Update(); YX->Draw(); 
+  ZX->cd(); ZX->Update(); ZX->Draw();     
 
-}//fDRAW
+#endif //DRAW
   
-  AliHLTTPCCATrack tr;
-  tr.fNhits = 0; 
-  tr.fChi2  = 0.0; 
-  tr.fNdf   = -4; 
-  tr.fVecIHits.clear();
+  CATrack tr;
+  tr.nhits = 0; 
+  tr.chi2  = 0.0; 
+  tr.ndf   = -4; 
+  tr.vec_ihits.clear();
 
-  fPatchFirstTrackInd = fVecPatchTracks.size(); 
-  fPatchLastTrackInd  = fPatchFirstTrackInd - 1;
+  patch_first_track_ind = vec_patch_tracks.size(); 
+  patch_last_track_ind  = patch_first_track_ind - 1;
 
-  AliHLTTPCCAHit *myphf; 
+  CAHit *my_phf; 
 
   // collect tracks
-  for (Int_t ihr = fPatchLastHitInd; ihr >= fPatchFirstHitInd; ihr--){
+  for (Int_t ihr = patch_last_hit_ind; ihr >= patch_first_hit_ind; ihr--){
 
-    AliHLTTPCCAHit* phit = &(fVecHits[ihr]);
+    CAHit* phit = &(vec_hits[ihr]);
 
-    if ((phit->fCounter < 5)&&(tr.fNhits == 0))
+    if ((phit->counter < 5)&&(tr.nhits == 0))
       continue; // do not collect short tracks
 
-    if ((phit->fCounter != 0)&&(tr.fNhits == 0))// store the first hit
-	myphf = phit;
+    if ((phit->counter != 0)&&(tr.nhits == 0))// store the first hit
+	my_phf = phit;
 
-    if (phit->fCounter != 0){//add hit to the track
-      tr.fNhits++;
-      tr.fVecIHits.push_back(ihr);
+    if (phit->counter != 0){//add hit to the track
+      tr.nhits++;
+      tr.vec_ihits.push_back(ihr);
 
-      if (tr.fNhits == 2){ // calculate initial track parameters
-	AliHLTTPCCAHit* phit0 = &(fVecHits[tr.fVecIHits[0]]);
-	AliHLTTPCCAHit* phit1 = &(fVecHits[tr.fVecIHits[1]]);
+      if (tr.nhits == 2){ // calculate initial track parameters
+	CAHit* phit0 = &(vec_hits[tr.vec_ihits[0]]);
+	CAHit* phit1 = &(vec_hits[tr.vec_ihits[1]]);
 
-	tr.fX = phit1->fX;
-	tr.fY = phit1->fY;
-	tr.fZ = phit1->fZ;
+	tr.x = phit1->x;
+	tr.y = phit1->y;
+	tr.z = phit1->z;
 
-	Double_t dx = (phit1->fX-phit0->fX); // assume different x !!!
-	if (TMath::Abs(dx) < 0.0001) dx = 0.0001;
-	tr.fTy = (phit1->fY-phit0->fY)/dx;
-	tr.fTz = (phit1->fZ-phit0->fZ)/dx;
+	Double_t dx = (phit1->x-phit0->x); // assume different x !!!
+	if (abs(dx) < 0.0001) dx = 0.0001;
+	tr.ty = (phit1->y-phit0->y)/dx;
+	tr.tz = (phit1->z-phit0->z)/dx;
 
-	tr.fCovy   = phit1->fErry*phit1->fErry;
-	tr.fCovty  = (phit0->fErry*phit0->fErry + phit1->fErry*phit1->fErry)/(dx*dx);
-	tr.fCovyty = (phit1->fErry*phit1->fErry)/dx;
+	tr.cov_y   = phit1->erry*phit1->erry;
+	tr.cov_ty  = (phit0->erry*phit0->erry + phit1->erry*phit1->erry)/(dx*dx);
+	tr.cov_yty = (phit1->erry*phit1->erry)/dx;
 
-	tr.fCovz   = phit1->fErrz*phit1->fErrz;
-	tr.fCovtz  = (phit0->fErrz*phit0->fErrz + phit1->fErrz*phit1->fErrz)/(dx*dx);
-	tr.fCovztz = (phit1->fErrz*phit1->fErrz)/dx;
+	tr.cov_z   = phit1->errz*phit1->errz;
+	tr.cov_tz  = (phit0->errz*phit0->errz + phit1->errz*phit1->errz)/(dx*dx);
+	tr.cov_ztz = (phit1->errz*phit1->errz)/dx;
       }
 
-      if (tr.fNhits > 2){ 
+      if (tr.nhits > 2){ 
 	// propagate the track
-	Double_t dx = (phit->fX-tr.fX); // assume different x !!!
-	if (TMath::Abs(dx) < 0.0001) dx = 0.0001;
+	Double_t dx = (phit->x-tr.x); // assume different x !!!
+	if (abs(dx) < 0.0001) dx = 0.0001;
 	
-	Double_t ye = tr.fY + tr.fTy*dx;
-	Double_t ze = tr.fZ + tr.fTz*dx;
+	Double_t ye = tr.y + tr.ty*dx;
+	Double_t ze = tr.z + tr.tz*dx;
 	
-	Double_t fCovy   = tr.fCovy + 2.0*tr.fCovyty*dx + tr.fCovty*dx*dx;
-	Double_t fCovyty = tr.fCovyty + tr.fCovty*dx;
-	Double_t fCovty  = tr.fCovty;
+	Double_t cov_y   = tr.cov_y + 2.0*tr.cov_yty*dx + tr.cov_ty*dx*dx;
+	Double_t cov_yty = tr.cov_yty + tr.cov_ty*dx;
+	Double_t cov_ty  = tr.cov_ty;
 
-	Double_t fCovz   = tr.fCovz + 2.0*tr.fCovztz*dx + tr.fCovtz*dx*dx;
-	Double_t fCovztz = tr.fCovztz + tr.fCovtz*dx;
-	Double_t fCovtz  = tr.fCovtz;
+	Double_t cov_z   = tr.cov_z + 2.0*tr.cov_ztz*dx + tr.cov_tz*dx*dx;
+	Double_t cov_ztz = tr.cov_ztz + tr.cov_tz*dx;
+	Double_t cov_tz  = tr.cov_tz;
 
 	
-	Double_t dy = phit->fY - ye;
-	Double_t dz = phit->fZ - ze;
+	Double_t dy = phit->y - ye;
+	Double_t dz = phit->z - ze;
 	
 	// add the measurement
 
-	Double_t w = 1.0/(phit->fErry*phit->fErry + fCovy);
+	Double_t w = 1.0/(phit->erry*phit->erry + cov_y);
 
-	tr.fY  = ye + fCovy*dy*w;
-	tr.fTy = tr.fTy + fCovyty*dy*w;
+	tr.y  = ye + cov_y*dy*w;
+	tr.ty = tr.ty + cov_yty*dy*w;
 
-	tr.fCovy   = fCovy - fCovy*fCovy*w;
-	tr.fCovyty = fCovyty - fCovy*fCovyty*w;
-	tr.fCovty  = fCovty -fCovyty*fCovyty*w;
+	tr.cov_y   = cov_y - cov_y*cov_y*w;
+	tr.cov_yty = cov_yty - cov_y*cov_yty*w;
+	tr.cov_ty  = cov_ty -cov_yty*cov_yty*w;
 
-	tr.fChi2 += dy*dy*w;
-	tr.fNdf  += 1;
+	tr.chi2 += dy*dy*w;
+	tr.ndf  += 1;
 
-	w = 1.0/(phit->fErrz*phit->fErrz + fCovz);
+	w = 1.0/(phit->errz*phit->errz + cov_z);
 
-	tr.fZ  = ze + fCovz*dz*w;
-	tr.fTz = tr.fTz + fCovztz*dz*w;
+	tr.z  = ze + cov_z*dz*w;
+	tr.tz = tr.tz + cov_ztz*dz*w;
 
-	tr.fCovz   = fCovz - fCovz*fCovz*w;
-	tr.fCovztz = fCovztz - fCovz*fCovztz*w;
-	tr.fCovtz  = fCovtz -fCovztz*fCovztz*w;
+	tr.cov_z   = cov_z - cov_z*cov_z*w;
+	tr.cov_ztz = cov_ztz - cov_z*cov_ztz*w;
+	tr.cov_tz  = cov_tz -cov_ztz*cov_ztz*w;
 
-	tr.fX += dx;
+	tr.x += dx;
 
-	tr.fChi2 += dz*dz*w;
-	tr.fNdf  += 1;
+	tr.chi2 += dz*dz*w;
+	tr.ndf  += 1;
       }
     }
-    if (phit->fCounter == 1){// store the track
+    if (phit->counter == 1){// store the track
 
-      tr.fGood  =  1;
-      tr.fUsed  =  0;
-      tr.fNext  = -1;
-      tr.fPatch = patch;
+      tr.good  =  1;
+      tr.used  =  0;
+      tr.next  = -1;
+      tr.patch = patch;
 
-      Double_t trdist = TMath::Sqrt((myphf->fX-phit->fX)*(myphf->fX-phit->fX)+
-			     (myphf->fY-phit->fY)*(myphf->fY-phit->fY)+
-			     (myphf->fZ-phit->fZ)*(myphf->fZ-phit->fZ));
+      Double_t trdist = sqrt((my_phf->x-phit->x)*(my_phf->x-phit->x)+
+			     (my_phf->y-phit->y)*(my_phf->y-phit->y)+
+			     (my_phf->z-phit->z)*(my_phf->z-phit->z));
 
-      if ((trdist > 1.0)&&(tr.fChi2/tr.fNdf < 10.0)){
-	fVecPatchTracks.push_back(tr);
-	fPatchLastTrackInd++;
+      if ((trdist > 1.0)&&(tr.chi2/tr.ndf < 10.0)){
+	vec_patch_tracks.push_back(tr);
+	patch_last_track_ind++;
       }
 
       // reset the track
-      tr.fNhits = 0;
-      tr.fChi2  = 0.0;
-      tr.fNdf   = -4;
-      tr.fVecIHits.clear();
+      tr.nhits = 0;
+      tr.chi2  = 0.0;
+      tr.ndf   = -4;
+      tr.vec_ihits.clear();
     }
   }
   
   // sort tracks according (currently) to number of hits
-  //sort(fVecPatchTracks.begin(), fVecPatchTracks.end(), compareNhits); //don't need to sort here
-
+  //sort(vec_patch_tracks.begin(), vec_patch_tracks.end(), compareNhits); //don't need to sort here
 
- 
 
- if(fDRAW){
+#ifdef DRAW
 
   TLine *trline = new TLine();
   trline->SetLineColor(kGreen);
 
-  for (Int_t itr = fPatchFirstTrackInd; itr <= fPatchLastTrackInd; itr++){
+  for (Int_t itr = patch_first_track_ind; itr <= patch_last_track_ind; itr++){
 
-    AliHLTTPCCATrack *ptr = &(fVecPatchTracks[itr]);    
+    CATrack *ptr = &(vec_patch_tracks[itr]);    
 
-    AliHLTTPCCAHit* phitf = &(fVecHits[ptr->fVecIHits.back()]);
-    AliHLTTPCCAHit* phitl = &(fVecHits[ptr->fVecIHits.front()]);
+    CAHit* phitf = &(vec_hits[ptr->vec_ihits.back()]);
+    CAHit* phitl = &(vec_hits[ptr->vec_ihits.front()]);
 
-    fYX->cd();
-    Double_t yf = ptr->fY + ptr->fTy*(phitf->fX-ptr->fX);
-    Double_t yl = ptr->fY + ptr->fTy*(phitl->fX-ptr->fX);
-    trline->DrawLine(yf, phitf->fX, yl, phitl->fX);
+    YX->cd();
+    Double_t yf = ptr->y + ptr->ty*(phitf->x-ptr->x);
+    Double_t yl = ptr->y + ptr->ty*(phitl->x-ptr->x);
+    trline->DrawLine(yf, phitf->x, yl, phitl->x);
 
-    fZX->cd();
-    Double_t zf = ptr->fZ + ptr->fTz*(phitf->fX-ptr->fX);
-    Double_t zl = ptr->fZ + ptr->fTz*(phitl->fX-ptr->fX);
-    trline->DrawLine(zf, phitf->fX, zl, phitl->fX);
+    ZX->cd();
+    Double_t zf = ptr->z + ptr->tz*(phitf->x-ptr->x);
+    Double_t zl = ptr->z + ptr->tz*(phitl->x-ptr->x);
+    trline->DrawLine(zf, phitf->x, zl, phitl->x);
 
   }
 
   delete trline;
 
-  fYX->cd(); fYX->Update(); fYX->Draw();
-  fZX->cd(); fZX->Update(); fZX->Draw();     
+  YX->cd(); YX->Update(); YX->Draw();
+  ZX->cd(); ZX->Update(); ZX->Draw();     
 
-}//fDRAW
+#endif //DRAW
 
   return;
 }
@@ -598,19 +576,18 @@ if(fDRAW){
 // ----------------------------------------------------------------------------------
 void AliHLTTPCCATracker::CAFindSliceTracks()
 {
-  //!
 
-  Int_t ntracks = fVecPatchTracks.size();
+  Int_t ntracks = vec_patch_tracks.size();
 
   // merge patch tracks into slice tracks
   // start with the longest tracks in the first patches
 
   // sort tracks according (currently) to patch and within patch - number of hits
-  sort(fVecPatchTracks.begin(), fVecPatchTracks.end(), CompareCATracks);
+  sort(vec_patch_tracks.begin(), vec_patch_tracks.end(), compareCATracks);
 
   for (Int_t itr1 = 0; itr1 < ntracks-1; itr1++){
 
-    AliHLTTPCCATrack *ptr1 = &(fVecPatchTracks[itr1]);    
+    CATrack *ptr1 = &(vec_patch_tracks[itr1]);    
 
     Double_t maxdisty = 10.0;
     Double_t maxdistz =  5.0;
@@ -621,29 +598,29 @@ void AliHLTTPCCATracker::CAFindSliceTracks()
 #ifdef XXX
     for (Int_t itr2 = itr1+1; itr2 < ntracks; itr2++){
 
-      AliHLTTPCCATrack *ptr2 = &(fVecPatchTracks[itr2]);    
+      CATrack *ptr2 = &(vec_patch_tracks[itr2]);    
 
       if (ptr2->patch == ptr1->patch) continue; // the same patch - no prolongation
       if (ptr2->patch >  ptr1->patch+1) break;  // sorted tracks  - no prolongation skippeng over patches
 
-      if (ptr2->fUsed == 1) continue; // already matched
+      if (ptr2->used == 1) continue; // already matched
 
-      AliHLTTPCCAHit* phitf2 = &(fVecHits[ptr2->fVecIHits.back()]);
-      AliHLTTPCCAHit* phitl2 = &(fVecHits[ptr2->fVecIHits.front()]);
+      CAHit* phitf2 = &(vec_hits[ptr2->vec_ihits.back()]);
+      CAHit* phitl2 = &(vec_hits[ptr2->vec_ihits.front()]);
 	
       // extrapolate tr1 to the both ends of tr2
 
-      Double_t dyf = ptr1->fY + ptr1->fty*(phitf2->fX-ptr1->fX) - phitf2->fY; 
-      Double_t dyl = ptr1->fY + ptr1->fTy*(phitl2->fX-ptr1->fX) - phitl2->fY; 
+      Double_t dyf = ptr1->y + ptr1->ty*(phitf2->x-ptr1->x) - phitf2->y; 
+      Double_t dyl = ptr1->y + ptr1->ty*(phitl2->x-ptr1->x) - phitl2->y; 
 
-      Double_t dzf = ptr1->fZ + ptr1->fTz*(phitf2->fX-ptr1->fX) - phitf2->fZ; 
-      Double_t dzl = ptr1->fZ + ptr1->fTz*(phitl2->fX-ptr1->fX) - phitl2->fZ;
+      Double_t dzf = ptr1->z + ptr1->tz*(phitf2->x-ptr1->x) - phitf2->z; 
+      Double_t dzl = ptr1->z + ptr1->tz*(phitl2->x-ptr1->x) - phitl2->z;
 
       // roughly similar tracks ?
-      if ((TMath::Abs(dyf) > maxdisty)||(TMath::Abs(dyl) > maxdisty)||(TMath::Abs(dzf) > maxdistz)||(TMath::Abs(dzl) > maxdistz)) continue; 
+      if ((abs(dyf) > maxdisty)||(abs(dyl) > maxdisty)||(abs(dzf) > maxdistz)||(abs(dzl) > maxdistz)) continue; 
 
       // roughly parallel tracks ?
-      Double_t dist = TMath::Sqrt((dyf-dyl)*(dyf-dyl)+(dzf-dzl)*(dzf-dzl));
+      Double_t dist = sqrt((dyf-dyl)*(dyf-dyl)+(dzf-dzl)*(dzf-dzl));
       if (dist > mindist) continue; 
 
       mindist = dist;
@@ -654,28 +631,28 @@ void AliHLTTPCCATracker::CAFindSliceTracks()
     
     // found track prolongations?
     if (next != -1){
-      AliHLTTPCCATrack *ptr2 = &(fVecPatchTracks[next]);    
+      CATrack *ptr2 = &(vec_patch_tracks[next]);    
 
-      ptr1->fNext = next;
-      ptr2->fUsed = 1;
+      ptr1->next = next;
+      ptr2->used = 1;
 
 
     }
 
   }
 
-  AliHLTTPCCATrack tr;
-  tr.fNhits = 0; 
-  tr.fChi2  = 0.0; 
-  tr.fNdf   = -4; 
-  tr.fVecIHits.clear();
+  CATrack tr;
+  tr.nhits = 0; 
+  tr.chi2  = 0.0; 
+  tr.ndf   = -4; 
+  tr.vec_ihits.clear();
 
 
   //collect tracks
   for (Int_t itr = 0; itr < ntracks; itr++){
 
-    AliHLTTPCCATrack *ptr = &(fVecPatchTracks[itr]);    
-    if (ptr->fUsed) continue; // start with a track not used in prolongations
+    CATrack *ptr = &(vec_patch_tracks[itr]);    
+    if (ptr->used) continue; // start with a track not used in prolongations
 
     Int_t first = 1;
     do{
@@ -683,33 +660,33 @@ void AliHLTTPCCATracker::CAFindSliceTracks()
 	first = 0;
       }
       else{
-	ptr = &(fVecPatchTracks[ptr->fNext]);    
+	ptr = &(vec_patch_tracks[ptr->next]);    
       }
       
-      for (Int_t ih = 0; ih < ptr->fNhits; ih++){
-	tr.fVecIHits.push_back(ptr->fVecIHits[ih]);
-	tr.fNhits++;
+      for (Int_t ih = 0; ih < ptr->nhits; ih++){
+	tr.vec_ihits.push_back(ptr->vec_ihits[ih]);
+	tr.nhits++;
       }
-    }while(ptr->fNext != -1);
+    }while(ptr->next != -1);
 
     //sort hits according to increasing x
-    sort(tr.fVecIHits.begin(), tr.fVecIHits.end(), CompareCAHitsX);
+    sort(tr.vec_ihits.begin(), tr.vec_ihits.end(), compareCAHitsX);
 
-    fVecSliceTracks.push_back(tr);
+    vec_slice_tracks.push_back(tr);
 
-    tr.fNhits = 0; 
-    tr.fChi2  = 0.0; 
-    tr.fNdf   = -4; 
-    tr.fVecIHits.clear();
+    tr.nhits = 0; 
+    tr.chi2  = 0.0; 
+    tr.ndf   = -4; 
+    tr.vec_ihits.clear();
     
   }
 
-  //if(fDRAW){
+#ifdef DRAW
 
   TLine *trline = new TLine();
   trline->SetLineColor(kRed);
 
-  //} //fDRAW
+#endif //DRAW
 
 #if WRITETRACKS
   UInt_t size = 0;
@@ -717,83 +694,83 @@ void AliHLTTPCCATracker::CAFindSliceTracks()
 #endif
 
 
-  for (vector::iterator trIt = fVecSliceTracks.begin(); trIt != fVecSliceTracks.end(); trIt++){
+  for (vector::iterator trIt = vec_slice_tracks.begin(); trIt != vec_slice_tracks.end(); trIt++){
     
-    AliHLTTPCCAHit* phit0 = &(fVecHits[trIt->fVecIHits[trIt->fNhits-1]]);
-    AliHLTTPCCAHit* phit1 = &(fVecHits[trIt->fVecIHits[trIt->fNhits-2]]);
+    CAHit* phit0 = &(vec_hits[trIt->vec_ihits[trIt->nhits-1]]);
+    CAHit* phit1 = &(vec_hits[trIt->vec_ihits[trIt->nhits-2]]);
     
-    trIt->fX = phit1->fX;
-    trIt->fY = phit1->fY;
-    trIt->fZ = phit1->fZ;
+    trIt->x = phit1->x;
+    trIt->y = phit1->y;
+    trIt->z = phit1->z;
     
-    Double_t dx = (phit1->fX-phit0->fX); // assume different x !!!
-    if (TMath::Abs(dx) < 0.0001) dx = 0.0001;
-    trIt->fTy = (phit1->fY-phit0->fY)/dx;
-    trIt->fTz = (phit1->fZ-phit0->fZ)/dx;
+    Double_t dx = (phit1->x-phit0->x); // assume different x !!!
+    if (abs(dx) < 0.0001) dx = 0.0001;
+    trIt->ty = (phit1->y-phit0->y)/dx;
+    trIt->tz = (phit1->z-phit0->z)/dx;
     
-    trIt->fCovy   = phit1->fErry*phit1->fErry;
-    trIt->fCovty  = (phit0->fErry*phit0->fErry + phit1->fErry*phit1->fErry)/(dx*dx);
-    trIt->fCovyty = (phit1->fErry*phit1->fErry)/dx;
+    trIt->cov_y   = phit1->erry*phit1->erry;
+    trIt->cov_ty  = (phit0->erry*phit0->erry + phit1->erry*phit1->erry)/(dx*dx);
+    trIt->cov_yty = (phit1->erry*phit1->erry)/dx;
     
-    trIt->fCovz   = phit1->fErrz*phit1->fErrz;
-    trIt->fCovtz  = (phit0->fErrz*phit0->fErrz + phit1->fErrz*phit1->fErrz)/(dx*dx);
-    trIt->fCovztz = (phit1->fErrz*phit1->fErrz)/dx;
+    trIt->cov_z   = phit1->errz*phit1->errz;
+    trIt->cov_tz  = (phit0->errz*phit0->errz + phit1->errz*phit1->errz)/(dx*dx);
+    trIt->cov_ztz = (phit1->errz*phit1->errz)/dx;
 
-    for (Int_t ih = trIt->fNhits-3; ih >= 0; ih--){
+    for (Int_t ih = trIt->nhits-3; ih >= 0; ih--){
 
-      AliHLTTPCCAHit* phit = &(fVecHits[trIt->fVecIHits[ih]]);
+      CAHit* phit = &(vec_hits[trIt->vec_ihits[ih]]);
 
       // propagate the track
-      Double_t dx = (phit->fX-trIt->fX); // assume different x !!!
-      if (TMath::Abs(dx) < 0.0001) dx = 0.0001;
+      Double_t dx = (phit->x-trIt->x); // assume different x !!!
+      if (abs(dx) < 0.0001) dx = 0.0001;
       
-      Double_t ye = trIt->fY + trIt->fTy*dx;
-      Double_t ze = trIt->fZ + trIt->fTz*dx;
+      Double_t ye = trIt->y + trIt->ty*dx;
+      Double_t ze = trIt->z + trIt->tz*dx;
       
-      Double_t fCovy   = trIt->fCovy + 2.0*trIt->fCovyty*dx + trIt->fCovty*dx*dx;
-      Double_t fCovyty = trIt->fCovyty + trIt->fCovty*dx;
-      Double_t fCovty  = trIt->fCovty;
+      Double_t cov_y   = trIt->cov_y + 2.0*trIt->cov_yty*dx + trIt->cov_ty*dx*dx;
+      Double_t cov_yty = trIt->cov_yty + trIt->cov_ty*dx;
+      Double_t cov_ty  = trIt->cov_ty;
       
-      Double_t fCovz   = trIt->fCovz + 2.0*trIt->fCovztz*dx + trIt->fCovtz*dx*dx;
-      Double_t fCovztz = trIt->fCovztz + trIt->fCovtz*dx;
-      Double_t fCovtz  = trIt->fCovtz;
+      Double_t cov_z   = trIt->cov_z + 2.0*trIt->cov_ztz*dx + trIt->cov_tz*dx*dx;
+      Double_t cov_ztz = trIt->cov_ztz + trIt->cov_tz*dx;
+      Double_t cov_tz  = trIt->cov_tz;
       
-      Double_t dy = phit->fY - ye;
-      Double_t dz = phit->fZ - ze;
+      Double_t dy = phit->y - ye;
+      Double_t dz = phit->z - ze;
       
       // add the measurement
       
-      Double_t w = 1.0/(phit->fErry*phit->fErry + fCovy);
+      Double_t w = 1.0/(phit->erry*phit->erry + cov_y);
       
-      trIt->fY  = ye + fCovy*dy*w;
-      trIt->fTy = trIt->fTy + fCovyty*dy*w;
+      trIt->y  = ye + cov_y*dy*w;
+      trIt->ty = trIt->ty + cov_yty*dy*w;
       
-      trIt->fCovy   = fCovy - fCovy*fCovy*w;
-      trIt->fCovyty = fCovyty - fCovy*fCovyty*w;
-      trIt->fCovty  = fCovty -fCovyty*fCovyty*w;
+      trIt->cov_y   = cov_y - cov_y*cov_y*w;
+      trIt->cov_yty = cov_yty - cov_y*cov_yty*w;
+      trIt->cov_ty  = cov_ty -cov_yty*cov_yty*w;
       
-      trIt->fChi2 += dy*dy*w;
-      trIt->fNdf  += 1;
+      trIt->chi2 += dy*dy*w;
+      trIt->ndf  += 1;
       
-      w = 1.0/(phit->fErrz*phit->fErrz + fCovz);
+      w = 1.0/(phit->errz*phit->errz + cov_z);
       
-      trIt->fZ  = ze + fCovz*dz*w;
-      trIt->fTz = trIt->fTz + fCovztz*dz*w;
+      trIt->z  = ze + cov_z*dz*w;
+      trIt->tz = trIt->tz + cov_ztz*dz*w;
       
-      trIt->fCovz   = fCovz - fCovz*fCovz*w;
-      trIt->fCovztz = fCovztz - fCovz*fCovztz*w;
-      trIt->fCovtz  = fCovtz -fCovztz*fCovztz*w;
+      trIt->cov_z   = cov_z - cov_z*cov_z*w;
+      trIt->cov_ztz = cov_ztz - cov_z*cov_ztz*w;
+      trIt->cov_tz  = cov_tz -cov_ztz*cov_ztz*w;
       
-      trIt->fChi2 += dz*dz*w;
-      trIt->fNdf  += 1;
+      trIt->chi2 += dz*dz*w;
+      trIt->ndf  += 1;
 
-      trIt->fX    += dx;
+      trIt->x    += dx;
     }
 
-    trIt->fGood  =  1;
-    trIt->fUsed  =  0;
-    trIt->fNext  = -1;
-    trIt->fPatch = -1;
+    trIt->good  =  1;
+    trIt->used  =  0;
+    trIt->next  = -1;
+    trIt->patch = -1;
     
     //if (trIt->chi2/trIt->ndf < 1.0)
     //trIt->good  =  0;
@@ -801,16 +778,16 @@ void AliHLTTPCCATracker::CAFindSliceTracks()
 
     // JMT 2006/11/13 Write Tracks to container
 #if WRITETRACKS
-    AliHLTTPCCAHit* firstHit = &(fVecHits[trIt->fVecIHits[0]]);
-    AliHLTTPCCAHit* lastHit = &(fVecHits[trIt->fVecIHits[trIt->fNhits-1]]);
+    CAHit* firstHit = &(vec_hits[trIt->vec_ihits[0]]);
+    CAHit* lastHit = &(vec_hits[trIt->vec_ihits[trIt->nhits-1]]);
     
-    Float_t xFirst = (Float_t) firstHit->fX;
-    Float_t yFirst = (Float_t) trIt->fY + trIt->fTy*(xFirst-trIt->fX);
-    Float_t zFirst = (Float_t) trIt->fZ + trIt->fTz*(xFirst-trIt->fX);
+    Float_t xFirst = (Float_t) firstHit->x;
+    Float_t yFirst = (Float_t) trIt->y + trIt->ty*(xFirst-trIt->x);
+    float_t zFirst = (Float_t) trIt->z + trIt->tz*(xFirst-trIt->x);
 
-    Float_t xLast = (Float_t) lastHit->fX;
-    Float_t yLast = (Float_t) trIt->fY + trIt->fTy*(xLast-trIt->fX);
-    Float_t zLast = (Float_t) trIt->fZ + trIt->fTz*(xLast-trIt->fX);
+    Float_t xLast = (Float_t) lastHit->x;
+    Float_t yLast = (Float_t) trIt->y + trIt->ty*(xLast-trIt->x);
+    Float_t zLast = (Float_t) trIt->z + trIt->tz*(xLast-trIt->x);
 
     fOutputPtr->fX = xFirst;
     fOutputPtr->fY = yFirst;
@@ -820,8 +797,8 @@ void AliHLTTPCCATracker::CAFindSliceTracks()
     fOutputPtr->fLastX = xLast;
     fOutputPtr->fLastY = yLast;
     fOutputPtr->fLastZ = zLast;    
-    fOutputPtr->fPsi = atan(trIt->fTy);
-    fOutputPtr->fTgl = trIt->fTz;
+    fOutputPtr->fPsi = atan(trIt->ty);
+    fOutputPtr->fTgl = trIt->tz;
     fOutputPtr->fPsierr = 1;
     fOutputPtr->fTglerr = 1;
     fOutputPtr->fCharge = 1;
@@ -835,25 +812,25 @@ void AliHLTTPCCATracker::CAFindSliceTracks()
     nTracks++;
 #endif
 
-if(fDRAW){
-    AliHLTTPCCAHit* phitf = &(fVecHits[trIt->fVecIHits[0]]);
-    AliHLTTPCCAHit* phitl = &(fVecHits[trIt->fVecIHits[trIt->fNhits-1]]);
+#ifdef DRAW
+    CAHit* phitf = &(vec_hits[trIt->vec_ihits[0]]);
+    CAHit* phitl = &(vec_hits[trIt->vec_ihits[trIt->nhits-1]]);
     
-    Double_t xf = phitf->fX;
-    Double_t yf = trIt->fY + trIt->fTy*(xf-trIt->fX);
-    Double_t zf = trIt->fZ + trIt->fTz*(xf-trIt->fX);
+    Double_t xf = phitf->x;
+    Double_t yf = trIt->y + trIt->ty*(xf-trIt->x);
+    Double_t zf = trIt->z + trIt->tz*(xf-trIt->x);
 
-    Double_t xl = phitl->fX;
-    Double_t yl = trIt->fY + trIt->fTy*(xl-trIt->fX);
-    Double_t zl = trIt->fZ + trIt->fTz*(xl-trIt->fX);
+    Double_t xl = phitl->x;
+    Double_t yl = trIt->y + trIt->ty*(xl-trIt->x);
+    Double_t zl = trIt->z + trIt->tz*(xl-trIt->x);
 
-    fYX->cd();
+    YX->cd();
     trline->DrawLine(yf, xf, yl, xl);
     
-    fZX->cd();
+    ZX->cd();
     trline->DrawLine(zf, xf, zl, xl);
 
-} //fDRAW
+#endif //DRAW
       
   }
 
@@ -865,14 +842,14 @@ if(fDRAW){
   cout << "SIZE=" << fOutputSize << endl;
 #endif
 
-if(fDRAW){
+#ifdef DRAW
     
   delete trline;
 
-  fYX->cd(); fYX->Update(); fYX->Draw();
-  fZX->cd(); fZX->Update(); fZX->Draw();     
+  YX->cd(); YX->Update(); YX->Draw();
+  ZX->cd(); ZX->Update(); ZX->Draw();     
 
- }//fDRAW
+#endif //DRAW
   
   return;
 }
diff --git a/HLT/TPCLib/AliHLTTPCCATracker.h b/HLT/TPCLib/AliHLTTPCCATracker.h
index ade483bed41..cae09f26295 100644
--- a/HLT/TPCLib/AliHLTTPCCATracker.h
+++ b/HLT/TPCLib/AliHLTTPCCATracker.h
@@ -1,39 +1,38 @@
 // @(#) $Id$
+// Original: AliL3ConfMapper.h,v 1.11 2004/07/05 09:03:11 loizides 
 
 #ifndef ALIHLTTPCCATRACKER_H
 #define ALIHLTTPCCATRACKER_H
 
 //
 // CA Tracking class 
-// !
-// !
+//
 // Author: Ivan Kisel 
 //*-- Copyright © ALICE HLT Group
 
 #include 
 
-class AliHLTTPCTrackSegmentData;
+#include "TFile.h"
+#include "TH1.h"
+#include "TH2.h"
+#include "TProfile.h"
+#include "TProfile2D.h"
+#include "TCanvas.h"
+
+#include "AliHLTTPCTrackSegmentData.h"
+
 class AliHLTTPCConfMapPoint;
 class AliHLTTPCConfMapTrack;
 class AliHLTTPCVertex;
 class AliHLTTPCTrackArray;
 class AliHLTTPCSpacePointData;
-class TApplication;
-class TCanvas;
-class TList;
-class TH1F;
-class TH2F;
-
-#include "TCanvas.h"
 
 class AliHLTTPCCATracker {
 
  public:
 
   AliHLTTPCCATracker();
-  AliHLTTPCCATracker( const AliHLTTPCCATracker &x );
-  AliHLTTPCCATracker &operator=( const AliHLTTPCCATracker &x );
-
+  //  AliHLTTPCCATracker(AliTPCParam *param,AliHLTTPCVertex *vertex,Bool_t bench=(Bool_t)false);
   virtual ~AliHLTTPCCATracker();
 
   Bool_t ReadHits(UInt_t count, AliHLTTPCSpacePointData* hits );
@@ -66,7 +65,7 @@ class AliHLTTPCCATracker {
   void SetMaxAngleTracklet(Double_t f, Bool_t vc){fMaxAngleTracklet[(Int_t)vc] = f;}
 #endif
 
-  void CACreateHistos() ;
+  void CACreateHistos();
   void CAWriteHistos();
 
   void CAInitialize();
@@ -77,45 +76,56 @@ class AliHLTTPCCATracker {
 
   // JMT 2006/11/13
   void SetOutPtr( AliHLTTPCTrackSegmentData* tr ){fOutputPtr = tr;}
-  UInt_t GetOutputSize()  const { return fOutputSize; }
-  UInt_t GetOutputNTracks()  const { return fOutputNTracks; }
+  UInt_t GetOutputSize() { return fOutputSize; }
+  UInt_t GetOutputNTracks() { return fOutputNTracks; }
 
 
  private:
 
-  AliHLTTPCTrackSegmentData* fOutputPtr; //!
-  UInt_t fOutputNTracks; //!
-  UInt_t fOutputSize;    //!
+  AliHLTTPCTrackSegmentData* fOutputPtr;
+  UInt_t fOutputNTracks;
+  UInt_t fOutputSize;
 
-  struct AliHLTTPCCAHit{
-    Double_t fX, fY, fZ;          // position
-    Double_t fErrx, fErry, fErrz; // position errors 
-    Int_t fIndex, fCounter;       // addidtional
+  struct CAHit{
+    Double_t x, y, z;
+    Double_t errx, erry, errz;
+    Int_t index, counter;
   };
   
-  std::vector fVecHits; //!
-  Int_t fPatchFirstHitInd, fPatchLastHitInd; // indices of the first and the last hits in the current patch
-
-  struct AliHLTTPCCATrack{
-    Int_t fPatch, fNhits, fNdf, fGood, fUsed, fNext; // flags    
-    Double_t fX, fY, fZ, fTy, fTz;//parameters    
-    Double_t fCovy, fCovty, fCovyty, fCovz, fCovtz, fCovztz, fChi2;//cov matrix    
-    std::vector fVecIHits;//indices of hits
+  std::vector vec_hits; 
+  Int_t patch_first_hit_ind, patch_last_hit_ind; // indices of the first and the last hits in the current patch
+
+  struct CATrack{
+    Int_t patch, nhits, ndf, good, used, next;
+    //parameters
+    Double_t x, y, z, ty, tz;
+    //cov matrix
+    Double_t cov_y, cov_ty, cov_yty, cov_z, cov_tz, cov_ztz, chi2;
+    //indices of hits
+    std::vector vec_ihits;
   };
 
-  std::vector fVecPatchTracks; //!
-  Int_t fPatchFirstTrackInd, fPatchLastTrackInd; // indices of the first and the last tracks in the current patch
-  std::vector fVecSliceTracks; // tracks
+  std::vector vec_patch_tracks; 
+  Int_t patch_first_track_ind, patch_last_track_ind; // indices of the first and the last tracks in the current patch
+  std::vector vec_slice_tracks; 
 
-  static bool CompareCATracks(const AliHLTTPCCATrack &a, const AliHLTTPCCATrack &b){
-    if (a.fPatch != b.fPatch) return (a.fPatch < b.fPatch);
-    else return (a.fNhits > b.fNhits);
+  static bool compareCATracks(const CATrack &a, const CATrack &b){
+    if (a.patch != b.patch)
+      return (a.patch < b.patch);
+    else
+      return (a.nhits > b.nhits);
   }
 
-  static bool CompareCAHitsX(const Int_t &i, const Int_t &j){
+  static bool compareCAHitsX(const Int_t &i, const Int_t &j){
     return (i < j);
   }
 
+  struct AliHLTTPCConfMapContainer 
+  {
+    void *first; // first track
+    void *last;  // last track
+  };
+
   Bool_t fBench; //run-time measurements
   Int_t fNTracks; //number of tracks build.
 
@@ -128,6 +138,9 @@ class AliHLTTPCCATracker {
   AliHLTTPCTrackArray *fTrack;  //!
   Double_t fMaxDca;      //cut value for momentum fit
   
+  AliHLTTPCConfMapContainer *fVolume;  //!  Segment volume
+  AliHLTTPCConfMapContainer *fRow;     //!  Row volume
+
    //Number of cells (segments)
   Int_t  fNumRowSegment;          // Total number of padrows
   Int_t  fNumPhiSegment;          // number of phi segments 
@@ -165,22 +178,10 @@ class AliHLTTPCCATracker {
   Double_t fMaxEta;               //Maximum eta
 
   // Tracking informtion
-  Int_t fMainVertexTracks;  //number of tracks coming from the main vertex
-  Int_t fClustersUnused;    //number of unused clusters
-
-  Int_t fHistEvent;         //!
-  Bool_t fDRAW;             //!
-  Bool_t fAsk;              //!
-
-  TApplication *fMyapp;     //!
-  TCanvas *fYX, *fZX;       //!
-  
-  TList *fListHisto;        //!
-  TH1F *fHistNClusters;     //!
-  TH2F *fHistClustersXY[10];//!
-
+  Int_t fMainVertexTracks; //number of tracks coming from the main vertex
+  Int_t fClustersUnused;   //number of unused clusters
 
-  ClassDef(AliHLTTPCCATracker,1) //class for cellular automaton tracking
+  ClassDef(AliHLTTPCCATracker,1) //Base class for conformal mapping tracking
 };
 
 #endif
diff --git a/HLT/TPCLib/AliHLTTPCCalibPedestalComponent.cxx b/HLT/TPCLib/AliHLTTPCCalibPedestalComponent.cxx
deleted file mode 100755
index dfdb3b604d7..00000000000
--- a/HLT/TPCLib/AliHLTTPCCalibPedestalComponent.cxx
+++ /dev/null
@@ -1,267 +0,0 @@
-
-
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Authors: Jochen Thaeder                 *
- *          for The ALICE Off-line Project.                               *
- *                                                                        *
- * 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.                  *
- **************************************************************************/
-
-/** @file   AliHLTTPCCalibPedestalComponent.cxx
-    @author Jochen Thaeder
-    @date   
-    @brief  A pedestal calibration component for the TPC.
-*/
-
-#if __GNUC__>= 3
-using namespace std;
-#endif
-
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCTransform.h"
-
-#include "AliHLTTPCCalibPedestalComponent.h"
-
-#include "AliRawDataHeader.h"
-#include "AliRawReaderMemory.h"
-#include "AliTPCRawStream.h"
-
-#include "AliTPCCalibPedestal.h"
-
-#include 
-#include 
-#include "TString.h"
-
-// this is a global object used for automatic component registration, do not use this
-AliHLTTPCCalibPedestalComponent gAliHLTTPCCalibPedestalComponent;
-
-ClassImp(AliHLTTPCCalibPedestalComponent)
-
-AliHLTTPCCalibPedestalComponent::AliHLTTPCCalibPedestalComponent()
-  :
-  fRawReader(NULL),
-  fRawStream(NULL),
-  fCalibPedestal(NULL),
-  fRCUFormat(kFALSE)
-{
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-}
-
-AliHLTTPCCalibPedestalComponent::AliHLTTPCCalibPedestalComponent(const AliHLTTPCCalibPedestalComponent&)
-  :
-  fRawReader(NULL),
-  fRawStream(NULL),
-  fCalibPedestal(NULL),
-  fRCUFormat(kFALSE)
-{
-  // see header file for class documentation
-  HLTFatal("copy constructor untested");
-}
-
-AliHLTTPCCalibPedestalComponent& AliHLTTPCCalibPedestalComponent::operator=(const AliHLTTPCCalibPedestalComponent&)
-{ 
-  // see header file for class documentation
-  HLTFatal("assignment operator untested");
-  return *this;
-}	
-
-AliHLTTPCCalibPedestalComponent::~AliHLTTPCCalibPedestalComponent()
-{
-  // see header file for class documentation
-}
-
-// Public functions to implement AliHLTComponent's interface.
-// These functions are required for the registration process
-
-const char* AliHLTTPCCalibPedestalComponent::GetComponentID()
-{
-  // see header file for class documentation
-  return "TPCCalibPedestal";
-}
-
-void AliHLTTPCCalibPedestalComponent::GetInputDataTypes( vector& list)
-{
-  // see header file for class documentation
-  list.clear(); 
-  list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
-}
-
-AliHLTComponentDataType AliHLTTPCCalibPedestalComponent::GetOutputDataType()
-{
-  // see header file for class documentation
-  return AliHLTTPCDefinitions::fgkCalibPedestalDataType;
-}
-
-void AliHLTTPCCalibPedestalComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
-{
-  // see header file for class documentation
-  // XXX TODO: Find more realistic values.  
-  constBase = 0;
-  inputMultiplier = (2.0);
-}
-
-AliHLTComponent* AliHLTTPCCalibPedestalComponent::Spawn()
-{
-  // see header file for class documentation
-  return new AliHLTTPCCalibPedestalComponent();
-}  
-
-Int_t AliHLTTPCCalibPedestalComponent::DoInit( int argc, const char** argv ) {
-  // see header file for class documentation
-  
-  // ** Interprete commandline arguments
-  Int_t i = 0;
-  Char_t* cpErr;
-
-  while ( i < argc ) {      
-    
-    // -- rcu format option -- default in constructor: kFALSE => use new data format
-    if ( !strcmp( argv[i], "rcuformat" ) ) {
-      if ( argc <= i+1 ) {
-	HLTError( "Missing RCU format - RCU format not specified" );
-	return ENOTSUP;
-      }
-      
-      // Decodes the rcu format --  options: "old" or "new"
-      if ( !strcmp( argv[i+1], "old" ) ) {
-	fRCUFormat = kTRUE;
-      }
-      else if ( !strcmp( argv[i+1], "new" ) ) {
-	fRCUFormat = kFALSE;
-      }
-      else {
-	HLTError( "Missing RCU format - Cannot convert rcu format  specifier '%s'.", argv[i+1] );
-	return EINVAL;
-      }
-      
-      i += 2;
-      continue;
-    }
-
-    HLTError( "Unknown Option - Unknown option '%s'", argv[i] );
-    return EINVAL;
-    
-  }
-  
-  // ** Create pedestal calibration
-  if ( fCalibPedestal )
-    return EINPROGRESS;
-  
-  fCalibPedestal = new AliTPCCalibPedestal();
-
-  // **  Create AliRoot Memory Reader
-  if (fRawReader)
-    return EINPROGRESS;
-
-#if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) 
-  fRawReader = new AliRawReaderMemory();
-#else
-  HLTFatal("AliRawReader  not available - check your build");
-  return -ENODEV;
-#endif
-
-  return 0;
-}
-
-Int_t AliHLTTPCCalibPedestalComponent::DoDeinit()
-{
-  // see header file for class documentation
-
-  if ( fRawReader )
-    delete fRawReader;
-  fRawReader = NULL;
-
-  if ( fCalibPedestal )
-    delete fCalibPedestal;
-  fCalibPedestal = NULL;
-
-  return 0;
-}
-
-/*
- * --- will be changing with the Calibration Processor, -> Split DoEvent into 2 functions:
- *    --- > Process event
- *    --- > Ship Data to FXS
- * --- setter for rcuformat need in AliTPCCalibPedestal class
- */
-Int_t AliHLTTPCCalibPedestalComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) {
-  // see header file for class documentation
-  
-  const AliHLTComponentBlockData* iter = NULL;
-  AliHLTUInt32_t spec = 0;
-
-  Int_t slice, patch;
-  Int_t minPatch = 5;
-  Int_t maxPatch = 0;
-  Int_t DDLid = 0;
-    
-  // ** Loop over all input blocks and specify which data format should be read - only select Raw Data
-  iter = GetFirstInputBlock( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
-  
-  while ( iter != NULL ) {
-    
-    // ** Print Debug output which data format was received
-    char tmp1[14], tmp2[14];
-    DataType2Text( iter->fDataType, tmp1 );
-    DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 );
-
-    HLTDebug ( "Event received - Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
-
-    // ** Get DDL ID in order to tell the memory reader which slice/patch to use
-    slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
-    patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
-
-    if (patch < 2) DDLid = 768 + (2 * slice) + patch;
-    else DDLid = 838 + (4*slice) + patch;
-
-    HLTDebug ( "Input Raw Data - Slice/Patch: %d/%d - EquipmentID : %d.", slice, patch, DDLid );
-
-    // ** Get min and max patch, used for output specification
-    if ( patch < minPatch ) minPatch =  patch;
-    if ( patch > maxPatch ) maxPatch =  patch;
-
-    // ** Init TPCRawStream
-    fRawReader->SetMemory( reinterpret_cast( iter->fPtr ), iter->fSize );
-    fRawReader->SetEquipmentID(DDLid);
-
-    fRawStream = new AliTPCRawStream( fRawReader );
-    fRawStream->SetOldRCUFormat( fRCUFormat );
-
-    // ** Process actual Pedestal Calibration - Fill histograms
-    fCalibPedestal->ProcessEvent( fRawStream );
-  
-    // ** Delete TPCRawStream
-    if ( fRawStream )
-      delete fRawStream;
-    fRawStream = NULL;    
-
-    // ** Get next input block, with the same specification as defined in GetFirstInputBlock()
-    iter = GetNextInputBlock();
-
-  } //  while ( iter != NULL ) {
-  
-  // !!! HIGHLY DEBUG !!!
-  //  fCalibPedestal->DumpToFile("Pedestal.root");
-  // !!! HIGHLY DEBUG !!!
-
-  // ** Call only at "END OF RUN" event
-  //  fCalibPedestal->Analyse();
-  
-  // ** PushBack data to shared memory ... 
-  spec = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch );
-  PushBack( (TObject*) fCalibPedestal, AliHLTTPCDefinitions::fgkCalibPedestalDataType, spec);
-  
-  return 0;
-} // Int_t AliHLTTPCCalibPedestalComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) {
diff --git a/HLT/TPCLib/AliHLTTPCCalibPedestalComponent.h b/HLT/TPCLib/AliHLTTPCCalibPedestalComponent.h
deleted file mode 100755
index c3dd068d082..00000000000
--- a/HLT/TPCLib/AliHLTTPCCalibPedestalComponent.h
+++ /dev/null
@@ -1,86 +0,0 @@
-
-#ifndef ALIHLTTPCCALIBPEDESTALCOMPONENT_H
-#define ALIHLTTPCCALIBPEDESTALCOMPONENT_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/** @file   AliHLTTPCCalibPedestalComponent.h
-    @author Jochen Thaeder
-    @date   
-    @brief  A pedestal calibration component for the TPC.
-*/
-
-#include "AliHLTProcessor.h"
-#include "AliHLTTPCDefinitions.h"
-
-class AliTPCRawStream;
-class AliRawReaderMemory;
-class AliTPCCalibPedestal;
-
-/**
- * @class AliHLTTPCCalibPedestalComponent
- * 
- * This class is the component for the AliTPCCalibPedestal class used for 
- * pedestal calibration of the TPC. It uses the high-level interface and
- * the output is the TObject of AliTPCCalibPedestal.
- *
- * The component has the following component arguments:
- * -    The RCU format:  rcuformat  
- *      which can be either 
- *        - old ( used in the TPC Commissioning )
- *        - new
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCCalibPedestalComponent : public AliHLTProcessor
-    {
-    public:
-      /**
-       * constructor 
-       */
-      AliHLTTPCCalibPedestalComponent();
-      /** not a valid copy constructor, defined according to effective C++ style */
-      AliHLTTPCCalibPedestalComponent(const AliHLTTPCCalibPedestalComponent&);
-      /** not a valid assignment op, but defined according to effective C++ style */
-      AliHLTTPCCalibPedestalComponent& operator=(const AliHLTTPCCalibPedestalComponent&);
-      /** destructor */
-      virtual ~AliHLTTPCCalibPedestalComponent();
-      
-      // Public functions to implement AliHLTComponent's interface.
-      // These functions are required for the registration process
-
-      const char* GetComponentID();
-      void GetInputDataTypes( vector& list);
-      AliHLTComponentDataType GetOutputDataType();
-      virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-      AliHLTComponent* Spawn();
-
-    protected:
-      
-      // Protected functions to implement AliHLTComponent's interface.
-      // These functions provide initialization as well as the actual processing
-      // capabilities of the component. 
-      
-      Int_t DoInit( int argc, const char** argv );
-      Int_t DoDeinit();
-      Int_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
-   
-    private:
-
-      /** the reader object for reading from memory */
-      AliRawReaderMemory* fRawReader;                                              //!transient
-
-      /** the reader object for reading TPC raw data */  
-      AliTPCRawStream* fRawStream;                                                 //!transient
-
-      /** Pedestal Calibration class */
-      AliTPCCalibPedestal * fCalibPedestal;                                        //!transient
-      
-      /** if use old RCU format */
-      Bool_t fRCUFormat;                                                           // see above
-
-      ClassDef(AliHLTTPCCalibPedestalComponent, 0)
-
-    };
-#endif
diff --git a/HLT/TPCLib/AliHLTTPCCalibSignalComponent.cxx b/HLT/TPCLib/AliHLTTPCCalibSignalComponent.cxx
deleted file mode 100644
index cf9e1bfd24e..00000000000
--- a/HLT/TPCLib/AliHLTTPCCalibSignalComponent.cxx
+++ /dev/null
@@ -1,274 +0,0 @@
-
-
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Authors: Jochen Thaeder                 *
- *          Sorina Popescu = 3
-using namespace std;
-#endif
-
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCTransform.h"
-
-#include "AliHLTTPCCalibSignalComponent.h"
-
-#include "AliRawDataHeader.h"
-#include "AliRawReaderMemory.h"
-#include "AliTPCRawStream.h"
-
-#include "AliTPCCalibSignal.h"
-
-#include 
-#include 
-#include "TString.h"
-
-// this is a global object used for automatic component registration, do not use this
-AliHLTTPCCalibSignalComponent gAliHLTTPCCalibSignalComponent;
-
-ClassImp(AliHLTTPCCalibSignalComponent)
-
-AliHLTTPCCalibSignalComponent::AliHLTTPCCalibSignalComponent()
-  :
-  fRawReader(NULL),
-  fRawStream(NULL),
-  fCalibSignal(NULL),
-  fRCUFormat(kFALSE)
-{
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-}
-
-AliHLTTPCCalibSignalComponent::AliHLTTPCCalibSignalComponent(const AliHLTTPCCalibSignalComponent&)
-  :
-  fRawReader(NULL),
-  fRawStream(NULL),
-  fCalibSignal(NULL),
-  fRCUFormat(kFALSE)
-{
-  // see header file for class documentation
-  HLTFatal("copy constructor to be tested");
-}
-
-AliHLTTPCCalibSignalComponent& AliHLTTPCCalibSignalComponent::operator=(const AliHLTTPCCalibSignalComponent&)
-{ 
-  // see header file for class documentation
-  HLTFatal("assignment operator to be tested");
-  return *this;
-}	
-
-AliHLTTPCCalibSignalComponent::~AliHLTTPCCalibSignalComponent()
-{
-  // see header file for class documentation
-}
-
-// Public functions to implement AliHLTComponent's interface.
-// These functions are required for the registration process
-
-const char* AliHLTTPCCalibSignalComponent::GetComponentID()
-{
-  // see header file for class documentation
-  return "TPCCalibSignal";
-}
-
-void AliHLTTPCCalibSignalComponent::GetInputDataTypes( vector& list)
-{
-  // see header file for class documentation
-  list.clear(); 
-  list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
-}
-
-AliHLTComponentDataType AliHLTTPCCalibSignalComponent::GetOutputDataType()
-{
-  // see header file for class documentation
-  return AliHLTTPCDefinitions::fgkCalibSignalDataType;
-}
-
-void AliHLTTPCCalibSignalComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
-{
-  // see header file for class documentation
-  // XXX TODO: Find more realistic values.  
-  constBase = 0;
-  inputMultiplier = (2.0);
-}
-
-AliHLTComponent* AliHLTTPCCalibSignalComponent::Spawn()
-{
-  // see header file for class documentation
-  return new AliHLTTPCCalibSignalComponent();
-}  
-
-Int_t AliHLTTPCCalibSignalComponent::DoInit( int argc, const char** argv )
-{
-  // see header file for class documentation
-  
-  // ** Interprete commandline arguments
-  Int_t i = 0;
-  Char_t* cpErr;
-
-  while ( i < argc ) {      
-    
-    // -- rcu format option-- default in constructor: kFALSE => use new data format
-    if ( !strcmp( argv[i], "rcuformat" ) ) {
-      if ( argc <= i+1 ) {
-	HLTError( "Missing RCU format - RCU format not specified" );
-	return ENOTSUP;
-      }
-      
-      // Decodes the rcu format --  options: "old" or "new"
-      if ( !strcmp( argv[i+1], "old" ) ) {
-	fRCUFormat = kTRUE;
-      }
-      else if ( !strcmp( argv[i+1], "new" ) ) {
-	fRCUFormat = kFALSE;
-      }
-      else {
-	HLTError( "Missing RCU format - Cannot convert rcu format  specifier '%s'.", argv[i+1] );
-	return EINVAL;
-      }
-      
-      i += 2;
-      continue;
-    }
-
-    HLTError( "Unknown Option - Unknown option '%s'", argv[i] );
-    return EINVAL;
-    
-  }
-  
-  // ** Create Signal calibration
-  if ( fCalibSignal )
-    return EINPROGRESS;
-  
-  fCalibSignal = new AliTPCCalibSignal();
-
-  // **  Create AliRoot Memory Reader
-  if (fRawReader)
-    return EINPROGRESS;
-
-#if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) 
-  fRawReader = new AliRawReaderMemory();
-#else
-  HLTFatal("AliRawReader  not available - check your build");
-  return -ENODEV;
-#endif
-
-  return 0;
-}
-
-Int_t AliHLTTPCCalibSignalComponent::DoDeinit()
-{
-  // see header file for class documentation
-
-  if ( fRawReader )
-    delete fRawReader;
-  fRawReader = NULL;
-
-  if ( fCalibSignal )
-    delete fCalibSignal;
-  fCalibSignal = NULL;
-
-  return 0;
-}
-
-/*
- * --- will be changing with the Calibration Processor, -> Split DoEvent into 2 functions:
- *    --- > Process event
- *    --- > Ship Data to FXS
- * --- setter for rcuformat need in AliTPCCalibSignal class
- */
-Int_t AliHLTTPCCalibSignalComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) {
-  // see header file for class documentation
-
-  const AliHLTComponentBlockData* iter = NULL;
-  AliHLTUInt32_t spec = 0;
-
-  Int_t slice, patch;
-  Int_t minPatch = 5;
-  Int_t maxPatch = 0;
-  Int_t DDLid = 0;
- 
-  //--------same as for pedestal
-
-  // ** Loop over all input blocks and specify which data format should be read
-  iter = GetFirstInputBlock( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
-  
-  while ( iter != NULL ) {
-    
-    // ** Print Debug output which data format was received
-    char tmp1[14], tmp2[14];
-    DataType2Text( iter->fDataType, tmp1 );
-    DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 );
-
-    HLTDebug ( "Event received - Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
-
-    // ** Get DDL ID in order to tell the memory reader which slice/patch to use
-    slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
-    patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
-
-    if (patch < 2) DDLid = 768 + (2 * slice) + patch;
-    else DDLid = 838 + (4*slice) + patch;
-
-    // ---------
-    
-    HLTDebug ( "Input Raw Data - Slice/Patch: %d/%d - EquipmentID : %d.", slice, patch, DDLid );
-    
-    // ** Get the  min and max patch, used in the output specfication
-    if ( patch < minPatch ) minPatch =  patch;
-    if ( patch > maxPatch ) maxPatch =  patch;
-
-    // ** Init TPCRawStream
-    fRawReader->SetMemory( reinterpret_cast( iter->fPtr ), iter->fSize );
-    fRawReader->SetEquipmentID(DDLid);
-
-    fRawStream = new AliTPCRawStream( fRawReader );
-    fRawStream->SetOldRCUFormat( fRCUFormat );
-
-    fCalibSignal->ProcessEvent( fRawStream );
-  
-    if ( fRawStream )
-      delete fRawStream;
-    fRawStream = NULL;    
-
-    //-----------
-    // ** Get next input block, with the same specification as defined in GetFirstInputBlock()
-    iter = GetNextInputBlock();
-
-  } //  while ( iter != NULL ) {
-  
-  // !!! HIGHLY DEBUG !!!
-  // fCalibSignal->DumpToFile("Signal.root");
-  // !!! HIGHLY DEBUG !!!
-
-  // ** Call only at END of RUN event
-  //  fCalibSignal->Analyse();
-  
-  // ** PushBack data to shared memory ... 
-
-  spec = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch );
-  PushBack( (TObject*) fCalibSignal, AliHLTTPCDefinitions::fgkCalibSignalDataType, spec);
-  
-  return 0;
-} // Int_t AliHLTTPCCalibSignalComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) {
-//-------------
diff --git a/HLT/TPCLib/AliHLTTPCCalibSignalComponent.h b/HLT/TPCLib/AliHLTTPCCalibSignalComponent.h
deleted file mode 100644
index efa6e2bb90c..00000000000
--- a/HLT/TPCLib/AliHLTTPCCalibSignalComponent.h
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-#ifndef ALIHLTTPCCALIBSIGNAlCOMPONENT_H
-#define ALIHLTTPCCALIBSIGNALCOMPONENT_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/** @file   AliHLTTPCCalibSignalComponent.h
-    @author Jochen Thaeder, Sorina Popescu
-    @date   
-    @brief HLT Pulser calibration component for the TPC.
-*/
-
-#include "AliHLTProcessor.h"
-#include "AliHLTTPCDefinitions.h"
-
-class AliTPCRawStream;
-class AliRawReaderMemory;
-class AliTPCCalibSignal;
-
-/**
- * @class AliHLTTPCCalibSignalComponent
- * 
- * This class is the component for the AliTPCCalibSignal class used for 
- * pedestal calibration of the TPC. It uses the high-level interface and
- * the output is the TObject of AliTPCCalibSignal.
- *
- * The component has the following component arguments:
- * -    The RCU format:  rcuformat  
- *      which can be either 
- *        - old ( used in the TPC Commissioning )
- *        - new
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCCalibSignalComponent : public AliHLTProcessor
-    {
-    public:
-      /**
-       * constructor 
-       */
-      AliHLTTPCCalibSignalComponent();
-      /** not a valid copy constructor, defined according to effective C++ style */
-      AliHLTTPCCalibSignalComponent(const AliHLTTPCCalibSignalComponent&);
-      /** not a valid assignment op, but defined according to effective C++ style */
-      AliHLTTPCCalibSignalComponent& operator=(const AliHLTTPCCalibSignalComponent&);
-      /** destructor */
-      virtual ~AliHLTTPCCalibSignalComponent();
-      
-      // Public functions to implement AliHLTComponent's interface.
-      // These functions are required for the registration process
-
-      const char* GetComponentID();
-      void GetInputDataTypes( vector& list);
-      AliHLTComponentDataType GetOutputDataType();
-      virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-      AliHLTComponent* Spawn();
-
-    protected:
-      
-      // Protected functions to implement AliHLTComponent's interface.
-      // These functions provide initialization as well as the actual processing
-      // capabilities of the component. 
-      
-      Int_t DoInit( int argc, const char** argv );
-      Int_t DoDeinit();
-      Int_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
-      
-    private:
-
-      /** the reader object for reading from memory */
-      AliRawReaderMemory* fRawReader;                                              //!transient
-
-      /** the reader object for reading TPC raw data */  
-      AliTPCRawStream* fRawStream;                                                 //!transient
-
-      /** Signal Calibration class */
-      AliTPCCalibSignal * fCalibSignal;                                            //!transient
-      
-      /** if use old RCU format */
-      Bool_t fRCUFormat;                                                           // see description
-
-      ClassDef(AliHLTTPCCalibSignalComponent, 0)
-
-    };
-#endif
diff --git a/HLT/TPCLib/AliHLTTPCClusterDataFormat.h b/HLT/TPCLib/AliHLTTPCClusterDataFormat.h
index c4623382080..0dbc384b893 100644
--- a/HLT/TPCLib/AliHLTTPCClusterDataFormat.h
+++ b/HLT/TPCLib/AliHLTTPCClusterDataFormat.h
@@ -4,10 +4,9 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-#include "AliHLTTPCSpacePointData.h"
-
 /* AliHLTTPCClusterData
  */
+
 struct AliHLTTPCClusterData
     {
 	AliHLTUInt32_t fSpacePointCnt;
diff --git a/HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx b/HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
index 82bcc2294f0..00472806f01 100644
--- a/HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
+++ b/HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
@@ -18,7 +18,7 @@
  **************************************************************************/
 
 /** @file   AliHLTTPCClusterFinderComponent.cxx
-    @author Timm Steinbeck, Matthias Richter, Jochen Thaeder, Kenneth Aamodt
+    @author Timm Steinbeck, Matthias Richter, Jochen Thaeder
     @date   
     @brief  The TPC cluster finder processing component
 */
@@ -140,7 +140,7 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
     Int_t rawreadermode =  -1;
     Int_t sigthresh = -1;
     Float_t occulimit = 1.0;
-    Int_t oldRCUFormat=0;
+
     // Data Format version numbers:
     // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word.
     // 1: As 0, but pads/padrows are delivered "as is", without sorting
@@ -217,18 +217,6 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
 	continue;
       }
 
-      // -- checking for rcu format
-      if ( !strcmp( argv[i], "oldrcuformat" ) ) {
-      	oldRCUFormat = strtoul( argv[i+1], &cpErr ,0);
-      	if ( *cpErr ){
-      	  HLTError("Cannot convert oldrcuformat specifier '%s'. Should  be 0(off) or 1(on), must be integer", argv[i+1]);
-      	  return EINVAL;
-      	}
-      	i+=2;
-      	continue;
-      }
-      
-
       Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
       return EINVAL;
 
@@ -240,12 +228,6 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
       if (rawreadermode == -2) {
 #if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
 	fReader = new AliHLTTPCDigitReaderPacked();
-	if(oldRCUFormat==1){
-	  fReader->SetOldRCUFormat(kTRUE);
-	}
-	else if(oldRCUFormat!=0){
-	  HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat);
-	}
 	fClusterFinder->SetReader(fReader);
 #else // ! defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
 	HLTFatal("DigitReaderPacked not available - check your build");
diff --git a/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h b/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
index 03c8fa9adc2..6e922ef8e22 100644
--- a/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
+++ b/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
@@ -57,16 +57,11 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
 	// Public functions to implement AliHLTComponent's interface.
 	// These functions are required for the registration process
 
-  /** interface function, see @ref AliHLTComponent for description */
-  const char* GetComponentID();
-  /** interface function, see @ref AliHLTComponent for description */
-  void GetInputDataTypes( vector& list);
-  /** interface function, see @ref AliHLTComponent for description */
-  AliHLTComponentDataType GetOutputDataType();
-  /** interface function, see @ref AliHLTComponent for description */
-  virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-  /** interface function, see @ref AliHLTComponent for description */
-  AliHLTComponent* Spawn();
+	const char* GetComponentID();
+	void GetInputDataTypes( vector& list);
+	AliHLTComponentDataType GetOutputDataType();
+	virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+	AliHLTComponent* Spawn();
 
     protected:
 	
diff --git a/HLT/TPCLib/AliHLTTPCDefinitions.cxx b/HLT/TPCLib/AliHLTTPCDefinitions.cxx
index 8ab892f8f9e..2cdbb151119 100644
--- a/HLT/TPCLib/AliHLTTPCDefinitions.cxx
+++ b/HLT/TPCLib/AliHLTTPCDefinitions.cxx
@@ -36,10 +36,6 @@ const AliHLTComponentDataType AliHLTTPCDefinitions::fgkVertexDataType = { sizeof
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkTrackSegmentsDataType = { sizeof(AliHLTComponentDataType), {'T','R','A','K','S','E','G','S'},{'T','P','C',' '}};;
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkTracksDataType = { sizeof(AliHLTComponentDataType), {'T','R','A','C','K','S',' ',' '},{'T','P','C',' '}};;
 
-const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibPedestalDataType = { sizeof(AliHLTComponentDataType), {'C','A','L','_','P','E','D',' '},{'T','P','C',' '}};;
-const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibSignalDataType = { sizeof(AliHLTComponentDataType), {'C','A','L','_','S','I','G',' '},{'T','P','C',' '}};;
-
-
 AliHLTTPCDefinitions::AliHLTTPCDefinitions()
 {
   // see header file for class documentation
diff --git a/HLT/TPCLib/AliHLTTPCDefinitions.h b/HLT/TPCLib/AliHLTTPCDefinitions.h
index 857bb3967ed..3d4e9a47a4d 100644
--- a/HLT/TPCLib/AliHLTTPCDefinitions.h
+++ b/HLT/TPCLib/AliHLTTPCDefinitions.h
@@ -73,10 +73,6 @@ class AliHLTTPCDefinitions
   static const AliHLTComponentDataType fgkTracksDataType;          // see above
   /** vertex data structure */
   static const AliHLTComponentDataType fgkVertexDataType;          // see above
-  /** pedestal calibration data */
-  static const AliHLTComponentDataType fgkCalibPedestalDataType;   // see above
-  /** signal calibration data */
-  static const AliHLTComponentDataType fgkCalibSignalDataType;     // see above
 
   ClassDef(AliHLTTPCDefinitions, 0);
 
diff --git a/HLT/TPCLib/AliHLTTPCDigitReader.cxx b/HLT/TPCLib/AliHLTTPCDigitReader.cxx
index 322d5ea051f..43f8f8a5813 100644
--- a/HLT/TPCLib/AliHLTTPCDigitReader.cxx
+++ b/HLT/TPCLib/AliHLTTPCDigitReader.cxx
@@ -18,7 +18,7 @@
  **************************************************************************/
 
 /** @file   AliHLTTPCDigitReader.cxx
-    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter, Kenneth Aamodt
+    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
     @date   
     @brief  An abstract reader class for TPC data.
 */
@@ -55,8 +55,3 @@ int AliHLTTPCDigitReader::InitBlock(void* ptr,unsigned long size,Int_t firstrow,
   return InitBlock(ptr, size, patch, slice);
 }
 
-void AliHLTTPCDigitReader::SetOldRCUFormat(Bool_t oldrcuformat){
-  if (oldrcuformat==NULL) {
-    // this is currently just to get rid of the warning "unused parameter"
-  }
-}
diff --git a/HLT/TPCLib/AliHLTTPCDigitReader.h b/HLT/TPCLib/AliHLTTPCDigitReader.h
index 86fd9cb4626..f62308010ea 100644
--- a/HLT/TPCLib/AliHLTTPCDigitReader.h
+++ b/HLT/TPCLib/AliHLTTPCDigitReader.h
@@ -8,7 +8,7 @@
  * See cxx source for full Copyright notice                               */
 
 /** @file   AliHLTTPCDigitReader.h
-    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter, Kenneth Aamodt
+    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
     @date   
     @brief  An abstract reader class for TPC data.
 */
@@ -86,11 +86,6 @@ class AliHLTTPCDigitReader : public AliHLTLogging {
    */
   virtual int GetTime()=0;
 
-  /**
-   * Method to use old rcu fomat.
-   */
-  virtual void SetOldRCUFormat(Bool_t oldrcuformat);
-
 protected:
 	
 private:
diff --git a/HLT/TPCLib/AliHLTTPCDigitReaderPacked.cxx b/HLT/TPCLib/AliHLTTPCDigitReaderPacked.cxx
index bf8eb5f0109..0e3c45fbd9b 100644
--- a/HLT/TPCLib/AliHLTTPCDigitReaderPacked.cxx
+++ b/HLT/TPCLib/AliHLTTPCDigitReaderPacked.cxx
@@ -18,7 +18,7 @@
  **************************************************************************/
 
 /** @file   AliHLTTPCDigitReaderPacked.cxx
-    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter, Kenneth Aamodt
+    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
     @date   
     @brief  A digit reader implementation for simulated, packed TPC 'raw' data.
 */
@@ -55,8 +55,7 @@ AliHLTTPCDigitReaderPacked::AliHLTTPCDigitReaderPacked()
   fData(NULL),
 #endif // ENABLE_PAD_SORTING  
   fRawMemoryReader(NULL),
-  fTPCRawStream(NULL),
-  fOldRCUFormat(kFALSE)
+  fTPCRawStream(NULL)
 {
   fRawMemoryReader = new AliRawReaderMemory;
   
@@ -98,8 +97,7 @@ AliHLTTPCDigitReaderPacked::AliHLTTPCDigitReaderPacked(const AliHLTTPCDigitReade
   fData(NULL),
 #endif // ENABLE_PAD_SORTING  
   fRawMemoryReader(NULL),
-  fTPCRawStream(NULL),
-  fOldRCUFormat(kFALSE)
+  fTPCRawStream(NULL)
 {
   HLTFatal("copy constructor not for use");
 }
@@ -119,7 +117,6 @@ AliHLTTPCDigitReaderPacked& AliHLTTPCDigitReaderPacked::operator=(const AliHLTTP
 #endif // ENABLE_PAD_SORTING  
   fRawMemoryReader=NULL;
   fTPCRawStream=NULL;
-  fOldRCUFormat=kFALSE;
   HLTFatal("assignment operator not for use");
   return (*this);
 }
@@ -145,14 +142,14 @@ Int_t AliHLTTPCDigitReaderPacked::InitBlock(void* ptr,unsigned long size, Int_t
   //get DDL ID in order to tell the memory reader which slice/patch to use
   Int_t DDLid= 0;
   if (patch < 2)
-    DDLid = 768 + 2*slice + patch;
+    DDLid = 2 *slice + patch;
   else 
-    DDLid = 840 + 4*slice + patch;
+    DDLid = 70 + 4*slice + patch;
 
-  fRawMemoryReader->SetEquipmentID(DDLid);
-  //fRawMemoryReader->SetEquipmentID(1);
-  if(fOldRCUFormat)
-    fTPCRawStream->SetOldRCUFormat(kTRUE);
+  //fRawMemoryReader->SetEquipmentID(DDLid);
+//fRawMemoryReader->SetEquipmentID(1);
+
+// fTPCRawStream->SetOldRCUFormat(kTRUE);
 
 #if ENABLE_PAD_SORTING
 
diff --git a/HLT/TPCLib/AliHLTTPCDigitReaderPacked.h b/HLT/TPCLib/AliHLTTPCDigitReaderPacked.h
index 3a3539a7c70..a0eb87c2b90 100644
--- a/HLT/TPCLib/AliHLTTPCDigitReaderPacked.h
+++ b/HLT/TPCLib/AliHLTTPCDigitReaderPacked.h
@@ -8,7 +8,7 @@
  * See cxx source for full Copyright notice                               */
 
 /** @file   AliHLTTPCDigitReaderPacked.h
-    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter, Kenneth Aamodt
+    @author Timm Steinbeck, Jochen Thaeder, Matthias Richter
     @date   
     @brief  A digit reader implementation for simulated, packed TPC 'raw' data.
 */
@@ -50,7 +50,6 @@ class AliHLTTPCDigitReaderPacked : public AliHLTTPCDigitReader{
    * @param slice   sector no (0 to 35)
    */
   Int_t InitBlock(void* ptr,ULong_t size, Int_t patch, Int_t slice);
-  void SetOldRCUFormat(bool oldrcuformat){fOldRCUFormat=oldrcuformat;}
   Bool_t Next();
   Int_t GetRow();
   Int_t GetPad();
@@ -60,29 +59,26 @@ class AliHLTTPCDigitReaderPacked : public AliHLTTPCDigitReader{
 protected:
     
 private:
-  // Initialize AliROOT TPC raw stream parsing class
-  AliRawReaderMemory *fRawMemoryReader;
+    // Initialize AliROOT TPC raw stream parsing class
+    AliRawReaderMemory *fRawMemoryReader;
 
-  AliTPCRawStream *fTPCRawStream;
+    AliTPCRawStream *fTPCRawStream;
     
 #if ENABLE_PAD_SORTING 
-  Int_t fCurrentRow;
-  Int_t fCurrentPad;
-  Int_t fCurrentBin;
+    Int_t fCurrentRow;
+    Int_t fCurrentPad;
+    Int_t fCurrentBin;
  
-  Int_t fRowOffset;
-  Int_t fNRows;
+    Int_t fRowOffset;
+    Int_t fNRows;
 
-  Int_t fNMaxRows;
-  Int_t fNMaxPads;
-  Int_t fNTimeBins;
+    Int_t fNMaxRows;
+    Int_t fNMaxPads;
+    Int_t fNTimeBins;
 
-  Int_t *fData;
+    Int_t *fData;
 #endif // ENABLE_PAD_SORTING
-
-  Bool_t fOldRCUFormat;
-
-  ClassDef(AliHLTTPCDigitReaderPacked, 0)
+    ClassDef(AliHLTTPCDigitReaderPacked, 0)
 	
 };
 
diff --git a/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx b/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
index 16c7f149a8b..a15efb64184 100644
--- a/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
+++ b/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.cxx
@@ -47,11 +47,6 @@ AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked()
   fFirstRow(0),
   fLastRow(0)
 {
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
 }
 
 AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked(const AliHLTTPCDigitReaderUnpacked& src)
@@ -66,13 +61,11 @@ AliHLTTPCDigitReaderUnpacked::AliHLTTPCDigitReaderUnpacked(const AliHLTTPCDigitR
   fFirstRow(0),
   fLastRow(0)
 {
-  // see header file for class documentation
   HLTFatal("copy constructor not for use");
 }
 
 AliHLTTPCDigitReaderUnpacked& AliHLTTPCDigitReaderUnpacked::operator=(const AliHLTTPCDigitReaderUnpacked& src)
 {
-  // see header file for class documentation
   fDigitRowData=NULL;
   fActRowData=NULL;
   fData=NULL;
@@ -87,12 +80,10 @@ AliHLTTPCDigitReaderUnpacked& AliHLTTPCDigitReaderUnpacked::operator=(const AliH
 }
 
 AliHLTTPCDigitReaderUnpacked::~AliHLTTPCDigitReaderUnpacked(){
-  // see header file for class documentation
 }
 
 int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice){
-  // see header file for class documentation
-  AliHLTTPCUnpackedRawData *tmpptr=NULL;
+  AliHLTTPCUnpackedRawData *tmpptr;
   fPtr = ptr;
   fSize = size;
 
@@ -114,7 +105,6 @@ int AliHLTTPCDigitReaderUnpacked::InitBlock(void* ptr,unsigned long size, Int_t
 }
 
 bool AliHLTTPCDigitReaderUnpacked::Next(){
-  // see header file for class documentation
   bool rreadvalue = true;
 
   fBin++;
@@ -154,28 +144,24 @@ bool AliHLTTPCDigitReaderUnpacked::Next(){
 }
 
 int AliHLTTPCDigitReaderUnpacked::GetRow(){
-  // see header file for class documentation
   int rrow;
   rrow = fRow;
   return rrow;
 }
 
 int AliHLTTPCDigitReaderUnpacked::GetPad(){
-  // see header file for class documentation
   int rpad;
   rpad = (int)fData[fBin].fPad;
   return rpad   ;
 }
 
 int AliHLTTPCDigitReaderUnpacked::GetSignal(){ 
-  // see header file for class documentation
   int rsignal;
   rsignal = (int)fData[fBin].fCharge;
   return rsignal;
 }
 
 int AliHLTTPCDigitReaderUnpacked::GetTime(){
-  // see header file for class documentation
   int rtime;
   rtime = (int)fData[fBin].fTime;
   return rtime;
diff --git a/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.h b/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.h
index 2c30aeb5a47..c015d0e27c5 100644
--- a/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.h
+++ b/HLT/TPCLib/AliHLTTPCDigitReaderUnpacked.h
@@ -33,70 +33,27 @@ class AliHLTTPCDigitReaderUnpacked : public AliHLTTPCDigitReader{
   AliHLTTPCDigitReaderUnpacked& operator=(const AliHLTTPCDigitReaderUnpacked&);
   /** destructor */
   virtual ~AliHLTTPCDigitReaderUnpacked();
-
-  /**
-   * Init the reader
-   * @param ptr    pointer to input buffer
-   * @param size   size of the input buffer
-   * @param patch  readout partition
-   * @param slice  sector no
-   */  
+  
   int InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice);
-
-  /**
-   * place the reader at the next signal
-   * @return 1 if there was a nest signal, 0 if not
-   */
   bool Next();
-
-  /**
-   * Get row number of the current signal
-   * @return row number of the current signal
-   */
   int GetRow();
-
-  /**
-   * Get pad number of the current signal
-   * @return pad number of the current signal
-   */
   int GetPad();
-
-  /**
-   * Get signal
-   * @return ADC signal
-   */
   int GetSignal();
-
-  /**
-   * Get time of the current signal
-   * @return time of the current signal
-   */
   int GetTime();
   
 protected:
 
 
 private:
-  /** intermediate row data structure (pointer in fPtr buffer) */
   AliHLTTPCDigitRowData *fDigitRowData; //!
-  /** current row data structure (pointer in fPtr buffer) */
   AliHLTTPCDigitRowData *fActRowData; //!
-  /** the current digit data */
   AliHLTTPCDigitData *fData; //!
-
-  /** input buffer */
   void* fPtr; //!
-  /** size of the input buffer */
-  unsigned long fSize;                                             // see above
-
-  /** current bin */
-  Int_t fBin;                                                      // see above
-  /** current row */
-  Int_t fRow;                                                      // see above
-  /** first row */
-  Int_t fFirstRow;                                                 // see above
-  /** last row */
-  Int_t fLastRow;                                                  // see above
+  unsigned long fSize;
+  Int_t fBin;
+  Int_t fRow;
+  Int_t fFirstRow;
+  Int_t fLastRow;
 
   ClassDef(AliHLTTPCDigitReaderUnpacked, 0)
 };
diff --git a/HLT/TPCLib/AliHLTTPCLog.cxx b/HLT/TPCLib/AliHLTTPCLog.cxx
index ecc8c6b6659..ee03d378fe4 100644
--- a/HLT/TPCLib/AliHLTTPCLog.cxx
+++ b/HLT/TPCLib/AliHLTTPCLog.cxx
@@ -20,7 +20,6 @@ AliHLTLogging AliHLTTPCLog::fgHLTLogging;
 
 const char* AliHLTTPCLog::Flush()
 {
-  // see header file for class documentation
   int severity=0;
   string origin("");
   string keyword("");
diff --git a/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.cxx b/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.cxx
index 49b82ca5707..8ac1150cba0 100644
--- a/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.cxx
+++ b/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.cxx
@@ -30,6 +30,7 @@ using namespace std;
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCConfMapper.h"
 #include "AliHLTTPCVertex.h"
+#include "AliHLTTPCSpacePointData.h"
 #include "AliHLTTPCVertexData.h"
 #include "AliHLTTPCClusterDataFormat.h"
 #include "AliHLTTPCTransform.h"
@@ -38,15 +39,13 @@ using namespace std;
 #include "AliHLTTPCTrackletDataFormat.h"
 #include "AliHLTTPCInterMerger.h"
 #include "AliHLTTPCMemHandler.h"
-#include "AliHLTTPCDefinitions.h"
 //#include "AliHLTTPC.h"
-//#include 
-//#include 
+#include 
+#include 
 
 // this is a global object used for automatic component registration, do not use this
 AliHLTTPCSliceTrackerComponent gAliHLTTPCSliceTrackerComponent;
 
-/** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCSliceTrackerComponent)
 
 AliHLTTPCSliceTrackerComponent::AliHLTTPCSliceTrackerComponent()
@@ -99,7 +98,6 @@ AliHLTTPCSliceTrackerComponent& AliHLTTPCSliceTrackerComponent::operator=(const
 
 AliHLTTPCSliceTrackerComponent::~AliHLTTPCSliceTrackerComponent()
 {
-  // see header file for class documentation
 }
 
 // Public functions to implement AliHLTComponent's interface.
@@ -107,14 +105,12 @@ AliHLTTPCSliceTrackerComponent::~AliHLTTPCSliceTrackerComponent()
 
 const char* AliHLTTPCSliceTrackerComponent::GetComponentID()
 {
-  // see header file for class documentation
 
   return "TPCSliceTracker";
 }
 
 void AliHLTTPCSliceTrackerComponent::GetInputDataTypes( vector& list)
 {
-  // see header file for class documentation
   list.clear();
   list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
   list.push_back( AliHLTTPCDefinitions::fgkVertexDataType );
@@ -122,13 +118,11 @@ void AliHLTTPCSliceTrackerComponent::GetInputDataTypes( vectorSetClusterFinderParam( fXYClusterError, fZClusterError, kTRUE ); // ??
     //Set parameters input to the tracker
     //If no arguments are given, default parameters will be used
@@ -370,7 +362,6 @@ void AliHLTTPCSliceTrackerComponent::SetTrackerParam( bool doPP, int multiplicit
 	
 int AliHLTTPCSliceTrackerComponent::DoInit( int argc, const char** argv )
     {
-  // see header file for class documentation
     Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoInit", "DoInit", "DoInit()" );
 
     if ( fTracker || fVertex )
@@ -483,7 +474,6 @@ int AliHLTTPCSliceTrackerComponent::DoInit( int argc, const char** argv )
 
 int AliHLTTPCSliceTrackerComponent::DoDeinit()
 {
-  // see header file for class documentation
   if ( fTracker )
     delete fTracker;
   fTracker = NULL;
@@ -501,7 +491,6 @@ int AliHLTTPCSliceTrackerComponent::DoEvent( const AliHLTComponentEventData& evt
 					      AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
 					      AliHLTUInt32_t& size, vector& outputBlocks )
     {
-  // see header file for class documentation
     Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "DoEvent", "DoEvent()" );
     if ( evtData.fBlockCnt<=0 )
       {
@@ -717,8 +706,7 @@ int AliHLTTPCSliceTrackerComponent::DoEvent( const AliHLTComponentEventData& evt
       fpInterMerger->Merge();
     } 
     ntracks0=0;
-    AliHLTTPCTrackArray* pArray=fTracker->GetTracks();
-    mysize = pArray->WriteTracks( ntracks0, outPtr->fTracklets );
+    mysize = fTracker->GetTracks()->WriteTracks( ntracks0, outPtr->fTracklets );
     outPtr->fTrackletCnt = ntracks0;
 
     Logging( kHLTLogDebug, "HLT::TPCSliceTracker::DoEvent", "Tracks",
@@ -748,12 +736,4 @@ int AliHLTTPCSliceTrackerComponent::DoEvent( const AliHLTComponentEventData& evt
     return 0;
     }
 
-void AliHLTTPCSliceTrackerComponent::SetTrackerParam1()
-{
-  SetTrackerParam( 10, 20, 5, 10, 2,2,
-		   0, 1.31, 5, 100,
-		   50, 100, 50, 0.1, 0.1,
-		   true );
-}
-
 	
diff --git a/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h b/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h
index e9aa595f9bd..c4ab9484008 100644
--- a/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h
+++ b/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h
@@ -13,6 +13,7 @@
 */
 
 #include "AliHLTProcessor.h"
+#include "AliHLTTPCDefinitions.h"
 
 class AliHLTTPCConfMapper;
 class AliHLTTPCVertex;
@@ -42,63 +43,44 @@ class AliHLTTPCSliceTrackerComponent : public AliHLTProcessor
   /** destructor */
   virtual ~AliHLTTPCSliceTrackerComponent();
 
-  // Public functions to implement AliHLTComponent's interface.
-  // These functions are required for the registration process
+	// Public functions to implement AliHLTComponent's interface.
+	// These functions are required for the registration process
 
-  /** interface function, see @ref AliHLTComponent for description */
-  const char* GetComponentID();
-  /** interface function, see @ref AliHLTComponent for description */
-  void GetInputDataTypes( vector& list);
-  /** interface function, see @ref AliHLTComponent for description */
-  AliHLTComponentDataType GetOutputDataType();
-  /** interface function, see @ref AliHLTComponent for description */
-  virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-  /** interface function, see @ref AliHLTComponent for description */
-  AliHLTComponent* Spawn();
+	const char* GetComponentID();
+	void GetInputDataTypes( vector& list);
+	AliHLTComponentDataType GetOutputDataType();
+	virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+	AliHLTComponent* Spawn();
 
 protected:
-
-  /**
-   * Set Tracker parameters
-   * Knowledge on that has been lost, so somebody has to insert more
-   * documentation.
-   */	
-  void SetTrackerParam(Int_t phiSegments=50,Int_t etaSegments=100,
-		       Int_t trackletlength=3,Int_t tracklength=5,
-		       Int_t rowscopetracklet=2,Int_t rowscopetrack=3,
-		       Double_t minPtFit=0,Double_t maxangle=1.31,
-		       Double_t goodDist=5,Double_t hitChi2Cut=10,
-		       Double_t goodHitChi2=20,Double_t trackChi2Cut=50,
-		       Int_t maxdist=50,Double_t maxphi=0.1,Double_t maxeta=0.1,
-		       bool vertexconstraint=true);
-
-  /**
-   * Set Tracker parameters
-   * Knowledge on that has been lost, so somebody has to insert more
-   * documentation.
-   */
-  void SetTrackerParam( bool doPP, int multiplicity, double bField );
-
-  /**
-   * Set default tracker parameters
-   * Knowledge on that has been lost, so somebody has to insert more
-   * documentation.
-   */
-  void SetTrackerParam1();
-
-  // Protected functions to implement AliHLTComponent's interface.
-  // These functions provide initialization as well as the actual processing
-  // capabilities of the component. 
-
-  /** interface function, see @ref AliHLTComponent for description */
-  int DoInit( int argc, const char** argv );
-  /** interface function, see @ref AliHLTComponent for description */
-  int DoDeinit();
-  /** interface function, see @ref AliHLTComponent for description */
-  int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
-	       AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
-	       AliHLTUInt32_t& size, vector& outputBlocks );
-  
+	
+	void SetTrackerParam(Int_t phiSegments=50,Int_t etaSegments=100,
+			     Int_t trackletlength=3,Int_t tracklength=5,
+			     Int_t rowscopetracklet=2,Int_t rowscopetrack=3,
+			     Double_t minPtFit=0,Double_t maxangle=1.31,
+			     Double_t goodDist=5,Double_t hitChi2Cut=10,
+			     Double_t goodHitChi2=20,Double_t trackChi2Cut=50,
+			     Int_t maxdist=50,Double_t maxphi=0.1,Double_t maxeta=0.1,
+			     bool vertexconstraint=true);
+	void SetTrackerParam( bool doPP, int multiplicity, double bField );
+	void SetTrackerParam1()
+		{
+		SetTrackerParam( 10, 20, 5, 10, 2,2,
+				 0, 1.31, 5, 100,
+				 50, 100, 50, 0.1, 0.1,
+				 true );
+		}
+
+	// Protected functions to implement AliHLTComponent's interface.
+	// These functions provide initialization as well as the actual processing
+	// capabilities of the component. 
+
+	int DoInit( int argc, const char** argv );
+	int DoDeinit();
+	int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
+		     AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
+		     AliHLTUInt32_t& size, vector& outputBlocks );
+	
 private:
 
   /** instance of the tracker */
diff --git a/HLT/TRD/AliHLTTRDCalibrationComponent.cxx b/HLT/TRD/AliHLTTRDCalibrationComponent.cxx
index 8f6048f28d6..4a15e5ff628 100644
--- a/HLT/TRD/AliHLTTRDCalibrationComponent.cxx
+++ b/HLT/TRD/AliHLTTRDCalibrationComponent.cxx
@@ -48,9 +48,6 @@ ClassImp(AliHLTTRDCalibrationComponent)
     
 AliHLTTRDCalibrationComponent::AliHLTTRDCalibrationComponent()
 {
-  //
-  // default contructor
-  //
   fMCMtrigger = 0;
 
   fOutputPercentage = 100; // By default we copy to the output exactly what we got as input
@@ -65,41 +62,26 @@ AliHLTTRDCalibrationComponent::AliHLTTRDCalibrationComponent()
 
 AliHLTTRDCalibrationComponent::~AliHLTTRDCalibrationComponent()
 {
-  //
-  // default decontructor
-  //
 }
 
 const char* AliHLTTRDCalibrationComponent::GetComponentID()
 {
-  //
-  // return component id
-  //
   return "TRDCalibration"; // The ID of this component
 }
 
 void AliHLTTRDCalibrationComponent::GetInputDataTypes( vector& list)
 {
-  //
-  // insert input data type
-  //
   list.clear(); // We do not have any requirements for our input data type(s).
-  list.push_back( AliHLTTRDDefinitions::fgkDDLRawDataType );
+  list.push_back( AliHLTTRDDefinitions::gkDDLRawDataType );
 }
 
 AliHLTComponent_DataType AliHLTTRDCalibrationComponent::GetOutputDataType()
 {
-  //
-  // get the output data type
-  //
-  return AliHLTTRDDefinitions::fgkClusterDataType;
+  return AliHLTTRDDefinitions::gkClusterDataType;
 }
 
 void AliHLTTRDCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
 {
-  //
-  // get the ouput data size
-  //
   constBase = 0;
   inputMultiplier = ((double)fOutputPercentage)/100.0;
 }
@@ -108,17 +90,12 @@ void AliHLTTRDCalibrationComponent::GetOutputDataSize( unsigned long& constBase,
 // Spawn function, return new instance of this class
 AliHLTComponent* AliHLTTRDCalibrationComponent::Spawn()
 {
-  //
-  // spawn implementation
-  //
   return new AliHLTTRDCalibrationComponent;
 };
 
 int AliHLTTRDCalibrationComponent::DoInit( int argc, const char** argv )
 {
-  //
   // perform initialization. We check whether our relative output size is specified in the arguments.
-  //
   fOutputPercentage = 100;
   int i = 0;
   char* cpErr;
@@ -215,32 +192,32 @@ int AliHLTTRDCalibrationComponent::DoInit( int argc, const char** argv )
       return EINVAL;
     }
 
-  fCDB = AliCDBManager::Instance();
-  if (!fCDB)
+  cdb = AliCDBManager::Instance();
+  if (!cdb)
     {
-      Logging(kHLTLogError, "HLT::TRDCalibration::DoInit", "Could not get CDB instance", "fCDB 0x%x", fCDB);
+      Logging(kHLTLogError, "HLT::TRDCalibration::DoInit", "Could not get CDB instance", "cdb 0x%x", cdb);
     }
   else
     {
-      fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
-      fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
-      Logging(kHLTLogDebug, "HLT::TRDCalibration::DoInit", "CDB instance", "fCDB 0x%x", fCDB);
+      cdb->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
+      cdb->SetDefaultStorage(fStrorageDBpath.c_str());
+      Logging(kHLTLogDebug, "HLT::TRDCalibration::DoInit", "CDB instance", "cdb 0x%x", cdb);
     }
 
-  fCalibra = AliHLTTRDCalibra::Instance();
-  if (!fCalibra) 
+  calibra = AliHLTTRDCalibra::Instance();
+  if (!calibra) 
     {
-      Logging(kHLTLogError, "HLT::TRDCalibration::DoInit", "Could not get Calibra instance", "calibra 0x%x", fCalibra);
+      Logging(kHLTLogError, "HLT::TRDCalibration::DoInit", "Could not get Calibra instance", "calibra 0x%x", calibra);
     }
   else
     {
       // init the histograms for output!
-      fCalibra->SetOn();
-      fCalibra->Init2Dhistos();
-      Logging(kHLTLogDebug, "HLT::TRDCalibration::DoInit", "Calibra instance", "calibra 0x%x", fCalibra);
+      calibra->SetOn();
+      calibra->Init2Dhistos();
+      Logging(kHLTLogDebug, "HLT::TRDCalibration::DoInit", "Calibra instance", "calibra 0x%x", calibra);
     }  
 
-  fRmem = new AliRawReaderMemory;
+  rmem = new AliRawReaderMemory;
 
   fMCMtriggerParams = new AliTRDtrigParam("TRDMCMtriggerParams", "TRDMCMtriggerParams");
   fMCMtriggerParams->SetDebugLevel(fTriggerParDebugLevel);
@@ -256,14 +233,11 @@ int AliHLTTRDCalibrationComponent::DoInit( int argc, const char** argv )
 
 int AliHLTTRDCalibrationComponent::DoDeinit()
 {
-  //
-  // deinit component
-  //
   Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "destruct", "start");
 
-  Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "delete", "fRmem");
-  delete fRmem;
-  fRmem = 0;
+  Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "delete", "rmem");
+  delete rmem;
+  rmem = 0;
 
   Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "delete", "fMCMtriggerParams");
   delete fMCMtriggerParams;
@@ -273,18 +247,18 @@ int AliHLTTRDCalibrationComponent::DoDeinit()
   delete fMCMtrigger;
   fMCMtrigger = 0;
 
-  if (fCalibra)
+  if (calibra)
     {
-      Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "destroy", "fCalibra");
-      fCalibra->Destroy();
-      fCalibra = 0;
+      Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "destroy", "calibra");
+      calibra->Destroy();
+      calibra = 0;
     }
 
-  if (fCDB)
+  if (cdb)
     {
-      Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "destroy", "fCDB");
-      fCDB->Destroy();
-      fCDB = 0;
+      Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "destroy", "cdb");
+      cdb->Destroy();
+      cdb = 0;
     }
 
   Logging( kHLTLogDebug, "HLT::TRDCalibration::DoDeinit", "destruct", "all done!");
@@ -295,32 +269,29 @@ int AliHLTTRDCalibrationComponent::DoEvent( const AliHLTComponent_EventData& evt
 					    AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, 
 					    AliHLTUInt32_t& size, vector& outputBlocks )
 {
-  //
-  // analyze
-  //
   Logging( kHLTLogInfo, "HLT::TRDCalibration::DoEvent", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
   Logging( kHLTLogInfo, "HLT::TRDCalibration::DoEvent", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
   // Process an event
   unsigned long totalSize = 0;
-  AliHLTUInt32_t fDblockSpecification = 0;
+  AliHLTUInt32_t fDblock_Specification = 0;
 
   // Loop over all input blocks in the event
   for ( unsigned long i = 0; i < evtData.fBlockCnt; i++ )
     {
       char tmp1[14], tmp2[14];
       DataType2Text( blocks[i].fDataType, tmp1 );
-      DataType2Text( AliHLTTRDDefinitions::fgkDDLRawDataType, tmp2 );      
+      DataType2Text( AliHLTTRDDefinitions::gkDDLRawDataType, tmp2 );      
       Logging( kHLTLogDebug, "HLT::TRDCalibration::DoEvent", "Event received", 
 	       "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
 	       evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
 
-      if ( blocks[i].fDataType != AliHLTTRDDefinitions::fgkDDLRawDataType ) 
+      if ( blocks[i].fDataType != AliHLTTRDDefinitions::gkDDLRawDataType ) 
 	{
  	  Logging (kHLTLogError, "HLT::TRDCalibration::DoEvent", "COMPARE FAILED", "type=%d is type=%d",
- 		   blocks[i].fDataType, AliHLTTRDDefinitions::fgkDDLRawDataType);
+ 		   blocks[i].fDataType, AliHLTTRDDefinitions::gkDDLRawDataType);
 	  continue;
 	}
-      fDblockSpecification = blocks[i].fSpecification;
+      fDblock_Specification = blocks[i].fSpecification;
       unsigned long blockSize = blocks[i].fSize;
       totalSize += blockSize;
     }
@@ -337,7 +308,7 @@ int AliHLTTRDCalibrationComponent::DoEvent( const AliHLTComponent_EventData& evt
   unsigned long copied = 0;
   for ( unsigned long i = 0; i < evtData.fBlockCnt; i++ )
     {
-      if ( blocks[i].fDataType != AliHLTTRDDefinitions::fgkDDLRawDataType ) 
+      if ( blocks[i].fDataType != AliHLTTRDDefinitions::gkDDLRawDataType ) 
 	continue;
 
       void *pos = (void*)(pBuf + copied);
@@ -352,10 +323,10 @@ int AliHLTTRDCalibrationComponent::DoEvent( const AliHLTComponent_EventData& evt
 
   Logging( kHLTLogInfo, "HLT::TRDCalibration::DoEvent", "COPY STATS", "total=%lu copied=%lu", totalSize, copied);
 
-  fRmem->Reset();
-  fRmem->SetMemory((UChar_t*)memBufIn, totalSize);
-  //fRmem->Reset();
-  Bool_t ihead = fRmem->ReadHeader();
+  rmem->Reset();
+  rmem->SetMemory((UChar_t*)memBufIn, totalSize);
+  //rmem->Reset();
+  Bool_t ihead = rmem->ReadHeader();
   if (ihead == kTRUE)
     {
       Logging( kHLTLogInfo, "HLT::TRDCalibration::DoEvent", "HEADER", "Header read successfully");
@@ -367,7 +338,7 @@ int AliHLTTRDCalibrationComponent::DoEvent( const AliHLTComponent_EventData& evt
     }
 
   fMCMtrigger->ResetTree();
-  Bool_t ireadD = fMCMtrigger->ReadDigits(fRmem);
+  Bool_t ireadD = fMCMtrigger->ReadDigits(rmem);
   if (ireadD == kTRUE)
     {
       Logging( kHLTLogInfo, "HLT::TRDCalibration::DoEvent", "DIGITS", "Digits read successfully");
@@ -406,7 +377,7 @@ int AliHLTTRDCalibrationComponent::DoEvent( const AliHLTComponent_EventData& evt
       for (Int_t icb = 0; icb < tb->GetEntries(); icb++)
 	{
 	  tb->GetEntry(icb);
-	  PushBack(detTracklets, AliHLTTRDDefinitions::fgkMCMtrackletDataType, fDblockSpecification);
+	  PushBack(detTracklets, AliHLTTRDDefinitions::gkMCMtrackletDataType, fDblock_Specification);
 	}
     }
 
@@ -414,7 +385,7 @@ int AliHLTTRDCalibrationComponent::DoEvent( const AliHLTComponent_EventData& evt
   //gkMCMCalibrationDataType
 
   //AliHLTTRDCalibra *calibra = AliHLTTRDCalibra::Instance();
-  if (!fCalibra) 
+  if (!calibra) 
     {
       Logging( kHLTLogError, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Calibra not valid");
     }
@@ -422,23 +393,23 @@ int AliHLTTRDCalibrationComponent::DoEvent( const AliHLTComponent_EventData& evt
     {
       Logging( kHLTLogDebug, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Here we should put the histos...");
 //       //   TH2I            *GetCH2d();
-//       TH2I *chtmp = fCalibra->GetCH2d();
+//       TH2I *chtmp = calibra->GetCH2d();
 //       if (chtmp)
-// 	PushBack(chtmp, AliHLTTRDDefinitions::fgkMCMcalibrationDataType, fDblockSpecification);
+// 	PushBack(chtmp, AliHLTTRDDefinitions::gkMCMcalibrationDataType, fDblock_Specification);
 //       else
-// 	Logging( kHLTLogError, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Could not fCalibra->GetCH2d()");
+// 	Logging( kHLTLogError, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Could not calibra->GetCH2d()");
 //       //   TProfile2D      *GetPH2d();
-//       TProfile2D *phtmp = fCalibra->GetPH2d();
+//       TProfile2D *phtmp = calibra->GetPH2d();
 //       if (phtmp)
-// 	PushBack(phtmp, AliHLTTRDDefinitions::fgkMCMcalibrationDataType, fDblockSpecification);
+// 	PushBack(phtmp, AliHLTTRDDefinitions::gkMCMcalibrationDataType, fDblock_Specification);
 //       else
-//  	Logging( kHLTLogError, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Could not fCalibra->GetPH2d()");
+//  	Logging( kHLTLogError, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Could not calibra->GetPH2d()");
 //       //   TProfile2D      *GetPRF2d();
-//       TProfile2D *prf = fCalibra->GetPRF2d();
+//       TProfile2D *prf = calibra->GetPRF2d();
 //       if (prf)
-// 	PushBack(prf, AliHLTTRDDefinitions::fgkMCMcalibrationDataType, fDblockSpecification);      
+// 	PushBack(prf, AliHLTTRDDefinitions::gkMCMcalibrationDataType, fDblock_Specification);      
 //       else
-// 	Logging( kHLTLogError, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Could not fCalibra->GetPRF2d()");
+// 	Logging( kHLTLogError, "HLT::TRDCalibration::DoEvent", "OUTPUT", "Could not calibra->GetPRF2d()");
     }
 
   return 0;
diff --git a/HLT/TRD/AliHLTTRDCalibrationComponent.h b/HLT/TRD/AliHLTTRDCalibrationComponent.h
index 7fceafd9afd..10dac57e36f 100644
--- a/HLT/TRD/AliHLTTRDCalibrationComponent.h
+++ b/HLT/TRD/AliHLTTRDCalibrationComponent.h
@@ -57,20 +57,20 @@ class AliHLTTRDCalibrationComponent : public AliHLTProcessor
 
 	// The size of the output data produced, as a percentage of the input data's size.
 	// Can be greater than 100 (%)
-	unsigned fOutputPercentage; // The size of the output data produced in %
+	unsigned fOutputPercentage;
 
-	string fStrorageDBpath; // Path to DB
+	string fStrorageDBpath;
 
-	AliHLTTRDCalibra  *fCalibra; //! Calibration - Class for TRD tracklets
+	AliHLTTRDCalibra  *calibra; //!
 
-	AliTRDtriggerHLT *fMCMtrigger; //! Tracklet producer
-	AliTRDtrigParam   *fMCMtriggerParams; //! Trigger parameters
-	int fTriggerParDebugLevel; // Debug level for fMCMtriggerParams
-	double fLTUpTcut; // pT cut of LTU
-	double fBField; // Magnetic field magnitude
+	AliTRDtriggerHLT *fMCMtrigger; //!
+	AliTRDtrigParam   *fMCMtriggerParams; //!
+	int fTriggerParDebugLevel;
+	double fLTUpTcut;
+	double fBField;
 
-	AliCDBManager *fCDB; //! Pointer to OCDB 
-	AliRawReaderMemory *fRmem; //! Mem reader
+	AliCDBManager *cdb; //!
+	AliRawReaderMemory *rmem; //!
 	
 	ClassDef(AliHLTTRDCalibrationComponent, 0)
 
diff --git a/HLT/TRD/AliHLTTRDClusterizerComponent.cxx b/HLT/TRD/AliHLTTRDClusterizerComponent.cxx
index 39ecd5f423d..692ecd0e7ae 100644
--- a/HLT/TRD/AliHLTTRDClusterizerComponent.cxx
+++ b/HLT/TRD/AliHLTTRDClusterizerComponent.cxx
@@ -62,12 +62,12 @@ const char* AliHLTTRDClusterizerComponent::GetComponentID()
 void AliHLTTRDClusterizerComponent::GetInputDataTypes( vector& list)
 {
   list.clear(); // We do not have any requirements for our input data type(s).
-  list.push_back( AliHLTTRDDefinitions::fgkDDLRawDataType );
+  list.push_back( AliHLTTRDDefinitions::gkDDLRawDataType );
 }
 
 AliHLTComponent_DataType AliHLTTRDClusterizerComponent::GetOutputDataType()
 {
-  return AliHLTTRDDefinitions::fgkClusterDataType;
+  return AliHLTTRDDefinitions::gkClusterDataType;
 }
 
 void AliHLTTRDClusterizerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
@@ -193,15 +193,15 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponent_EventData& evt
     {
       char tmp1[14], tmp2[14];
       DataType2Text( blocks[i].fDataType, tmp1 );
-      DataType2Text( AliHLTTRDDefinitions::fgkDDLRawDataType, tmp2 );      
+      DataType2Text( AliHLTTRDDefinitions::gkDDLRawDataType, tmp2 );      
       Logging( kHLTLogDebug, "HLT::TRDClusterizer::DoEvent", "Event received", 
 	       "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
 	       evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
 
-      if ( blocks[i].fDataType != AliHLTTRDDefinitions::fgkDDLRawDataType ) 
+      if ( blocks[i].fDataType != AliHLTTRDDefinitions::gkDDLRawDataType ) 
 	{
  	  Logging (kHLTLogError, "HLT::TRDClusterizer::DoEvent", "COMPARE FAILED", "type=%d is type=%d",
- 		   blocks[i].fDataType, AliHLTTRDDefinitions::fgkDDLRawDataType);
+ 		   blocks[i].fDataType, AliHLTTRDDefinitions::gkDDLRawDataType);
 	  continue;
 	}
       fDblock_Specification = blocks[i].fSpecification;
@@ -221,7 +221,7 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponent_EventData& evt
   unsigned long copied = 0;
   for ( unsigned long i = 0; i < evtData.fBlockCnt; i++ )
     {
-      if ( blocks[i].fDataType != AliHLTTRDDefinitions::fgkDDLRawDataType ) 
+      if ( blocks[i].fDataType != AliHLTTRDDefinitions::gkDDLRawDataType ) 
 	continue;
 
       void *pos = (void*)(pBuf + copied);
@@ -293,7 +293,7 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponent_EventData& evt
       for (Int_t icb = 0; icb < tb->GetEntries(); icb++)
 	{
 	  tb->GetEntry(icb);
-	  PushBack(clusters, AliHLTTRDDefinitions::fgkClusterDataType, fDblock_Specification);
+	  PushBack(clusters, AliHLTTRDDefinitions::gkClusterDataType, fDblock_Specification);
 	}
     }
 
diff --git a/HLT/TRD/AliHLTTRDDefinitions.cxx b/HLT/TRD/AliHLTTRDDefinitions.cxx
index fed4f8e04d4..dc2d5814352 100644
--- a/HLT/TRD/AliHLTTRDDefinitions.cxx
+++ b/HLT/TRD/AliHLTTRDDefinitions.cxx
@@ -27,13 +27,13 @@
 
 ClassImp(AliHLTTRDDefinitions)
 
-const AliHLTComponentDataType AliHLTTRDDefinitions::fgkDDLRawDataType = { sizeof(AliHLTComponentDataType), {'D','D','L','_','R','A','W',' '},{'T','R','D',' '}};;
+const AliHLTComponentDataType AliHLTTRDDefinitions::gkDDLRawDataType = { sizeof(AliHLTComponentDataType), {'D','D','L','_','R','A','W',' '},{'T','R','D',' '}};;
 
-const AliHLTComponentDataType AliHLTTRDDefinitions::fgkClusterDataType = { sizeof(AliHLTComponentDataType), {'C','L','U','S','T','E','R','S'},{'T','R','D',' '}};;
+const AliHLTComponentDataType AliHLTTRDDefinitions::gkClusterDataType = { sizeof(AliHLTComponentDataType), {'C','L','U','S','T','E','R','S'},{'T','R','D',' '}};;
 
-const AliHLTComponentDataType AliHLTTRDDefinitions::fgkTRDSATracksDataType = { sizeof(AliHLTComponentDataType), {'T','R','A','C','K','S','S','A'},{'T','R','D',' '}};;
+const AliHLTComponentDataType AliHLTTRDDefinitions::gkTRDSATracksDataType = { sizeof(AliHLTComponentDataType), {'T','R','A','C','K','S','S','A'},{'T','R','D',' '}};;
 
-const AliHLTComponentDataType AliHLTTRDDefinitions::fgkMCMtrackletDataType = { sizeof(AliHLTComponentDataType), {'M','C','M','T','R','L','E','T'},{'T','R','D',' '}};;
+const AliHLTComponentDataType AliHLTTRDDefinitions::gkMCMtrackletDataType = { sizeof(AliHLTComponentDataType), {'M','C','M','T','R','L','E','T'},{'T','R','D',' '}};;
 
-const AliHLTComponentDataType AliHLTTRDDefinitions::fgkMCMcalibrationDataType = { sizeof(AliHLTComponentDataType), {'M','C','M','C','A','L','I','H'},{'T','R','D',' '}};;
+const AliHLTComponentDataType AliHLTTRDDefinitions::gkMCMcalibrationDataType = { sizeof(AliHLTComponentDataType), {'M','C','M','C','A','L','I','H'},{'T','R','D',' '}};;
 
diff --git a/HLT/TRD/AliHLTTRDDefinitions.h b/HLT/TRD/AliHLTTRDDefinitions.h
index 3bdcbfd73e5..2140394fc7e 100644
--- a/HLT/TRD/AliHLTTRDDefinitions.h
+++ b/HLT/TRD/AliHLTTRDDefinitions.h
@@ -10,28 +10,26 @@
  */
 
 #include "AliHLTDataTypes.h"
-#include "Rtypes.h"
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  The HLT definitions for TRD                                              //  
-//                                                                           //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
+#include "TObject.h"
 
 class AliHLTTRDDefinitions
-{
+    {
     public:
 
-      static const AliHLTComponentDataType fgkDDLRawDataType;
-      static const AliHLTComponentDataType fgkClusterDataType;
-      static const AliHLTComponentDataType fgkTRDSATracksDataType; // Stand Alone tracks
-      static const AliHLTComponentDataType fgkMCMtrackletDataType;
-      static const AliHLTComponentDataType fgkMCMcalibrationDataType;
+      static const AliHLTComponentDataType gkDDLRawDataType;
+      static const AliHLTComponentDataType gkClusterDataType;
+      static const AliHLTComponentDataType gkTRDSATracksDataType; // Stand Alone tracks
+      static const AliHLTComponentDataType gkMCMtrackletDataType;
+      static const AliHLTComponentDataType gkMCMcalibrationDataType;
       
       ClassDef(AliHLTTRDDefinitions, 0)
 
+    };
+
+typedef struct AliTRDDummyData
+{
+  char str[50];
+  long int val;
 };
 
 #endif
diff --git a/HLT/TRD/AliHLTTRDTrackerComponent.cxx b/HLT/TRD/AliHLTTRDTrackerComponent.cxx
index 04b90ebec1f..b7df3e98e51 100644
--- a/HLT/TRD/AliHLTTRDTrackerComponent.cxx
+++ b/HLT/TRD/AliHLTTRDTrackerComponent.cxx
@@ -74,12 +74,12 @@ const char* AliHLTTRDTrackerComponent::GetComponentID()
 void AliHLTTRDTrackerComponent::GetInputDataTypes( vector& list)
 {
   list.clear(); // We do not have any requirements for our input data type(s).
-  list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
+  list.push_back( AliHLTTRDDefinitions::gkClusterDataType );
 }
 
 AliHLTComponent_DataType AliHLTTRDTrackerComponent::GetOutputDataType()
 {
-  return AliHLTTRDDefinitions::fgkClusterDataType;
+  return AliHLTTRDDefinitions::gkClusterDataType;
 }
 
 void AliHLTTRDTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
@@ -224,7 +224,7 @@ int AliHLTTRDTrackerComponent::DoEvent( const AliHLTComponentEventData & evtData
 
   AliHLTUInt32_t fDblock_Specification = 0;
 
-  AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkClusterDataType );
+  AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::gkClusterDataType );
   if (dblock != 0)
     {
       fDblock_Specification = dblock->fSpecification;
@@ -236,7 +236,7 @@ int AliHLTTRDTrackerComponent::DoEvent( const AliHLTComponentEventData & evtData
     }
 
   int ibForce = 0;
-  TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkClusterDataType, "TObjArray", ibForce);
+  TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::gkClusterDataType, "TObjArray", ibForce);
   Logging( kHLTLogInfo, "HLT::TRDTracker::DoEvent", "1stBLOCK", "Pointer = 0x%x", tobjin);
 
 //   int iTotalClusterCounter = 0;
@@ -267,7 +267,7 @@ int AliHLTTRDTrackerComponent::DoEvent( const AliHLTComponentEventData & evtData
 // 	    }
 	  
 	  //Pass the data further...
-	  //PushBack(clusters, AliHLTTRDDefinitions::fgkClusterDataType, fDblock_Specification);
+	  //PushBack(clusters, AliHLTTRDDefinitions::gkClusterDataType, fDblock_Specification);
 	}
       else
 	{
diff --git a/HLT/configure.ac b/HLT/configure.ac
index 1b2332e2cbb..f3f091a42c2 100644
--- a/HLT/configure.ac
+++ b/HLT/configure.ac
@@ -5,7 +5,7 @@ dnl template for the configuration script for the Alice HLT
 dnl framework and components
 dnl 
 dnl ------------------------------------------------------------------
-AC_INIT([Alice High Level Trigger] , [0.7-dev], [Matthias.Richter@ift.uib.no], alice-hlt)
+AC_INIT([Alice High Level Trigger] , [0.6-dev], [Matthias.Richter@ift.uib.no], alice-hlt)
 
 dnl ------------------------------------------------------------------
 dnl the package from CVS contains the old Makefiles as well. In order to
@@ -194,8 +194,6 @@ if test ! "x$have_aliroot" = "xno" ; then
   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
 
   # CBD library is present since AliRoot version v4-05-00 (02.06.2006)
-  # in addition a circular dependency has been introduced in March 06 which
-  # requires to add libSTEER already here
   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS -lSTEER"
   CHECKLIB=CDB
   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
@@ -579,7 +577,6 @@ AC_CONFIG_FILES([Makefile
 		 BASE/setenv.sh
 		 BASE/setenv.csh
 		 BASE/util/Makefile
-		 BASE/interface/Makefile
 		 SampleLib/Makefile
 		 TPCLib/Makefile
 		 TPCLib/mapping2array.cxx
diff --git a/HLT/libAliHLTPHOS.pkg b/HLT/libAliHLTPHOS.pkg
index d478573d8c1..1cae3a6374d 100644
--- a/HLT/libAliHLTPHOS.pkg
+++ b/HLT/libAliHLTPHOS.pkg
@@ -17,21 +17,7 @@ SRCS:=  PHOS/AliHLTPHOSPulseGenerator.cxx \
 	PHOS/AliHLTPHOSFileWriter.cxx \
 	PHOS/AliHLTPHOSDDLPackedFileWriter.cxx \
 	PHOS/AliHLTPHOSCellEnergiesFileWriter.cxx \
-	PHOS/AliHLTPHOSHistogramProducerComponent.cxx \
-	PHOS/AliHLTPHOSRcuHistogramProducer.cxx \
-	PHOS/AliHLTPHOSRcuHistogramProducerComponent.cxx \
-	PHOS/AliHLTPHOSDDLDecoderComponent.cxx \
-	PHOS/AliHLTPHOSDataCorruptor.cxx \
-	PHOS/AliHLTPHOSDataQualityMonitor.cxx \
-	PHOS/AliHLTPHOSRcuDataQualityMonitorComponent.cxx \
-	PHOS/AliHLTPHOSProcessor.cxx \
-	PHOS/AliHLTPHOSClusterizer.cxx \
-	PHOS/AliHLTPHOSClusterizerComponent.cxx \
-	PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx \
-	PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx \
-	PHOS/AliHLTPHOSPhysicsAnalyzer.cxx \
-	PHOS/AliHLTPHOSPhysicsDefinitions.cxx \
-	PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx
+	PHOS/AliHLTPHOSHistogramProducerComponent.cxx
 
 HDRS:=  PHOS/AliHLTPHOSPulseGenerator.h \
 	PHOS/AliHLTPHOSRawAnalyzer.h \
@@ -54,27 +40,10 @@ HDRS:=  PHOS/AliHLTPHOSPulseGenerator.h \
 	PHOS/AliHLTPHOSDDLPackedFileWriter.h \
 	PHOS/AliHLTPHOSCellEnergiesFileWriter.h \
 	PHOS/AliHLTPHOSHistogramProducerComponent.h \
-	PHOS/AliHLTPHOSRcuHistogramProducer.h \
-	PHOS/AliHLTPHOSRcuHistogramProducerComponent.h \
-	PHOS/AliHLTPHOSDDLDecoderComponent.h \
 	PHOS/AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h \
 	PHOS/AliHLTPHOSModuleCellAverageEnergyDataStruct.h \
 	PHOS/AliHLTPHOSRcuChannelDataStruct.h \
-	PHOS/AliHLTPHOSValidChannelDataStruct.h \
-	PHOS/AliHLTPHOSDataCorruptor.h \
-	PHOS/AliHLTPHOSDataQualityMonitor.h \
-	PHOS/AliHLTPHOSRcuDataQualityMonitorComponent.h \
-	PHOS/AliHLTPHOSProcessor.h \
-	PHOS/AliHLTPHOSClusterizer.h \
-	PHOS/AliHLTPHOSClusterizerComponent.h \
-	PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h \
-	PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h \
-	PHOS/AliHLTPHOSPhysicsAnalyzer.h \
-	PHOS/AliHLTPHOSPhysicsDefinitions.h \
-	PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h \
-	PHOS/AliHLTPHOSRecPointDataStruct.h \
-	PHOS/AliHLTPHOSRecPointListDataStruct.h \
-	PHOS/AliHLTPHOSClusterDataStruct.h
+	PHOS/AliHLTPHOSValidChannelDataStruct.h 
 
 DHDR=   PHOS/AliHLTPHOSLinkDef.h
  					    
@@ -100,27 +69,10 @@ CLASS_HDRS:=	PHOS/AliHLTPHOSPulseGenerator.h \
 		PHOS/AliHLTPHOSDDLPackedFileWriter.h \
 		PHOS/AliHLTPHOSCellEnergiesFileWriter.h \
 		PHOS/AliHLTPHOSHistogramProducerComponent.h \
-		PHOS/AliHLTPHOSRcuHistogramProducer.h \
-		PHOS/AliHLTPHOSRcuHistogramProducerComponent.h \
-		PHOS/AliHLTPHOSDDLDecoderComponent.h \
 		PHOS/AliHLTPHOSModuleCellAccumulatedEnergyDataStruct.h \
 		PHOS/AliHLTPHOSModuleCellAverageEnergyDataStruct.h \
 		PHOS/AliHLTPHOSRcuChannelDataStruct.h \
-		PHOS/AliHLTPHOSValidChannelDataStruct.h \
-		PHOS/AliHLTPHOSDataCorruptor.h \
-		PHOS/AliHLTPHOSDataQualityMonitor.h \
-		PHOS/AliHLTRcuPHOSDataQualityMonitorComponent.h \
-		PHOS/AliHLTPHOSProcessor.h \
-		PHOS/AliHLTPHOSClusterizer.h \
-		PHOS/AliHLTPHOSClusterizerComponent.h \
-		PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h \
-		PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h \
-		PHOS/AliHLTPHOSPhysicsAnalyzer.h \
-		PHOS/AliHLTPHOSPhysicsDefinitions.h \
-		PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h \
-		PHOS/AliHLTPHOSRecPointDataStruct.h \
-		PHOS/AliHLTPHOSRecPointListDataStruct.h \
-		PHOS/AliHLTPHOSClusterDataStruct.h
+		PHOS/AliHLTPHOSValidChannelDataStruct.h 
 
 
 MODULE_SRCS:=   PHOS/AliHLTPHOSPulseGenerator.cxx \
@@ -140,23 +92,10 @@ MODULE_SRCS:=   PHOS/AliHLTPHOSPulseGenerator.cxx \
 		PHOS/AliHLTPHOSFileWriter.cxx \
 		PHOS/AliHLTPHOSDDLPackedFileWriter.cxx \
 		PHOS/AliHLTPHOSCellEnergiesFileWriter.cxx \
-		PHOS/AliHLTPHOSHistogramProducerComponent.cxx \
-		PHOS/AliHLTPHOSRcuHistogramProducer.cxx \
-		PHOS/AliHLTPHOSRcuHistogramProducerComponent.cxx \
-		PHOS/AliHLTPHOSDDLDecoderComponent.cxx \
-		PHOS/AliHLTPHOSDataCorruptor.cxx \
-		PHOS/AliHLTPHOSDataQualityMonitor.cxx \
-		PHOS/AliHLTPHOSRcuDataQualityMonitorComponent.cxx \
-		PHOS/AliHLTPHOSProcessor.cxx \
-		PHOS/AliHLTPHOSClusterizer.cxx \
-		PHOS/AliHLTPHOSClusterizerComponent.cxx \
-		PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx \
-		PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx \
-		PHOS/AliHLTPHOSPhysicsAnalyzer.cxx \
-		PHOS/AliHLTPHOSPhysicsDefinitions.cxx \
-		PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx
+		PHOS/AliHLTPHOSHistogramProducerComponent.cxx
 
-EINCLUDE+= HLT/BASE HLT/BASE/util HLT/src HLT/hough HLT/comp HLT/misc HLT/ITS HLT/MUON/src TPC ITS MUON STEER RAW PHOS
+
+EINCLUDE+= HLT/BASE HLT/BASE/util HLT/src HLT/hough HLT/comp HLT/misc HLT/ITS HLT/MUON/src TPC ITS MUON STEER RAW
 
 EDEFINE      := ${HLTDEFS}
 PACKCXXFLAGS := ${HLTCXXFLAGS}
diff --git a/HLT/libAliHLTTPC.pkg b/HLT/libAliHLTTPC.pkg
index 12545d13bc3..3614ff53e68 100644
--- a/HLT/libAliHLTTPC.pkg
+++ b/HLT/libAliHLTTPC.pkg
@@ -52,9 +52,6 @@ MODULE_SRCS= 	AliHLTTPCLog.cxx \
 		AliHLTTPCCATrackerComponent.cxx \
 		AliHLTTPCEsdWriterComponent.cxx
 
-#		AliHLTTPCCalibPedestalComponent.cxx \
-#		AliHLTTPCCalibSignalComponent.cxx
-
 CLASS_HDRS:=  	AliHLTTPCTransform.h \
 		AliHLTTPCMemHandler.h \
 		AliHLTTPCDataCompressorHelper.h \
@@ -104,9 +101,6 @@ CLASS_HDRS:=  	AliHLTTPCTransform.h \
 		AliHLTTPCCATrackerComponent.h \
 		AliHLTTPCEsdWriterComponent.h
 
-#		AliHLTTPCCalibPedestalComponent.h \
-#		AliHLTTPCCalibSignalComponent.h
-
 MODULE_HDRS:= 	$(CLASS_HDRS) \
 		AliHLTTPCLog.h \
 		AliHLTTPCLogging.h \
diff --git a/HLT/libHLTinterface.pkg b/HLT/libHLTinterface.pkg
deleted file mode 100644
index 2637f6de6e4..00000000000
--- a/HLT/libHLTinterface.pkg
+++ /dev/null
@@ -1,22 +0,0 @@
-#-*- Mode: Makefile -*-
-# $Id$
-
-MODULE_SRCS= 	AliHLTExternalInterface.cxx
-
-CLASS_HDRS:=  	
-
-MODULE_HDRS:= 	$(CLASS_HDRS)
-
-DHDR:= 		
-CINTAUTOLINK:=  1
-
-# SRCS:=$(patsubst %,BASE/interface/%,$(MODULE_SRCS))
-# CINTHDRS:=$(patsubst %,BASE/interface/%,$(CLASS_HDRS))
-# HDRS:=$(patsubst %,BASE/interface/%,$(MODULE_HDRS))
-
-EDEFINE      :=
-PACKCXXFLAGS :=
-PACKCFLAGS   :=
-PACKDCXXFLAGS:=
-
-EINCLUDE := HLT/BASE/interface HLT/BASE
diff --git a/HMPID/AliHMPID.cxx b/HMPID/AliHMPID.cxx
index 47a78b21f37..223addbc465 100644
--- a/HMPID/AliHMPID.cxx
+++ b/HMPID/AliHMPID.cxx
@@ -26,17 +26,16 @@
 #include         //HitQA()
 #include       //in many methods to print AliInfo 
 
+Bool_t AliHMPID::fgDoFeed=kTRUE;
+ 
 ClassImp(AliHMPID)    
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPID::AliHMPID(const char *name, const char *title):AliDetector(name,title),fDoFeed(kTRUE),fSdi(0),fDig(0),fClu(0)
+AliHMPID::AliHMPID(const char *name, const char *title):AliDetector(name,title),fSdi(0),fDig(0),fClu(0)
 {
 //Named ctor
   AliDebug(1,"Start.");
 //AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
   HitCreate();          gAlice->GetMCApp()->AddHitList(fHits);
-  
-  TString ttl=title;
-  fDoFeed=!ttl.Contains("NoFeedBack");
   AliDebug(1,"Stop.");
 }//AliHMPID::AliHMPID(const char *name, const char *title)
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/HMPID/AliHMPID.h b/HMPID/AliHMPID.h
index 52a12e16bbc..b648eecb82c 100644
--- a/HMPID/AliHMPID.h
+++ b/HMPID/AliHMPID.h
@@ -15,8 +15,8 @@ class AliHMPID : public AliDetector //TObject-TNamed-AliModule-AliDetector-AliHM
 {
 public:
 //ctor & dtor    
-            AliHMPID(const char *nm,const char *ttl);                                                           //named ctor
-            AliHMPID(                              ):AliDetector(    ),fDoFeed(kTRUE),fSdi(0),fDig(0),fClu(0) {}  //default ctor          
+            AliHMPID(const char *nm,const char *ttl);                                              //named ctor
+            AliHMPID(                              ):AliDetector(    ),fSdi(0),fDig(0),fClu(0) {}  //default ctor          
   virtual  ~AliHMPID();                                            
 //framework part  
           void  BuildGeometry   (                ) {}          //from AliModule invoked from AliMC::InitGeometry() to build geometry for old event display
@@ -29,6 +29,7 @@ class AliHMPID : public AliDetector //TObject-TNamed-AliModule-AliDetector-AliHM
           void  MakeBranch      (Option_t *opt="");            //from AliModule invokde from AliRun::Tree2Tree() to make requested HMPID branch
           void  SetTreeAddress  (                );            //from AliModule invoked from AliRun::GetEvent(), AliLoader::SetTAddrInDet()
   virtual void  StepManager     (                )=0;          //from AliModule invoked from AliMC
+          void  DoFeed          (Bool_t doFeed   ){fgDoFeed=doFeed;} // Set feedback photons
 //private part +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
   void          HitCreate(         )     {if(fHits)return; fHits=new TClonesArray("AliHMPIDHit"); fNhits=0;     }//create hits list
               
@@ -50,7 +51,7 @@ class AliHMPID : public AliDetector //TObject-TNamed-AliModule-AliDetector-AliHM
     fClu=new TObjArray(7); for(Int_t i=0;i<7;i++)fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);            }//create clusters list
          void   CluReset (         )     {if(fClu)for(int i=0;i<7;i++)fClu->At(i)->Clear();                     }//clean clusters list
 protected:  
-  Bool_t                fDoFeed;                  //! Flag to switch on/off Feedback photon creation
+  static  Bool_t fgDoFeed;                        //Flag to switch on/off Feedback photon creation
   TClonesArray         *fSdi;                     //! list of sdigits  
   TObjArray            *fDig;                     //! each chamber holds it's one list of digits
   TObjArray            *fClu;                     //! each chamber holds it's one list of clusters 
diff --git a/HMPID/AliHMPIDDigit.h b/HMPID/AliHMPIDDigit.h
index a9c5136187d..b9d28be8d58 100644
--- a/HMPID/AliHMPIDDigit.h
+++ b/HMPID/AliHMPIDDigit.h
@@ -39,7 +39,7 @@ class AliHMPIDDigit :public AliDigit //TObject-AliDigit-AliHMPIDDigit
   static Int_t   A2Y         (Int_t pad                      )     {return pad%1000;                                                 } //abs pad -> pad Y 
          void    AddTidOffset(Int_t offset                   )     {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset;  } //needed for merging
          Int_t   Ch          (                               )const{return A2C(fPad);                                                } //chamber number
-  static Bool_t  IsOverTh    (Float_t q                      )     {return q >= fgSigmas;                                            } //is digit over threshold?
+  static Bool_t  IsOverTh    (Float_t q                      )     {return q >= fgSigmas;                                            } //is digit over threshold????
   static Bool_t  IsInside    (Float_t x,Float_t y,Float_t margin=0){return x>-margin&&y>-margin&&x(w32,ddl,r,d,a)
   inline void    Raw         (UInt_t  w32,Int_t  ddl         );                                                                        //(w32,ddl)->digit
-  inline void    Raw         (Int_t ddl,Int_t r,Int_t d,Int_t a);                                                                      //raw->abs pad number
   inline Bool_t  Set         (Int_t c,Int_t p,Int_t x,Int_t y,Int_t tid=0);                                                            //manual creation 
          void    SetQ        (Float_t q                      )     {fQ=q;}                                                             //manual creation 
-         void    SetNsig     (Int_t sigmas                   )     {fgSigmas=sigmas;}                                                  //set n sigmas 
+         void    SetSigmas   (Int_t sigmas                   )     {fgSigmas=sigmas;}                                                  //manual creation 
   static void    WriteRaw    (TObjArray *pDigLst             );                                                                        //write as raw stream     
   
   static Float_t CathAnoCath (                               )     {return 0.445;}                                                     //Cathode-Anode-cathode pitch
@@ -66,7 +65,7 @@ class AliHMPIDDigit :public AliDigit //TObject-AliDigit-AliHMPIDDigit
   static Float_t MaxPcY      (Int_t iPc                      )     {return fgkMaxPcY[iPc];}                                            // PC limits
   static Float_t MinPcX      (Int_t iPc                      )     {return fgkMinPcX[iPc];}                                            // PC limits
   static Float_t MinPcY      (Int_t iPc                      )     {return fgkMinPcY[iPc];}                                            // PC limits
-  static Int_t   Nsig        (                               )     {return fgSigmas;}                                                  //Getter n. sigmas for noise
+  static Int_t   Sigmas      (                               )     {return fgSigmas;}                                                  // Getter n. sigmas for noise
   static Float_t SizeAllX    (                               )     {return fgkMaxPcX[5];}                                              //all PCs size x, [cm]        
   static Float_t SizeAllY    (                               )     {return fgkMaxPcY[5];}                                              //all PCs size y, [cm]    
   static Float_t SizeArea    (                               )     {return SizePcX()*SizePcY()*(kMaxPc-kMinPc+1);}                     //sence area, [cm^2]  
@@ -81,7 +80,7 @@ class AliHMPIDDigit :public AliDigit //TObject-AliDigit-AliHMPIDDigit
   inline static Bool_t IsInDead(Float_t x,Float_t y        );                                                                          //is point in dead area?
   inline static void   Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py);                                                    //(x,y)->(pc,px,py) 
 protected:                                                                   //AliDigit has fTracks[3]
-  static Int_t fgSigmas;                                                                                                               //n. sigma to cut on charge 
+  static Int_t fgSigmas;                                                                                                               //sigma cut on charge 
   static const Float_t fgkMinPcX[6];                                                                                                   //limits PC
   static const Float_t fgkMinPcY[6];                                                                                                   //limits PC
   static const Float_t fgkMaxPcX[6];                                                                                                   //limits PC
@@ -179,26 +178,17 @@ void AliHMPIDDigit::Raw(UInt_t w32,Int_t ddl)
 // Arguments: w32 - 32 bits raw data word
 //            ddl - DDL idx  0 1 2 3 4 ... 13
 //   Returns: none
+  Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip)
   Int_t r = AliBitPacking::UnpackWord(w32,22,26); assert(1<=r&&r<=24);   //                                         Row number      (1..24)    
   Int_t d = AliBitPacking::UnpackWord(w32,18,21); assert(1<=d&&d<=10);   // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC number  (1..10)
   Int_t a = AliBitPacking::UnpackWord(w32,12,17); assert(0<=a&&a<=47);   // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC address (0..47)  
-  Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc             (0..4095) 
-  Raw(ddl,r,d,a);
-  fQ=q;
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDDigit::Raw(Int_t ddl,Int_t r,Int_t d,Int_t a)
-{
-  assert(0<=ddl&&ddl<=13); assert(1<=r&&r<=24); assert(1<=d&&d<=10);   assert(0<=a&&a<=47);  
-  Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip)
+  Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc             (0..4095)   
                                   Int_t ch=ddl/2;
   Int_t tmp=(r-1)/8;              Int_t pc=(ddl%2)? 5-2*tmp:2*tmp; 
                                   Int_t px=(d-1)*8+a/6;
         tmp=(ddl%2)?(24-r):r-1;   Int_t py=6*(tmp%8)+a2y[a%6];
-  fPad=Abs(ch,pc,px,py);
+  fPad=Abs(ch,pc,px,py);fQ=q;
 }
-
-
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t AliHMPIDDigit::Set(Int_t ch,Int_t pc,Int_t px,Int_t py,Int_t tid)
 {
diff --git a/HMPID/AliHMPIDParam.h b/HMPID/AliHMPIDParam.h
index 9c68b307bbe..82f950f3c53 100644
--- a/HMPID/AliHMPIDParam.h
+++ b/HMPID/AliHMPIDParam.h
@@ -33,14 +33,14 @@ class AliHMPIDParam :public TNamed
   //trasformation methodes
   void     Lors2Mars   (Int_t c,Float_t x,Float_t y,Double_t *m,Int_t pl=kPc)const{Double_t z=0; switch(pl){case kPc:z=8.0;break; case kAnod:z=7.806;break; case kRad:z=-1.25; break;}   Double_t l[3]={x-fX,y-fY,z};  fM[c]->LocalToMaster(l,m); }    
   TVector3 Lors2Mars   (Int_t c,Float_t x,Float_t y,            Int_t pl=kPc)const{Double_t m[3];Lors2Mars(c,x,y,m,pl); return TVector3(m);    }//MRS->LRS  
-  void     Mars2Lors   (Int_t c,Double_t *m,Float_t &x ,Float_t &y          )const{Double_t l[3];fM[c]->MasterToLocal(m,l);x=l[0]+fX;y=l[1]+fY;}//MRS->LRS
+  void     Mars2Lors   (Int_t c,Double_t *m,Float_t &x,Float_t &y           )const{Double_t l[3];fM[c]->MasterToLocal(m,l);x=l[0]+fX;y=l[1]+fY;}//MRS->LRS
   void     Mars2LorsVec(Int_t c,Double_t *m,Float_t &th,Float_t &ph         )const{Double_t l[3]; fM[c]->MasterToLocalVect(m,l); 
                                                                                    Float_t pt=TMath::Sqrt(l[0]*l[0]+l[1]*l[1]); 
                                                                                            th=TMath::ATan(pt/l[2]); 
                                                                                            ph=TMath::ATan2(l[1],l[0]);}    
   TVector3 Norm        (Int_t c                                             )const{Double_t n[3]; Norm(c,n); return TVector3(n);               }//norm 
   void     Norm        (Int_t c,Double_t *n                                 )const{Double_t l[3]={0,0,1};fM[c]->LocalToMasterVect(l,n);        }//norm
-  void     Point       (Int_t c,Double_t *p,Int_t plane                     )const{Lors2Mars(c,0,0,p,plane);}      //point of given chamber plane
+  
   enum EPlaneId {kPc,kRad,kAnod};            //3 planes in chamber 
 protected:
          AliHMPIDParam();             //default ctor is protected to enforce it to be singleton
diff --git a/HMPID/AliHMPIDPreprocessor.cxx b/HMPID/AliHMPIDPreprocessor.cxx
index f0be8855646..232a7176f91 100644
--- a/HMPID/AliHMPIDPreprocessor.cxx
+++ b/HMPID/AliHMPIDPreprocessor.cxx
@@ -1,15 +1,12 @@
-#include "AliHMPIDPreprocessor.h" //header no includes
-#include "AliHMPIDDigit.h"        //ProcPed()
-#include             //ProcPed()  
-#include        //ProcPed(), ProcDcs()
-#include           //ProcDcs()
-#include            //ProcDcs(), ProcPed()
-#include                   //Process()
-#include                   //Process()
-#include                //Process()
-#include               //ProcPed()
-#include                 //ProcPed()
-#include               //ProcPed()
+#include "AliHMPIDPreprocessor.h" //header
+
+#include 
+#include       
+#include               //Process()
+#include               //Process()
+#include            //Process()
+#include            //Process() 
+
 //.
 // HMPID Preprocessor base class
 //.
@@ -17,6 +14,11 @@
 //.
 ClassImp(AliHMPIDPreprocessor)
 
+char *AliHMPIDPreprocessor::fgP ="HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value";
+char *AliHMPIDPreprocessor::fgT1="HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp";
+char *AliHMPIDPreprocessor::fgT2="HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp";
+char *AliHMPIDPreprocessor::fgHV="HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon";
+
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime)
 {
@@ -25,102 +27,74 @@ void AliHMPIDPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 UInt_t AliHMPIDPreprocessor::Process(TMap* pMap)
 {
-// Process all information from DCS and DAQ
-// Arguments: pMap- map of DCS aliases
-//   Returns: 0 on success or 1 on error    
-  if(! pMap)                     return 1; 
-  if(ProcDcs(pMap) && ProcPed()) return 0;
-  else                           return 1;     
-}//Process()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDPreprocessor::ProcDcs(TMap* pMap)
-{
 // Process: 1. inlet and outlet C6F14 temperature, stores TObjArray of 21 TF1, where TF1 is Nmean=f(t), one per radiator
 //          2. CH4 pressure and HV                 stores TObjArray of 7 TF1 where TF1 is thr=f(t), one per chamber
 // Arguments: pDcsMap - map of structure "alias name" - TObjArray of AliDCSValue
 // Assume that: HV is the same during the run for a given chamber, different chambers might have different HV
-//              P=f(t), different for different chambers
-// Returns: kTRUE on success  
+//              P=f(t), different for different chambers     
+     
+//  TList* list = GetFileSources(kDAQ, "MAP"); //first analyse a set of pedestal files
+//  if (list){
+//    Log("The following sources produced files with the id MAP");
+//    list->Print();
+//    delete list;
+//  }
+
+
+  if(!pMap)  return 0;                    //no DCS map provided 
+  Double_t sor=0,eor=1500;
 
   TF2 idx("RidxC4F14","sqrt(1+0.554*(1239.84/x)^2/((1239.84/x)^2-5796)-0.0005*(y-20))",5.5 ,8.5 ,0  ,50);  //N=f(Ephot,T) [eV,grad C] DiMauro mail
+  TF2 thr("RthrCH4"  ,"x+170745848*exp(-y*0.0162012)"                                                      ,2000,3000,900,1200); //thr=f(HV,P)  [V,mBar]
+//  Double_t eMean=6.67786;                                                                                  //mean energy of photon defined  by transperancy window
   
-// Qthr=f(HV,P) [V,mBar]  logA0=k*HV+b is taken from p. 64 TDR plot 2.59 for PC32 
-//                           A0=f(P) is taken from DiMauro mail
-// Qthr is estimated as 3*A0
-  TF2 thr("RthrCH4"  ,"3*10^(3.01e-3*x-4.72)+170745848*exp(-y*0.0162012)"             ,2000,3000,900,1200); 
-  
-  TObjArray arTmean(21); arTmean.SetOwner(kTRUE);     //21 Tmean=f(time) one per radiator
-  TObjArray arPress(7);  arPress.SetOwner(kTRUE);     //7  Press=f(time) one pre chamber
+//  TObjArray arTmean(21); arTmean.SetOwner(kTRUE);     //21 Tmean=f(time) one per radiator
+//  TObjArray arPress(7);  arPress.SetOwner(kTRUE);     //7  Press=f(time) one pre chamber
   TObjArray arNmean(21); arNmean.SetOwner(kTRUE);     //21 Nmean=f(time) one per radiator
   TObjArray arQthre(7);  arQthre.SetOwner(kTRUE);     //7  Qthre=f(time) one pre chamber
   
-  AliDCSValue *pVal; Int_t cnt=0;
+//  AliDCSValue *pVal; Int_t cnt=0;
     
-  for(Int_t iCh=0;iCh<7;iCh++){                   
-//    TObjArray *pHV=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh,iCh)); //HV
-    TObjArray *pP =(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value"           ,iCh,iCh,iCh));    TIter nextP(pP);
-    TGraph *pGrP=new TGraph; cnt=0; while((pVal=(AliDCSValue*)nextP())) pGrP->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());            //P
+  for(Int_t iCh=0;iCh<7;iCh++){            
+ //   TObjArray *pHV=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh,iCh)); //HV
+//    pVal=(AliDCSValue*)pHV->At(0); Float_t hv=pVal->GetFloat();//HV    
 
-    pGrP->Fit(new TF1(Form("P%i",iCh),"1005",fStartTime,fEndTime),"Q"); delete pGrP;
-    arQthre.AddAt(new TF1(Form("HMP_Qthre%i",iCh),"100",fStartTime,fEndTime),iCh);    
-    
+//    TObjArray *pP =(TObjArray*)pMap->GetValue(Form(fP,iCh,iCh,iCh)); //P
+//    TGraph *pGrP; cnt=0;TIter nextp(pP); while((pVal=(AliDCSValue*)nextp())) pGrP->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //P
+                                                                         
+//    TF1 *pFuP=new TF1(Form("P%i",iCh),"1005",sor,eor); 
+//    pGrP->Fit(pFuP,"Q"); delete pGrP;
+    TF1 *pFuQ=new TF1(Form("HMP_Qthre%i",iCh),"100",sor,eor);
+    arQthre.AddAt(pFuQ,iCh);    
     for(Int_t iRad=0;iRad<3;iRad++){
-      TObjArray *pT1=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad));  TIter nextT1(pT1);//Tin
-      TObjArray *pT2=(TObjArray*)pMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp",iCh,iCh,iRad)); TIter nextT2(pT2);//Tout      
-      TGraph *pGrT1=new TGraph; cnt=0;  while((pVal=(AliDCSValue*)nextT1())) pGrT1->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //T inlet
-      TGraph *pGrT2=new TGraph; cnt=0;  while((pVal=(AliDCSValue*)nextT2())) pGrT2->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //T outlet 
-      pGrT1->Fit(new TF1(Form("Tin%i%i",iCh,iRad),"[0]+[1]*x+[2]*sin([3]*x)",fStartTime,fEndTime),"Q");       //fit Tin graph 
-      pGrT2->Fit(new TF1(Form("Tou%i%i",iCh,iRad),"[0]+[1]*x+[2]*sin([3]*x)",fStartTime,fEndTime),"Q");       //fit Tout graph 
-
-      delete pGrT1;  delete pGrT2;
-            
+//      TObjArray *pT1=(TObjArray*)pMap->GetValue(Form(fT1,iCh,iCh,iRad)); //Tin
+//      TGraph *pGrT1=new TGraph; cnt=0; TIter next1(pT1); while((pVal=(AliDCSValue*)next1())) pGrT1->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //inlet temperature
+//      pGrT1->Fit(new TF1(Form("Tin%i%i",iCh,iRad),"[0]+[1]*x+[2]*sin([3]*x)",sor,eor),"Q");       //now fit the temp graph 
+      
+//      TObjArray *pT2=(TObjArray*)pMap->GetValue(Form(fT2,iCh,iCh,iRad));//Tout      
+//      TGraph *pGrT2=new TGraph; cnt=0; TIter next2(pT2); while((pVal=(AliDCSValue*)next2())) pGrT2->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat()); //outlet temperature
+//      TF1*pFuT1=new TF1(Form("Tout%i%i",iCh,iRad),"13",sor,eor)      
+//      pGrT2->Fit(,"Q");       //now fit the temp graph 
+      
 //      arTmean.Add(pRadTempF);  
-      arNmean.AddAt(new TF1(Form("HMP_Nmean%i-%i",iCh,iRad),"1.292",fStartTime,fEndTime),3*iCh+iRad); //Nmean=f(t)
+      TF1 *pFuN=new TF1(Form("HMP_Nmean%i-%i",iCh,iRad),"1.292",sor,eor); pFuN->SetLineColor(iRad+2); pFuN->SetLineWidth(1);
+      arNmean.AddAt(pFuN,3*iCh+iRad);
+//      delete pGrT1;  delete pGrT2;
     }//radiators loop
   }//chambers loop
   
   AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliHMPIDPreprocessor"); metaData.SetComment("SIMULATED");
+
   
-//  Store("Calib", "Press" , &arPress , &metaData)  Store("Calib", "Tmean" , &arTmean , &metaData);
+  arQthre.Print();
+//  Store("Calib", "Press" , &arPress , &metaData); 
+//  Store("Calib", "Tmean" , &arTmean , &metaData); 
+
+  if( Store("Calib", "Qthre" , &arQthre , &metaData) == kTRUE && Store("Calib", "Nmean" , &arNmean , &metaData) == kTRUE ) return 0;   //clm: compatibility with new Store and preprocessor requirement
+  else return 1;
   
-  if(Store("Calib","Qthre",&arQthre,&metaData,0,kTRUE) && Store("Calib","Nmean",&arNmean,&metaData,0,kTRUE) ) return kTRUE; //all OK
-  else                                                                                                        return 1;
+  //  AliInfo("End.");  
+
 }//Process()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDPreprocessor::ProcPed()
-{
-// Process pedestal files and create 7 M(padx,pady)=sigma, one for each chamber
-// Arguments:
-//   Returns:    
-  TObjArray aDaqSig(7); aDaqSig.SetOwner(kTRUE); for(Int_t i=0;i<7;i++) aDaqSig.AddAt(new TMatrix(160,144),i); //TObjArray of 7 TMatrixF, m(padx,pady)=sigma
   
-  TList *pLdc=GetFileSources(kDAQ,"pedestals"); //get list of LDC names containing id "pedestals"
-  for(Int_t i=0;iGetEntries();i++)//lists of LDCs
-    gSystem->Exec(Form("tar xzf %s",GetFile(kDAQ,"pedestals",((TObjString*)pLdc->At(i))->GetName()))); //untar pedestal files from current LDC
-  AliHMPIDDigit dig;
-  Int_t nSigCut,r,d,a,hard;  Float_t mean,sigma;
-  for(Int_t ddl=0;ddl<14;ddl++){  
-    ifstream infile(Form("HmpidPedDdl%02i.txt",ddl));
-    if(!infile.is_open()) return kFALSE;
-    TMatrix *pM=(TMatrixF*)aDaqSig.At(ddl/2);
-    infile>>nSigCut; pM->SetUniqueID(nSigCut); //n. of pedestal distribution sigmas used to create zero suppresion table
-    while(!infile.eof()){
-      infile>>dec>>r>>d>>a>>mean>>sigma>>hex>>hard;      
-      dig.Raw(ddl,r,d,a);
-      (*pM)(dig.PadChX(),dig.PadChY()) = sigma;
-    }
-    infile.close();
-  }
-//  gSystem->Exec("rm -rf HmpidPed*");
-  AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliHMPIDPreprocessor"); metaData.SetComment("SIMULATED");
-  return Store("Calib","DaqSig",&aDaqSig,&metaData,0,kTRUE);
-}//ProcPed()  
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Double_t ProcTrans()
-{
-// Process transparency monitoring data and calculates Emean  
-  Double_t eMean=6.67786;     //mean energy of photon defined  by transperancy window
-  return eMean;
-}   
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 
diff --git a/HMPID/AliHMPIDPreprocessor.h b/HMPID/AliHMPIDPreprocessor.h
index 9eaa263ee92..7f8736a4505 100644
--- a/HMPID/AliHMPIDPreprocessor.h
+++ b/HMPID/AliHMPIDPreprocessor.h
@@ -13,11 +13,14 @@ class AliHMPIDPreprocessor : public AliPreprocessor
 public:
            AliHMPIDPreprocessor(AliShuttleInterface* pShuttle):AliPreprocessor("HMP",pShuttle) {}
   virtual ~AliHMPIDPreprocessor(                             )                                 {}
+  
 protected:
-  virtual void   Initialize(Int_t run, UInt_t startTime, UInt_t endTime); //
-  virtual UInt_t Process   (TMap* pDcsMap                              ); //process everthing
-          Bool_t ProcDcs   (TMap* pDcsMap                              ); //process DCS data points
-          Bool_t ProcPed   (                                           ); //process pedestal files
+  static char    *fgP;     // Name of the aliases provided by the DCS
+  static char    *fgHV;    // Name of the aliases provided by the DCS
+  static char    *fgT1;    // Name of the aliases provided by the DCS
+  static char    *fgT2;    // Name of the aliases provided by the DCS
+  virtual void   Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+  virtual UInt_t Process   (TMap* pDcsMap                              );
   ClassDef(AliHMPIDPreprocessor, 0);
 };
 
diff --git a/HMPID/AliHMPIDQaEsd.C b/HMPID/AliHMPIDQaEsd.C
deleted file mode 100644
index 492c6f5bb49..00000000000
--- a/HMPID/AliHMPIDQaEsd.C
+++ /dev/null
@@ -1,209 +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.                  *
- **************************************************************************/
-
-#include 
-#include 
-#include 
-#include  
-#include 
-#include 
-#include  
-#include 
-#include  
-
-#include  
-#include 
-#include 
-
-#include     //qa()
-#include  //qa()
-#include          //qa()
-#include              //qa()
-
-class AliHMPIDQaEsd : public AliAnalysisTask {
-
-public:
-           AliHMPIDQaEsd() ;
-  virtual ~AliHMPIDQaEsd() ;
-   
-  virtual void Exec(Option_t * opt = "") ;
-  virtual void ConnectInputData(Option_t *);
-  virtual void CreateOutputObjects();
-  virtual void Terminate(Option_t * opt = "");
-
-private:
-  TTree   * fChain ;            //!pointer to the analyzed TTree or TChain
-  AliESD  * fESD ;              //! Declaration of leave types
-
-  TObjArray * fOutputContainer; //output data container
-
-  ClassDef(AliHMPIDQaEsd,0); // 
-};
-
-
-
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPIDQaEsd::AliHMPIDQaEsd():AliAnalysisTask("HmpidQaTask",""), fChain(0), fESD(0)
-{
-// Constructor.
-  DefineInput (0,TChain::Class());           // Input slot #0 works with an Ntuple  
-  DefineOutput(0,TObjArray::Class()) ;   // Output slot #0 writes into a TH1 container
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPIDQaEsd::~AliHMPIDQaEsd()
-{
-  // dtor
-  fOutputContainer->Clear() ;   delete fOutputContainer ; 
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDQaEsd::ConnectInputData(const Option_t*)
-{
-//Virtual from AliAnalysisTask invoked by AliAnalysisTask::CheckNotify() which in turn invoked by AliAnalysisDataContainer::SetData()
-  fChain = dynamic_cast(GetInputData(0)) ;
-  if (!fChain) {AliError(Form("Input 0 for %s not found\n", GetName())); return;}
-  
-  // One should first check if the branch address was taken by some other task
-  char ** address = (char **)GetBranchAddress(0, "ESD");
-  if (address) {
-    fESD = (AliESD*)(*address);
-  } else {
-    fESD = new AliESD();
-    SetBranchAddress(0, "ESD", &fESD);
-    fChain->SetBranchStatus("*", 1);
-    fChain->SetBranchStatus("fTracks.*", 1);
-  }
-}//ConnectInputData()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDQaEsd::CreateOutputObjects()
-{  
- 
-
-  // create output container
-  fOutputContainer = new TObjArray(9) ;  fOutputContainer->SetName(GetName()) ; 
-
-  fOutputContainer->AddAt(new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]"   , 150,   0,  7  ,100, 0, 1)  ,      0) ; 
-  fOutputContainer->AddAt(new TH2F("SigP"  ,"#sigma_{#theta_c} [mrad];[GeV]", 150,   0,  7  ,100, 0, 1)  ,      1) ; 
-  fOutputContainer->AddAt(new TH2F("MipXY" ,"mip position"                  , 260,   0,130  ,252, 0,126) ,      2) ; 
-  fOutputContainer->AddAt(new TH2F("DifXY" ,"diff"                          , 200, -10, 10  ,200,-10,10) ,      3) ; 
-  fOutputContainer->AddAt(new TH1F("PidE" ,"PID: e yellow #mu magenta"  ,100,0,1)                        ,      4) ; 
-  fOutputContainer->AddAt(new TH1F("PidMu","pid of #mu"                 ,100,0,1)                        ,      5) ; 
-  fOutputContainer->AddAt(new TH1F("PidPi","PID: #pi red K green p blue",100,0,1)                        ,      6) ; 
-  fOutputContainer->AddAt(new TH1F("PidK" ,"pid of K"                   ,100,0,1)                        ,      7) ; 
-  fOutputContainer->AddAt(new TH1F("PidP" ,"pid of p"                   ,100,0,1)                        ,      8) ; 
-  //options for drawing
-
-}//CreateOutputObjects()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDQaEsd::Exec(Option_t *) 
-{
-// Virtual from TTask. 
-// Invoked by AliAnalysisManager::StartAnalysis()->AliAnalysisManager::ExecAnalysis()->TTask::ExecuteTask() in case of mgr->StartAnalysis("local")
-// Invoked by AliAnalysisSelector::Process()->AliAnalysisManager::ExecAnalysis()->TTask::ExecuteTask() in case of mgr->StartAnalysis("local")
-    
-  fChain->GetReadEntry() ;
-  
-  if (!fESD) {
-    AliError("fESD is not connected to the input!") ; 
-    return ; 
-  }
-  
-  for(Int_t iTrk = 0 ; iTrk < fESD->GetNumberOfTracks() ; iTrk++){
-    AliESDtrack *pTrk = fESD->GetTrack(iTrk) ;
-
-    ((TH2F*)fOutputContainer->At(0))->Fill( pTrk->GetP(), pTrk->GetHMPIDsignal() ) ; 
-    ((TH2F*)fOutputContainer->At(1))->Fill( pTrk->GetP(), TMath::Sqrt(pTrk->GetHMPIDchi2()) ) ;
-     
-     Float_t xm,ym; Int_t q,np;  pTrk->GetHMPIDmip(xm,ym,q,np);                       //mip info
-     ((TH2F*)fOutputContainer->At(2))->Fill(xm,ym);
-     Float_t xRad,yRad,th,ph;        pTrk->GetHMPIDtrk(xRad,yRad,th,ph);              //track info at the middle of the radiator
-     Float_t xPc = xRad+9.25*TMath::Tan(th)*TMath::Cos(ph); // temporar: linear extrapol (B=0!)
-     Float_t yPc = yRad+9.25*TMath::Tan(th)*TMath::Sin(ph); // temporar:          "
-     ((TH2F*)fOutputContainer->At(3))->Fill(xm-xPc,ym-yPc); //track info 
-     
-    Double_t pid[5] ;      pTrk->GetHMPIDpid(pid) ; 
-    for(Int_t i = 0 ; i < 5 ; i++)       ((TH1F*)fOutputContainer->At(4+i))->Fill(pid[i]) ;
-  }//tracks loop 
-       
-  PostData(0,fOutputContainer);
-}//Exec()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDQaEsd::Terminate(Option_t *)
-{
-//Virual from Processing when the event loop is ended
-  TObjArray *out=(TObjArray*)GetOutputData(0);
-  
-  TH2F *hAngP    = (TH2F*)out->At(0);
-  TH2F *hErrP    = (TH2F*)out->At(1);
-  TH2F *hMipXY   = (TH2F*)out->At(2);
-  TH2F *hDifXY   = (TH2F*)out->At(3);
-  TH1F *hProE    = (TH1F*)out->At(4);
-  TH1F *hProMu   = (TH1F*)out->At(5);
-  TH1F *hProPi   = (TH1F*)out->At(6);
-  TH1F *hProK    = (TH1F*)out->At(7);
-  TH1F *hProP    = (TH1F*)out->At(8);
-  
-  hProE ->SetLineColor(kYellow);
-  hProMu->SetLineColor(kMagenta);
-  hProPi->SetLineColor(kRed);
-  hProK ->SetLineColor(kGreen);
-  hProP ->SetLineColor(kBlue);
-  
-  Float_t n = 1.292 ; //mean freon ref idx 
-  AliPID dummy ;      //just to initialize AliPID to get the correct particle masses
-  TF1* funPi = new TF1("RiPiTheo", "acos(sqrt(x*x+[0]*[0])/(x*[1]))", 1.2, 7); funPi->SetLineWidth(1);   funPi->SetParameter(1,n) ; 
-
-                                                funPi->SetLineColor(kRed);     funPi->SetParameter(0,AliPID::ParticleMass(AliPID::kPion));    
-  TF1* funK=static_cast(funPi->Clone()) ; funK ->SetLineColor(kGreen) ;   funK->SetParameter(0,AliPID::ParticleMass(AliPID::kKaon)) ; 
-  TF1* funP=static_cast(funPi->Clone()) ; funP ->SetLineColor(kBlue) ;    funP->SetParameter(0,AliPID::ParticleMass(AliPID::kProton)) ; 
-
-  TCanvas * can = new TCanvas("HmpidCanvas","HMPID ESD Test"); can->SetFillColor(10) ;   can->SetHighLightColor(10) ;   can->Divide(3,2) ;
-
-  can->cd(1);hAngP->Draw();funPi->Draw("same");funK->Draw("same");funP->Draw("same"); can->cd(2);hMipXY->Draw();  can->cd(3);hProE->Draw();hProMu->Draw("same");  
-  can->cd(4);hErrP->Draw();                                                           can->cd(5);hDifXY->Draw();  can->cd(6);hProPi->Draw();hProK->Draw("same");hProP->Draw("same");
-}//Terminate()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void qa(Int_t mode=0)
-{
-  gBenchmark->Start("HMPID QA");
-  
-  TChain* chain =new TChain("esdTree");  
-  AliAnalysisManager *mgr=new AliAnalysisManager("FunnyName");
-  
-  AliAnalysisTask *qa=new AliHMPIDQaEsd();
-  qa->ConnectInput (0,mgr->CreateContainer("EsdChain",TChain::Class()   ,AliAnalysisManager::kInputContainer));
-  qa->ConnectOutput(0,mgr->CreateContainer("HistLst",TObjArray::Class(),AliAnalysisManager::kOutputContainer));
-    
-  mgr->AddTask(qa);
-  if(!mgr->InitAnalysis()) return;
-  mgr->PrintStatus();
-  
-  switch(mode){
-    case 0:   chain->Add("AliESDs.root");
-              mgr->StartAnalysis("local",chain);  
-              break;
-              
-    case 1:   if(TProof::Open("proof://hmpid@lxb6046.cern.ch")==0x0) return; 
-              gProof->UploadPackage("ESD.par"); gProof->EnablePackage("ESD");
-              gProof->UploadPackage("ANALYSIS.par"); gProof->EnablePackage("ANALYSIS");                
-              mgr->StartAnalysis("proof",chain);  
-              break;
-              
-    case 2:   mgr->StartAnalysis("grid" ,chain);  
-              break;
-  }
-  gBenchmark->Show("HMPID QA");
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
diff --git a/HMPID/AliHMPIDRecon.cxx b/HMPID/AliHMPIDRecon.cxx
index 6b2f712402d..ea34d2655e6 100644
--- a/HMPID/AliHMPIDRecon.cxx
+++ b/HMPID/AliHMPIDRecon.cxx
@@ -24,7 +24,6 @@
 #include "AliHMPIDRecon.h"   //class header
 #include "AliHMPIDParam.h"   //CkovAngle()
 #include "AliHMPIDCluster.h" //CkovAngle()
-#include          //FitEllipse()
 #include        //TracePhot()
 #include             //HoughResponse()
 #include     //CkovAngle()
@@ -53,13 +52,6 @@ AliHMPIDRecon::AliHMPIDRecon():TTask("RichRec","RichPat"),
     fPhotPhi [i] = -1;
     fPhotWei [i] =  0;
   }
-//hidden algorithm
-  fMipX=fMipY=fThTrkFit=fPhTrkFit=fCkovFit=fMipQ=fRadX=fRadY=-999;
-  fIdxMip=fNClu=0;
-  for (Int_t i=0; i<100; i++) {
-    fXClu[i] = fYClu[i] = 0;
-    fClCk[i] = kTRUE;
-  }
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean)
@@ -74,10 +66,10 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t n
   if(pCluLst->GetEntries()>pParam->MultCut()) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction
   else                                        fIsWEIGHT = kFALSE;
 
-  Float_t xRa,yRa,th,ph;
+  Float_t xRa,yRa,th,ph;       
   pTrk->GetHMPIDtrk(xRa,yRa,th,ph);        //initialize this track: th and ph angles at middle of RAD 
   SetTrack(xRa,yRa,th,ph);
-
+  
   fRadNmean=nmean;
 
   Float_t dMin=999,mipX=-1,mipY=-1;Int_t chId=-1,mipId=-1,mipQ=-1;                                                                           
@@ -105,10 +97,10 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t n
   pTrk->SetHMPIDcluIdx(chId,mipId);                                                           //set index of cluster
   if(iNacc<1)    pTrk->SetHMPIDsignal(kNoPhotAccept);                                         //no photon candidates is accepted
   else           pTrk->SetHMPIDsignal(FindRingCkov(pCluLst->GetEntries()));                   //find best Theta ckov for ring i.e. track
-
+  
   pTrk->SetHMPIDchi2(fCkovSigma2);                                                            //errors squared 
 
-}//CkovAngle()
+}//ThetaCerenkov()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t AliHMPIDRecon::FindPhotCkov(Double_t cluX,Double_t cluY,Double_t &thetaCer,Double_t &phiCer)
 {
@@ -304,8 +296,7 @@ void AliHMPIDRecon::Refract(TVector3 &dir,Double_t n1,Double_t n2)const
 Double_t AliHMPIDRecon::HoughResponse()
 {
 //
-//    fIdxMip = mipId;
-
+//
 //       
   Double_t kThetaMax=0.75;
   Int_t nChannels = (Int_t)(kThetaMax/fDTheta+0.5);
@@ -436,268 +427,3 @@ Double_t AliHMPIDRecon::SigGeom(Double_t thetaC, Double_t phiC,Double_t betaM)co
   return trErr*err;
 }//SigGeom()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-//
-// From here HTA....
-//
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDRecon::CkovHiddenTrk(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean)
-{
-// Pattern recognition method without any infos from tracking:HTA (Hidden Track Algorithm)...
-// The method finds in the chmber the cluster with the highest charge
-// compatibile with a MIP, then the strategy is applied
-// Arguments:  pTrk     - pointer to ESD track
-//             pCluLs   - list of clusters for a given chamber 
-//             nmean    - mean freon ref. index
-//   Returns:           - 0=ok,1=not fitted 
-  
-  AliHMPIDParam *pParam=AliHMPIDParam::Instance();
-    
-  fRadNmean=nmean;
-
-  Float_t mipX=-1,mipY=-1;Int_t mipId=-1,mipQ=-1;                                                                           
-  Double_t qRef = 0;
-  for (Int_t iClu=0;iCluGetEntriesFast();iClu++){                                   //clusters loop
-    AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu);                       //get pointer to current cluster    
-    fXClu[iClu] = pClu->X();fYClu[iClu] = pClu->Y();                                          //store x,y for fitting procedure
-    fClCk[iClu] = kTRUE;                                                                      //all cluster are accepted at this stage to be reconstructed
-    if(pClu->Q()>qRef){                                                                       //searching the highest charge to select a MIP      
-      qRef = pClu->Q();
-      mipId=iClu; mipX=pClu->X();mipY=pClu->Y();mipQ=(Int_t)pClu->Q();
-    }                                                                                    
-  }//clusters loop
-
-  fNClu = pCluLst->GetEntriesFast();
-  if(qRef>pParam->QCut()){                                                                       //charge compartible with MIP clusters
-    fIdxMip = mipId;
-    fClCk[mipId] = kFALSE;
-    fMipX = mipX; fMipY=mipY; fMipQ = qRef;
-    if(!DoRecHiddenTrk(pCluLst)) return kFALSE;                                                  //Do track and ring reconstruction,if problems returns 1
-    pTrk->SetHMPIDtrk(fRadX,fRadY,fThTrkFit,fPhTrkFit);                                          //store track intersection info
-    pTrk->SetHMPIDmip(fMipX,fMipY,(Int_t)fMipQ,fNClu);                                           //store mip info 
-    pTrk->SetHMPIDcluIdx(pCluLst->GetEntriesFast(),fIdxMip);                                     //set cham number and index of cluster
-    pTrk->SetHMPIDsignal(fCkovFit);                                                              //find best Theta ckov for ring i.e. track
-    Printf(" n clusters tot %i accepted %i",pCluLst->GetEntriesFast(),fNClu);
-    return kTRUE;
-  }
-  return kFALSE;
-}//CkovHiddenTrk()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDRecon::DoRecHiddenTrk(TClonesArray *pCluLst)
-{
-// Pattern recognition method without any infos from tracking...
-// First a preclustering filter to avoid part of the noise
-// Then only ellipsed-rings are fitted (no possibility, 
-// for the moment, to reconstruct very inclined tracks)
-// Finally a fitting with (th,ph) free, starting by very close values
-// previously evaluated.
-// Arguments:   none
-//   Returns:   none
-  Double_t phiRec;
-  if(!CluPreFilter(pCluLst)) {return kFALSE;}
-  if(!FitEllipse(phiRec)) {return kFALSE;}
-  Int_t nClTmp1 = pCluLst->GetEntriesFast()-1;  //minus MIP...
-  Int_t nClTmp2 = 0;
-  while(nClTmp1 != nClTmp2){
-    SetNClu(pCluLst->GetEntriesFast());
-    if(!FitFree(phiRec)) {return kFALSE;}
-    nClTmp2 = NClu();
-    if(nClTmp2!=nClTmp1) {nClTmp1=nClTmp2;nClTmp2=0;}
-  }
-  fNClu = nClTmp2;
-  return kTRUE;
-}//DoRecHiddenTrk()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDRecon::CluPreFilter(TClonesArray *pCluLst)
-{
-// Filter of bkg clusters
-// based on elliptical-shapes...
-//
-  if(pCluLst->GetEntriesFast()>50||pCluLst->GetEntriesFast()<4) return kFALSE; 
-  else return kTRUE;
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDRecon::FitEllipse(Double_t &phiRec)
-{
-//Fit a set of clusters with an analitical conical section function:
-  //
-  // Ax^2 + B*y^2 + 2Hxy + 2Gx + 2Fy + 1 = 0   ---> conical section
-  //
-  //  H*H - A*B > 0 hyperbola
-  //            < 0 ellipse
-  //            = 0 parabola
-  //
-  // tan 2alfa = 2H/(A-B)  alfa=angle of rotation
-  //
-  // coordinate of the centre of the conical section:
-  //   x = x' + a
-  //   y = y' + b
-  //
-  //       HF - BG
-  //  a = ---------
-  //       AB - H^2
-  //
-  //       HG - AF
-  //  b = --------
-  //       AB - H^2
-  Double_t cA,cB,cF,cG,cH;
-  Double_t aArg=-1;      Int_t iErrFlg;                                                //tmp vars for TMinuit
-
-  if(!gMinuit) gMinuit = new TMinuit(5);                                               //init MINUIT with this number of parameters (5 params)
-  gMinuit->mncler();                                                                   // reset Minuit list of paramters
-  gMinuit->SetObjectFit((TObject*)this);  gMinuit->SetFCN(AliHMPIDRecon::FunMinEl);    //set fit function
-  gMinuit->mnexcm("SET PRI",&aArg,1,iErrFlg);                                          //suspend all printout from TMinuit 
-  gMinuit->mnexcm("SET NOW",&aArg,0,iErrFlg);                                          //suspend all warning printout from TMinuit
-  
-  Double_t d1,d2,d3;
-  TString sName;
-
-  gMinuit->mnparm(0," A ",1,0.01,0,0,iErrFlg);
-  gMinuit->mnparm(1," B ",1,0.01,0,0,iErrFlg);
-  gMinuit->mnparm(2," H ",1,0.01,0,0,iErrFlg);
-  gMinuit->mnparm(3," G ",1,0.01,0,0,iErrFlg);
-  gMinuit->mnparm(4," F ",1,0.01,0,0,iErrFlg);
-
-  gMinuit->mnexcm("SIMPLEX" ,&aArg,0,iErrFlg);
-  gMinuit->mnexcm("MIGRAD" ,&aArg,0,iErrFlg);   
-  gMinuit->mnpout(0,sName,cA,d1,d2,d3,iErrFlg);
-  gMinuit->mnpout(1,sName,cB,d1,d2,d3,iErrFlg);
-  gMinuit->mnpout(2,sName,cH,d1,d2,d3,iErrFlg);
-  gMinuit->mnpout(3,sName,cG,d1,d2,d3,iErrFlg);
-  gMinuit->mnpout(4,sName,cF,d1,d2,d3,iErrFlg);
-  delete gMinuit;
-
-  Double_t i2 = cA*cB-cH*cH;                                       //quartic invariant : i2 > 0  ellipse, i2 < 0 hyperbola
-  if(i2<=0) return kFALSE;
-  Double_t aX = (cH*cF-cB*cG)/i2;                                  //x centre of the canonical section 
-  Double_t bY = (cH*cG-cA*cF)/i2;                                  //y centre of the canonical section 
-  Double_t alfa1 = TMath::ATan(2*cH/(cA-cB));                      //alpha = angle of rotation of the conical section
-  if(alfa1<0) alfa1+=TMath::Pi(); 
-  alfa1*=0.5;
-  Double_t alfa2 = alfa1+TMath::Pi();
-  Double_t phiref = TMath::ATan2(bY-fMipY,aX-fMipX);               //evaluate in a unique way the angle of rotation comapring it
-  if(phiref<0) phiref+=TMath::TwoPi();                             //with the vector that poinst to the centre from the mip 
-  if(i2<0) phiref+=TMath::Pi();
-  if(phiref>TMath::TwoPi()) phiref-=TMath::TwoPi();
-
-//  Printf(" alfa1 %f",alfa1*TMath::RadToDeg());
-//  Printf(" alfa2 %f",alfa2*TMath::RadToDeg());
-//  Printf(" firef %f",phiref*TMath::RadToDeg());
-  if(TMath::Abs(alfa1-phiref)mncler();                                                                   // reset Minuit list of paramters
-  gMinuit->SetObjectFit((TObject*)this);  gMinuit->SetFCN(AliHMPIDRecon::FunMinPhot);  //set fit function
-  gMinuit->mnexcm("SET PRI",&aArg,1,iErrFlg);                                          //suspend all printout from TMinuit 
-  gMinuit->mnexcm("SET NOW",&aArg,0,iErrFlg);                                          //suspend all warning printout from TMinuit
-  
-  Double_t d1,d2,d3;
-  TString sName;
-  Double_t th,ph;
-  
-  gMinuit->mnparm(0," theta ",  0.01,0.01,0,TMath::PiOver2(),iErrFlg);
-  gMinuit->mnparm(1," phi   ",phiRec,0.01,0,TMath::TwoPi()  ,iErrFlg);
-  
-  gMinuit->FixParameter(1);
-  gMinuit->mnexcm("SIMPLEX" ,&aArg,0,iErrFlg);   
-  gMinuit->mnexcm("MIGRAD"  ,&aArg,0,iErrFlg);
-  gMinuit->Release(1);  
-  gMinuit->mnexcm("MIGRAD"  ,&aArg,0,iErrFlg);
-  
-  gMinuit->mnpout(0,sName,th,d1,d2,d3,iErrFlg);
-  gMinuit->mnpout(1,sName,ph,d1,d2,d3,iErrFlg);   
-
-  Double_t outPar[2] = {th,ph}; Double_t g; Double_t f;Int_t flag = 3;
-  gMinuit->Eval(2, &g, f, outPar,flag);  
-
-  SetTrkFit(th,ph);
-  
-  return kTRUE;
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Double_t AliHMPIDRecon::FunConSect(Double_t *c,Double_t x,Double_t y)
-{
-  return c[0]*x*x+c[1]*y*y+2*c[2]*x*y+2*c[3]*x+2*c[4]*y+1;
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDRecon::FunMinEl(Int_t &/* */,Double_t* /* */,Double_t &f,Double_t *par,Int_t /* */)
-{
-  AliHMPIDRecon *pRec=(AliHMPIDRecon*)gMinuit->GetObjectFit();
-  Double_t minFun = 0;
-  Int_t np = pRec->NClu();
-  for(Int_t i=0;iIdxMip()) continue;
-    Double_t el = pRec->FunConSect(par,pRec->XClu(i),pRec->YClu(i));
-    minFun +=el*el;
-  }
-  f = minFun;
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDRecon::FunMinPhot(Int_t &/* */,Double_t* /* */,Double_t &f,Double_t *par,Int_t iflag)
-{
-  AliHMPIDRecon *pRec=(AliHMPIDRecon*)gMinuit->GetObjectFit();
-  Double_t sizeCh = 0.5*fgkRadThick+fgkWinThick+fgkGapThick;
-  Double_t thTrk = par[0]; 
-  Double_t phTrk = par[1]; 
-  Double_t xrad = pRec->MipX() - sizeCh*TMath::Tan(thTrk)*TMath::Cos(phTrk);
-  Double_t yrad = pRec->MipY() - sizeCh*TMath::Tan(thTrk)*TMath::Sin(phTrk);
-  pRec->SetRadXY(xrad,yrad);
-  pRec->SetTrack(xrad,yrad,thTrk,phTrk);
-
-  Double_t meanCkov =0;
-  Double_t meanCkov2=0;
-  Double_t thetaCer,phiCer;
-  Int_t nClAcc = 0;
-  Int_t nClTot=pRec->NClu();
-    
-  for(Int_t i=0;iClCk(i))) continue;
-    pRec->FindPhotCkov(pRec->XClu(i),pRec->YClu(i),thetaCer,phiCer);  
-    meanCkov  += thetaCer;
-    meanCkov2 += thetaCer*thetaCer;
-    nClAcc++;
-  }
-  if(nClAcc==0) {f=999;return;}
-  meanCkov/=nClAcc;
-  Double_t rms = (meanCkov2 - meanCkov*meanCkov*nClAcc)/nClAcc;
-  if(rms<0) Printf(" rms2 = %f, strange!!!",rms);
-  rms = TMath::Sqrt(rms);
-  f = rms/TMath::Sqrt(nClAcc);
-  
-  
-  if(iflag==3) {
-    Printf("FunMinPhot before: photons candidates %i used %i",nClTot,nClAcc);
-    nClAcc = 0;
-    Double_t meanCkov1=0;
-    for(Int_t i=0;iClCk(i))) continue;
-      pRec->FindPhotCkov(pRec->XClu(i),pRec->YClu(i),thetaCer,phiCer);  
-      if(TMath::Abs(thetaCer-meanCkov)<2*rms) {
-        meanCkov1  += thetaCer;
-        nClAcc++;
-      } else pRec->SetClCk(i,kFALSE);
-    }
-    meanCkov1/=nClAcc;
-    Printf("FunMinPhot after: photons candidates %i used %i thetaCer %f",nClTot,nClAcc,meanCkov1);
-    pRec->SetCkovFit(meanCkov1);
-    pRec->SetNClu(nClAcc);
-  }
-}//FunMinPhot()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-//
-// ended Hidden track algorithm....
-//
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/HMPID/AliHMPIDRecon.h b/HMPID/AliHMPIDRecon.h
index b32782a1c5f..feb0e5c1ffd 100644
--- a/HMPID/AliHMPIDRecon.h
+++ b/HMPID/AliHMPIDRecon.h
@@ -25,7 +25,7 @@ public :
              AliHMPIDRecon();
     virtual ~AliHMPIDRecon()                                                          {}
 
-
+  
   void     CkovAngle    (AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean             );     //reconstructed Theta Cerenkov
   Bool_t   FindPhotCkov (Double_t cluX,Double_t cluY,Double_t &thetaCer,Double_t &phiCer    );     //find ckov angle for single photon candidate
   Double_t FindRingCkov (Int_t iNclus                                                       );     //best ckov for ring formed by found photon candidates
@@ -46,34 +46,7 @@ public :
   Double_t SigCrom      (Double_t ckovTh,Double_t ckovPh,Double_t beta                      )const;//error due to unknonw photon energy
   Double_t Sigma2       (Double_t ckovTh,Double_t ckovPh                                    )const;//photon candidate sigma
   enum ETrackingFlags {kMipDistCut=-9,kMipQdcCut=-5,kNoPhotAccept=-11};
-// HTA hidden track algorithm
-  Bool_t   CkovHiddenTrk    (AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean);              //Pattern recognition without trackinf information
-  Bool_t   CluPreFilter     (TClonesArray *pClu               );                                   //Pre clustering filter to cut bkg clusters
-  Bool_t   DoRecHiddenTrk   (TClonesArray *pClu               );                                   //Calling to the fitted procedures
-  Bool_t   FitEllipse       (Double_t &phiRec                    );                                //Fit clusters with a conical section (kTRUE only for ellipses)
-  Bool_t   FitFree          (Double_t phiRec                     );                                //Fit (th,ph) of the track and ckovFit as result
-  Double_t FunConSect       (Double_t *c,Double_t x,Double_t y   );                                //Function of a general conical section
-  void     SetNClu          (Int_t nclu                          ) {fNClu=nclu;}                   //Setter for # of clusters
-  void     SetClCk          (Int_t i,Bool_t what                 ) {fClCk[i]=what;}                //Setter for cluster flags 
-  void     SetCkovFit       (Double_t ckov                       ) {fCkovFit=ckov;}                //Setter for ckof fitted
-  void     SetTrkFit        (Double_t th,Double_t ph             ) {fThTrkFit = th;fPhTrkFit = ph;}//Setter for (th,ph) of the track
-  void     SetRadXY         (Double_t  x,Double_t y              ) {fRadX = x;fRadY = y;}          //Setter for (th,ph) of the track
-  static void     FunMinEl  (Int_t&/* */,Double_t* /* */,Double_t &f,Double_t *par,Int_t /* */);   //Fit function to find ellipes parameters
-  static void     FunMinPhot(Int_t&/* */,Double_t* /* */,Double_t &f,Double_t *par,Int_t iflag);   //Fit function to minimize thetaCer RMS/Sqrt(n) of n clusters
-  Int_t    IdxMip       ()const {return fIdxMip;}                                                  //Getter index of MIP
-  Double_t MipX         ()const {return fMipX;}                                                    //Getter of x MIP in LORS
-  Double_t MipY         ()const {return fMipY;}                                                    //Getter of y MIP in LORS
-  Double_t MipQ         ()const {return fMipQ;}                                                    //Getter of Q MIP
-  Double_t RadX         ()const {return fRadX;}                                                    //Getter of x at RAD in LORS
-  Double_t RadY         ()const {return fRadY;}                                                    //Getter of y at RAD in LORS
-  Int_t    NClu         ()const {return fNClu;}                                                    //Getter of cluster multiplicity
-  Double_t XClu         (Int_t i)const {return fXClu[i];}                                          //Getter of x clu
-  Double_t YClu         (Int_t i)const {return fYClu[i];}                                          //Getter of y clu
-  Bool_t   ClCk         (Int_t i)const {return fClCk[i];}                                          //Getter of cluster flags
-  Double_t CkovFit      ()const {return fCkovFit;}                                                 //Getter of ckov angle fitted
-  Double_t ThTrkFit     ()const {return fThTrkFit;}                                                //Getter of theta fitted of the track
-  Double_t PhTrkFit     ()const {return fPhTrkFit;}                                                //Getter of phi fitted of the track
-//
+
 protected:
   Double_t fRadNmean;                          //C6F14 mean refractive index
   Int_t    fPhotCnt;                           // counter of photons candidate
@@ -83,35 +56,21 @@ public :
   Double_t fPhotWei [3000];                    // weigths of photon candidates
   Double_t fCkovSigma2;                        // sigma2 of the reconstructed ring
 
-  Bool_t   fIsWEIGHT;                          // flag to consider weight procedure
-  Float_t  fDTheta;                            // Step for sliding window
-  Float_t  fWindowWidth;                       // Hough width of sliding window
+  Bool_t  fIsWEIGHT;                          // flag to consider weight procedure
+  Float_t fDTheta;                            // Step for sliding window
+  Float_t fWindowWidth;                       // Hough width of sliding window
   
-  TVector3 fTrkDir;                            //track direction in LORS at RAD
-  TVector2 fTrkPos;                            //track positon in LORS at RAD
-  TVector2 fPc;                                //track position at PC
-// HTA hidden track algorithm
-  Double_t fMipX;                              //mip X position for Hidden Track Algorithm  
-  Double_t fMipY;                              //mip Y position for Hidden Track Algorithm
-  Double_t fMipQ;                              //mip Q          for Hidden Track Algorithm
-  Double_t fRadX;                              //rad X position for Hidden Track Algorithm  
-  Double_t fRadY;                              //rad Y position for Hidden Track Algorithm
-  Int_t    fIdxMip;                            //mip index in the clus list
-  Int_t    fNClu;                              //n clusters to fit
-  Double_t fXClu[100];                         //container for x clus position
-  Double_t fYClu[100];                         //container for y clus position
-  Bool_t   fClCk[100];                         //flag if cluster is used in fitting
-  Double_t fThTrkFit;                          //theta fitted of the track
-  Double_t fPhTrkFit;                          //phi   fitted of the track
-  Double_t fCkovFit;                           //estimated ring Cherenkov angle
-//
-private:
+  TVector3 fTrkDir;                           //track direction in LORS at RAD
+  TVector2 fTrkPos;                           //track positon in LORS at RAD
+  TVector2 fPc;                               //track position at PC
+  
+private:  
   static const Double_t fgkRadThick;                      //radiator thickness
   static const Double_t fgkWinThick;                      //window thickness
   static const Double_t fgkGapThick;                      //proximity gap thickness
   static const Double_t fgkWinIdx;                        //mean refractive index of WIN material (SiO2) 
   static const Double_t fgkGapIdx;                        //mean refractive index of GAP material (CH4)
-
+  
   ClassDef(AliHMPIDRecon,0)
 };
 
diff --git a/HMPID/AliHMPIDReconstructor.cxx b/HMPID/AliHMPIDReconstructor.cxx
index 2d717d82d83..0c1c106e275 100644
--- a/HMPID/AliHMPIDReconstructor.cxx
+++ b/HMPID/AliHMPIDReconstructor.cxx
@@ -21,78 +21,26 @@
 #include "AliHMPID.h"              //Reconstruct() 
 #include "AliHMPIDCluster.h"       //Dig2Clu()
 #include "AliHMPIDParam.h"         //FillEsd() 
-#include            //ctor
-#include          //ctor
-#include                 //FillEsd()
-#include           //Reconstruct() for raw digits
+#include                //FillEsd()
+#include          //Reconstruct() for raw digits
 ClassImp(AliHMPIDReconstructor)
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor(),fUserCut(0),fDaqSig(0),fDig(0),fClu(0)
+AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor()
 {
 //
 //ctor
 //
-
-  fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1); fClu->SetOwner(kTRUE);
-  fDig=new TObjArray(AliHMPIDDigit::kMaxCh+1); fDig->SetOwner(kTRUE);
-
+  fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1);
+  fDig=new TObjArray(AliHMPIDDigit::kMaxCh+1);
+  fClu->SetOwner(kTRUE);
   for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++){ 
     fDig->AddAt(new TClonesArray("AliHMPIDDigit"),i);
-    TClonesArray *pClus = new TClonesArray("AliHMPIDCluster");
-    pClus->SetUniqueID(i);
-    fClu->AddAt(pClus,i);
-  }
-  
-  AliCDBEntry *pUserCutEnt =AliCDBManager::Instance()->Get("HMPID/Calib/UserCut");    //contains TObjArray of 14 TObject with n. of sigmas to cut charge 
-  if(!pUserCutEnt) return;                                                            //No request from User to apply a more severe cut on pad charge  
-  
-  fUserCut = pUserCutEnt->GetObject()->GetUniqueID();
-
-  Printf(" usercut %i ",fUserCut);
-  
-  AliCDBEntry *pDaqCutEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSigCut");     //contains TObjArray of 14 TObject with n. of sigmas to cut charge 
-  if(!pDaqCutEnt) AliFatal("No pedestal sigmas cut!");
-  TObjArray *pDaqCut = (TObjArray*)pDaqCutEnt->GetObject();
-
-
-  for(Int_t ddl=0;ddl<14;ddl++){
-    if(fUserCut<=(Int_t)pDaqCut->At(ddl)->GetUniqueID()) continue;
-    AliCDBEntry *pDaqSigEnt =AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");  //contains TObjArray of TObjArray 14 TMatrixF sigmas values for pads 
-    if(!pDaqSigEnt) AliFatal("No pedestals from DAQ!");
-    TObjArray *pDaqSig = (TObjArray*)pDaqSigEnt->GetObject();
-    SigConv(pDaqSig);
-    break;
+    fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
   }
+  fDig->SetOwner(kTRUE);
 }//AliHMPIDReconstructor
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDReconstructor::SigConv(TObjArray *pDaqSig)
-{
-// Conversion from the pedestal objects in to 7 TMatrixF(padX,padY)
-//Arguments: pDaqSig pointer to the pedestal objects from OCDB
-//   Returs: none
-//
-  fDaqSig = new TObjArray(AliHMPIDDigit::kMaxCh+1);fDaqSig->SetOwner(kTRUE);
-  
-  for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++) fDaqSig->AddAt(new TMatrixF(1,10,0,47),iCh);
- 
-  AliHMPIDDigit dig;
-   
-  for(Int_t ddl=0;ddl<=13;ddl++){
-    for(Int_t row=1;row<=24;row++)
-      for(Int_t dil=1;dil<=10;dil++)
-        for(Int_t adr=0;adr<=47;adr++){
-          TObjArray *pDdl = (TObjArray*)pDaqSig->At(ddl);
-          TObjArray *pRow = (TObjArray*)pDdl->At(row-1);
-          TMatrixF *pM = (TMatrixF*)pRow;
-          Float_t sigma = (*pM)(dil,adr);
-          dig.Raw(ddl,row,dil,adr);
-          TMatrixF* pMConv = (TMatrixF*)(fDaqSig->At(dig.Ch()));
-          (*pMConv)(dig.PadChX(),dig.PadChY()) = sigma;
-        }
-  }
-}//SigConv()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t isTryUnfold)
 {
 // Finds all clusters for a given digits list provided not empty. Currently digits list is a list of all digits for a single chamber.
@@ -116,6 +64,7 @@ void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t
     }//digits loop to fill digits map 
     
     AliHMPIDCluster clu;                                                                  //tmp cluster to be used as current
+  
     for(Int_t iDig=0;iDigGetEntriesFast();iDig++){                              //digits loop for current chamber
       AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCur->At(iDig);                              //take current digit
       if(!(pDig=UseDig(pDig->PadChX(),pDig->PadChY(),pDigCur,&padMap))) continue;         //this digit is already taken in FormClu(), go after next digit
@@ -193,7 +142,6 @@ void AliHMPIDReconstructor::Reconstruct(AliRunLoader *pAL,AliRawReader* pRR)cons
         UInt_t ddl=pRR->GetDDLID(); //returns 0,1,2 ... 13
         dig.Raw(w32,ddl);
         AliDebug(1,Form("Ch=%i DDL=%i raw=0x%x digit=(%3i,%3i,%3i,%3i) Q=%5.2f",iCh,ddl,w32,dig.Ch(),dig.Pc(),dig.PadPcX(),dig.PadPcY(),dig.Q()));
-        if(!IsDigSurvive(&dig)) continue;                                             //sigma cut test
         new((*((TClonesArray*)digLst.At(iCh)))[iDigCnt[iCh]++]) AliHMPIDDigit(dig); //add this digit to the tmp list
       }//raw records loop
       pRR->Reset();
@@ -226,7 +174,6 @@ void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)cons
       UInt_t ddl=pRR->GetDDLID(); //returns 0,1,2 ... 13
       dig.Raw(w32,ddl);  
       AliDebug(1,Form("Ch=%i DDL=%i raw=0x%x digit=(%3i,%3i,%3i,%3i) Q=%5.2f",iCh,ddl,w32,dig.Ch(),dig.Pc(),dig.PadPcX(),dig.PadPcY(),dig.Q()));
-      if(!IsDigSurvive(&dig)) continue;                                       //sigma cut test
       new((*((TClonesArray*)fDig->At(iCh)))[iDigCnt++]) AliHMPIDDigit(dig); //add this digit to the tmp list
     }//raw records loop
     pRR->Reset();        
diff --git a/HMPID/AliHMPIDReconstructor.h b/HMPID/AliHMPIDReconstructor.h
index 86f80dc76f0..7b381fae799 100644
--- a/HMPID/AliHMPIDReconstructor.h
+++ b/HMPID/AliHMPIDReconstructor.h
@@ -5,13 +5,12 @@
 //.
 // HMPID base class to reconstruct an event
 //.
-#include         //base class
+#include        //base class
 #include "AliHMPIDTracker.h"         //CreateTracker()
-#include "AliHMPIDDigit.h"           //Dig2Clu(), UseDig()
-#include                 //UseDig()
-#include             //UseDig()
-#include                //SigConv()
-class AliRawReader;                  //Reconstruct() with raw data   
+#include                //UseDig()
+#include            //UseDig()
+class AliRawReader;                 //Reconstruct() with raw data   
+class AliHMPIDDigit;                 //Dig2Clu(), UseDig()
 class AliHMPIDCluster;               //Dig2Clu()
 
 class AliHMPIDReconstructor: public AliReconstructor 
@@ -35,14 +34,11 @@ class AliHMPIDReconstructor: public AliReconstructor
   static        void           Dig2Clu (TObjArray *pDigLst,TObjArray *pCluLst,Bool_t isUnfold=kTRUE                      );//digits->clusters
   static        void           FormClu (AliHMPIDCluster *pClu,AliHMPIDDigit *pDig,TClonesArray *pDigLst,TMatrixF *pPadMap);//cluster formation recursive algorithm
   static inline AliHMPIDDigit* UseDig  (Int_t padX,Int_t padY,                    TClonesArray *pDigLst,TMatrixF *pDigMap);//use this pad's digit to form a cluster
-  inline Bool_t                IsDigSurvive(AliHMPIDDigit *pDig                                                     )const;//check for sigma cut
-  void                         SigConv(TObjArray *pDaqSig                                                                );//conversion to 7 TMatrixF for sigmas
+
   protected:
-  Int_t      fUserCut;                 // n sigma for pedestals decided by the User (if in OCDB)
-  TObjArray *fDaqSig;                  // container for the pad pedestal sigmas
   TObjArray *fDig;                     // tmp list of digits
   TObjArray *fClu;                     // tmp list of clusters
-  ClassDef(AliHMPIDReconstructor, 0)   // class for the HMPID reconstruction
+  ClassDef(AliHMPIDReconstructor, 0)   //class for the HMPID reconstruction
 };
 
 //__________________________________________________________________________________________________
@@ -58,17 +54,5 @@ AliHMPIDDigit* AliHMPIDReconstructor::UseDig(Int_t padX,Int_t padY,TClonesArray
   if(iDig!=-1)    return (AliHMPIDDigit*)pDigLst->At(iDig);        //digit pointer
   else            return 0;
 }
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDReconstructor::IsDigSurvive(AliHMPIDDigit *pDig)const
-{
-//Check if the current digit survive to a riapllied sigma cut
-//Arguments: pDig pointer to the current digit
-//  Returns: kTRUE if charge > mean+n*sigma
-  if(!fUserCut) return kTRUE;
-  TMatrixF *pM = (TMatrixF*)fDaqSig->At(pDig->Ch());
-  Float_t sig = (*pM)(pDig->PadChX(),pDig->PadChY());
-  if(pDig->Q()>fUserCut*sig) return kTRUE;
-  else return kFALSE;
-}
 
 #endif
diff --git a/HMPID/AliHMPIDTracker.cxx b/HMPID/AliHMPIDTracker.cxx
index de40205a57b..aef985793de 100644
--- a/HMPID/AliHMPIDTracker.cxx
+++ b/HMPID/AliHMPIDTracker.cxx
@@ -1,13 +1,13 @@
 #include "AliHMPIDTracker.h"     //class header
 #include "AliHMPIDCluster.h"     //GetTrackPoint(),PropagateBack() 
 #include "AliHMPIDParam.h"       //GetTrackPoint(),PropagateBack()
-#include "AliHMPIDRecon.h"       //Recon()
-#include               //PropagateBack(),Recon()  
+#include "AliHMPIDRecon.h"       //PropagateBack()
+#include               //PropagateBack()  
 #include               //GetTrackPoint(),PropagateBack()  
 #include   //GetTrackPoint()
 #include          //GetTrackPoint()
-#include        //PropageteBack()
-#include          //PropageteBack()
+#include 
+#include 
 //.
 // HMPID base class fo tracking
 //.
@@ -17,12 +17,11 @@ ClassImp(AliHMPIDTracker)
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPIDTracker::AliHMPIDTracker():AliTracker()
 {
-// ctor. Create TObjArray of TClonesArray of AliHMPIDCluster  
-// 
-//  
-  fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1);  fClu->SetOwner(kTRUE);
+// ctor
+  fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1);
+  fClu->SetOwner(kTRUE);
   for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
-}//ctor
+}
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++    
 Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
 {
@@ -32,7 +31,8 @@ Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
 //            point- reference to the object where to store the point     
 //   Returns: status of operation  if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track. 
   if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack()
-  Int_t iCham=idx/1000000; Int_t iClu=idx%1000000;
+  Int_t iCham=idx/1000000;
+  Int_t iClu=idx%1000000;
   point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kHMPID,iCham-1));//layer and chamber number
   TClonesArray *pArr=(TClonesArray*)(*fClu)[iCham];
   AliHMPIDCluster *pClu=(AliHMPIDCluster*)pArr->UncheckedAt(iClu);//get pointer to cluster
@@ -40,44 +40,23 @@ Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
   AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
   point.SetXYZ(mars[0],mars[1],mars[2]);
   return kTRUE;
-}//GetTrackPoint()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc)
-{
-// Static method to find intersection in between given track and HMPID chambers
-// Arguments: pTrk- ESD track; xPc,yPc- track intersection with PC in LORS [cm]
-//   Returns: intersected chamber ID or -1
-  AliHMPIDParam *pParam=AliHMPIDParam::Instance();
-  Float_t xRa=0,yRa=0,theta=0,phi=0;                                                            //track intersection at PC and angles at RAD, LORS  
-  for(Int_t i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++){                              //chambers loop
-    Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Point(i,p1,AliHMPIDParam::kRad);          //point & norm  for middle of radiator plane
-    Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Point(i,p2,AliHMPIDParam::kPc);           //point & norm  for entrance to PC plane
-    if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue;                                       //try to intersect track with the middle of radiator
-    if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue;                                       //try to intersect track with PC
-    pParam->Mars2LorsVec(i,n1,theta,phi);                                                       //track angles at RAD
-    pParam->Mars2Lors   (i,p1,xRa,yRa);                                                         //TRKxRAD position
-    pParam->Mars2Lors   (i,p2,xPc,yPc);                                                         //TRKxPC position
-    if(AliHMPIDDigit::IsInside(xPc,yPc,pParam->DistCut())==kFALSE) continue;                    //not in active area  
-    pTrk->SetHMPIDtrk      (xRa,yRa,theta,phi);                                                 //store track intersection info
-    pTrk->SetHMPIDcluIdx   (i,0);
-    return i;
-  }                                                                                             //chambers loop
-  return -1; //no intersection with HMPID chambers
-}//IntTrkCha()
+}
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Int_t AliHMPIDTracker::LoadClusters(TTree *pCluTree)
 {
-// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control. Done once per event.
+// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control 
 // Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
 //   Returns: error code (currently ignored in AliReconstruction::RunTraking())    
+  AliDebug(1,"Start.");
   for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) pCluTree->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));
   pCluTree->GetEntry(0);
+  AliDebug(1,"Stop."); 
   return 0;  
-}//LoadClusters()
+}
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Int_t AliHMPIDTracker::PropagateBack(AliESD *pEsd)
 {
-// Interface pure virtual in AliTracker. Invoked from AliReconstruction::RunTracking() after invocation of AliTracker::LoadClusters() once per event
+// This method defined as pure virtual in AliTracker. It is invoked from AliReconstruction::RunTracking() after invocation of AliTracker::LoadClusters()
 // Agruments: pEsd - pointer to ESD
 //   Returns: error code    
   AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean"); //contains TObjArray of 21 TF1
@@ -86,35 +65,53 @@ Int_t AliHMPIDTracker::PropagateBack(AliESD *pEsd)
   if(!pQthreEnt) AliFatal("No Qthre");
     
   return Recon(pEsd,fClu,(TObjArray*)pNmeanEnt->GetObject());  
-}//PropagateBack()
+}
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHMPIDTracker::Recon(AliESD *pEsd,TObjArray *pClus,TObjArray *pNmean)
+Int_t AliHMPIDTracker::Recon(AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean)
 {
-// Static method to reconstruct Theta Ckov for all valid tracks of a given event.
-// Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time)
+// Interface callback method invoked by AliRecontruction::RunTracking() during tracking after TOF. It's done just once per event
+// Arguments: pEsd - pointer to Event Summary Data class instance which contains a list of tracks
 //   Returns: error code, 0 if no errors   
+  Int_t iNtracks=pEsd->GetNumberOfTracks();  AliDebugClass(1,Form("Start with %i tracks",iNtracks));
+  
   AliHMPIDRecon recon;                                                                       //instance of reconstruction class, nothing important in ctor
-  Float_t xPc,yPc;
-  for(Int_t iTrk=0;iTrkGetNumberOfTracks();iTrk++){                                       //ESD tracks loop
-    AliESDtrack *pTrk = pEsd->GetTrack(iTrk);                                                    //get reconstructed track    
+  Double_t xPc,yPc;
+  for(Int_t iTrk=0;iTrkGetTrack(iTrk);                                                    //get next reconstructed track    
     Int_t cham=IntTrkCha(pTrk,xPc,yPc);                                                          //get chamber intersected by this track 
     if(cham<0) continue;                                                                         //no intersection at all, go after next track
     Double_t nmean=((TF1*)pNmean->At(3*cham))->Eval(pEsd->GetTimeStamp());                       //C6F14 Nmean for this chamber
     recon.SetImpPC(xPc,yPc);                                                                     //store track impact to PC
-    recon.CkovAngle(pTrk,(TClonesArray *)pClus->At(cham),nmean);                                 //search for Cerenkov angle of this track
+    recon.CkovAngle(pTrk,(TClonesArray *)pCluAll->At(cham),nmean);                               //search for Cerenkov angle of this track
   }                                                                                              //ESD tracks loop
+  AliDebugClass(1,"Stop pattern recognition");
   return 0; // error code: 0=no error;
-}//Recon()
+}//PropagateBack()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHMPIDTracker::ReconHiddenTrk(Int_t iCh,AliESDtrack *pTrk,TClonesArray *pCluLst,TObjArray *pNmean)
+Int_t AliHMPIDTracker::IntTrkCha(AliESDtrack *pTrk,Double_t &xToPc,Double_t &yToPc)
 {
-// Static method to reconstruct Theta Ckov for all valid tracks of a given event.
-// Arguments: pEsd- pointer ESD; pClu- pointer to clusters for all chambers; pNmean - pointer to all function Nmean=f(time)
-//   Returns: error code, 0 if no errors
-  AliHMPIDRecon recon;                                                                          //instance of reconstruction class, nothing important in ctor
-  Double_t nmean=((TF1*)pNmean->At(3*iCh))->Eval(0);                                            //C6F14 Nmean for this chamber
-  if(pCluLst->GetEntriesFast()<4) return 1;                                                     //min 4 clusters (3 + 1 mip) to find a ring! 
-  if(recon.CkovHiddenTrk(pTrk,pCluLst,nmean)) return 0;                                         //search for track parameters and Cerenkov angle of this track
-  else return 1;                                                                                // error code: 0=no error,1=fit not performed;
-}//Recon()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Static method to find intersection in between given track and HMPID chambers
+// Arguments: pTrk    - ESD track 
+//            xPc,yPc - track intersection with PC, LORS
+//   Returns: intersected chamber ID or -1
+  
+  AliHMPIDParam *pParam=AliHMPIDParam::Instance();
+  Float_t xRa=0,yRa=0,xPc=0,yPc=0,theta=0,phi=0;                                                //track intersection point and angles, LORS  
+  for(Int_t i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++){                              //chambers loop
+    Double_t p1[3],n1[3]; pParam->Norm(i,n1); pParam->Lors2Mars(i,0,0,p1,AliHMPIDParam::kRad);  //point & norm  for RAD
+    Double_t p2[3],n2[3]; pParam->Norm(i,n2); pParam->Lors2Mars(i,0,0,p2,AliHMPIDParam::kPc);   //point & norm  for PC
+      
+    if(pTrk->Intersect(p1,n1,-GetBz())==kFALSE) continue;                                       //try to intersect track with the middle of radiator
+    if(pTrk->Intersect(p2,n2,-GetBz())==kFALSE) continue;                                       //try to intersect track with PC
+      
+    pParam->Mars2LorsVec(i,n1,theta,phi);                                                       //track angles at RAD
+    pParam->Mars2Lors   (i,p1,xRa,yRa);                                                         //TRKxRAD position
+    pParam->Mars2Lors   (i,p2,xPc,yPc);                                                         //TRKxPC position
+    xToPc=(Double_t)xPc;yToPc=(Double_t)yPc;                                                    //conversion float->double only
+    if(AliHMPIDDigit::IsInside(xPc,yPc,pParam->DistCut())==kFALSE) continue;             //not in active area  
+    pTrk->SetHMPIDtrk      (xRa,yRa,theta,phi);                                                 //store track intersection info
+    pTrk->SetHMPIDcluIdx   (i,0);
+    return i;
+  }                                                                                             //chambers loop
+  return -1; //no intersection with HMPID chambers
+}
diff --git a/HMPID/AliHMPIDTracker.h b/HMPID/AliHMPIDTracker.h
index a43bd8ee17b..216a86a3b13 100644
--- a/HMPID/AliHMPIDTracker.h
+++ b/HMPID/AliHMPIDTracker.h
@@ -25,11 +25,11 @@ class AliHMPIDTracker : public AliTracker
          Int_t       RefitInward    (AliESD *                   )       {return 0;} //pure virtual from AliTracker 
          void        UnloadClusters (                           )       {         } //pure virtual from AliTracker 
 //private part  
-  static Int_t       IntTrkCha     (AliESDtrack *pTrk,Float_t &xPc,Float_t &yPc        );              //find track-PC intersection, retuns chamber ID
-  static Int_t       Recon         (AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean=0);              //do actual job, returns status code  
-  static Int_t       ReconHiddenTrk(Int_t iCh,AliESDtrack *pTrk,TClonesArray *pClus,TObjArray *pNmean);//do actual job with Hidden Track Algorithm    
+  static Int_t       IntTrkCha(AliESDtrack *pTrk,Double_t &xPc,Double_t &yPc);              //find track-PC intersection, retuns chamber ID
+  static Int_t       Recon    (AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean=0);        //do actual job, returns status code  
 protected:
   TObjArray            *fClu;                     //! each chamber holds it's one list of clusters 
+
 ClassDef(AliHMPIDTracker,0)
 };//class AliHMPIDTracker
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/HMPID/AliHMPIDv1.cxx b/HMPID/AliHMPIDv1.cxx
index ddbbef29210..1600e12f121 100644
--- a/HMPID/AliHMPIDv1.cxx
+++ b/HMPID/AliHMPIDv1.cxx
@@ -550,7 +550,7 @@ void AliHMPIDv1::StepManager()
       eloss=0;                                                                                    //reset Eloss collector                         
       gMC->TrackPosition(in[0],in[1],in[2]);                                                      //take position at the entrance
     }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){               //exiting or disappeared
-      eloss              +=gMC->Edep();                                                           //take into account last step Eloss
+      eloss              +=gMC->Edep();                                                            //take into account last step Eloss
                           gMC->CurrentVolOffID(1,copy);                                           //take current chamber since geometry tree is HMPID-Rgap
       Int_t tid=          gMC->GetStack()->GetCurrentTrackNumber();                               //take TID
       Int_t pid=          gMC->TrackPid();                                                        //take PID
diff --git a/HMPID/AliHMPIDv2.cxx b/HMPID/AliHMPIDv2.cxx
index ab3dd2fbfac..8d126af51ed 100644
--- a/HMPID/AliHMPIDv2.cxx
+++ b/HMPID/AliHMPIDv2.cxx
@@ -34,7 +34,6 @@
 #include    //IsLostByFresnel() 
 #include     //CreateMaterials()
 #include       //CreateMaterials()
-#include  //AddAlignableVolumes()
  
 ClassImp(AliHMPIDv2)    
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -43,15 +42,8 @@ void AliHMPIDv2::AddAlignableVolumes()const
 // Associates the symbolic volume name with the corresponding volume path. Interface method from AliModule invoked from AliMC
 // Arguments: none
 //   Returns: none   
-  
-  TGeoHMatrix *pGm = new TGeoHMatrix;
-  Double_t trans[3]={0.5*AliHMPIDDigit::SizeAllX(),0.5*AliHMPIDDigit::SizeAllY(),0};                            //clm: translation from LORS to TGeo RS 
-  pGm->SetTranslation(trans);
- 
-  for(Int_t i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) {
-      TGeoPNEntry *pPn=gGeoManager->SetAlignableEntry(Form("/HMPID/Chamber%i",i),Form("ALIC_1/Hmp_%i",i)); 
-      pPn->SetMatrix(pGm); 
-    }
+  for(Int_t i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++)
+    gGeoManager->SetAlignableEntry(Form("/HMPID/Chamber%i",i),Form("ALIC_1/Hmp_%i",i));           //clm ??? 
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDv2::CreateMaterials()
@@ -324,16 +316,13 @@ void AliHMPIDv2::DefineOpticalProperties()
   TF1 *pGaAF=new TF1("HabsGap","(x<7.75)*6512.399+(x>=7.75)*3.90743e-2/(-1.655279e-1+6.307392e-2*x-8.011441e-3*x*x+3.392126e-4*x*x*x)",emin,emax);  //????? from where  
   
   TF1 *pQeF =new TF1("Hqe"    ,"0+(x>6.07267)*0.344811*(1-exp(-1.29730*(x-6.07267)))"                                                 ,emin,emax);  //fit from DiMauro data 28.10.03  
-                   
-  TString title=GetTitle();
-  Bool_t isFlatIdx=title.Contains("FlatIdx"); 
-  
+                            
   for(Int_t i=0;iEval(eV); (isFlatIdx)? aIdxRad[i]=1.292: aIdxRad[i]=pRaIF->Eval(eV,20);     
-    aAbsWin[i]=pWiAF->Eval(eV);              aIdxWin[i]=pWiIF->Eval(eV);
-    aAbsGap[i]=pGaAF->Eval(eV);              aIdxGap[i]=pGaIF->Eval(eV);   
+    aAbsRad[i]=pRaAF->Eval(eV); aIdxRad[i]=1.292;//pRaIF->Eval(eV,20);      //Simulation for 20 degress C       
+    aAbsWin[i]=pWiAF->Eval(eV); aIdxWin[i]=1.5787;//pWiIF->Eval(eV);
+    aAbsGap[i]=pGaAF->Eval(eV); aIdxGap[i]=1.0005;//pGaIF->Eval(eV);   
     aQeAll[i] =1;                     //QE for all other materials except for PC must be 1.  
     aAbsMet[i] =0.0001;                aIdxMet[i]=0;                                             //metal ref idx must be 0 in order to reflect photon
                                        aIdxPc [i]=1;           aQePc [i]=pQeF->Eval(eV);         //PC ref idx must be 1 in order to apply photon to QE conversion 
@@ -663,14 +652,15 @@ void AliHMPIDv2::StepManager()
   if((gMC->TrackPid()==50000050||gMC->TrackPid()==50000051)&&gMC->CurrentVolID(copy)==fIdPad){   //photon (Ckov or feedback) hit PC (fIdPad)
     if(gMC->Edep()>0){                                                                           //photon survided QE test i.e. produces electron
       if(IsLostByFresnel()){ gMC->StopTrack(); return;}                                          //photon lost due to fersnel reflection on PC       
-                       gMC->CurrentVolOffID(5,copy);                                             //current chamber since geomtry tree is Hmp-Hsec-Hgap-Hrow-Hcel-Hpad
+											 gMC->CurrentVolOffID(5,copy);                                             //current chamber since geomtry tree is Hmp-Hsec-Hgap-Hrow-Hcel-Hpad
       Int_t   tid=     gMC->GetStack()->GetCurrentTrackNumber();                                 //take TID
       Int_t   pid=     gMC->TrackPid();                                                          //take PID
       Float_t etot=    gMC->Etot();                                                              //total hpoton energy, [GeV] 
       Double_t x[3];   gMC->TrackPosition(x[0],x[1],x[2]);                                       //take MARS position at entrance to PC
       Float_t xl,yl;   AliHMPIDParam::Instance()->Mars2Lors(copy,x,xl,yl);                       //take LORS position
+       if ( yl < 0  ) Printf("-------------------> SUPER PROBLEM PHOTON>>> Ch: %d, x[]: %f %f %f (MARS)-> xl: %f yl: %f",copy,x[0],x[1],x[2],xl,yl);
       new((*fHits)[fNhits++])AliHMPIDHit(copy,etot,pid,tid,xl,yl,x);                             //HIT for photon, position at P, etot will be set to Q
-      if(fDoFeed) GenFee(etot);                                                                  //generate feedback photons etot is modified in hit ctor to Q of hit
+      GenFee(etot);                                                                              //generate feedback photons etot is modified in hit ctor to Q of hit
     }//photon hit PC and DE >0 
   }//photon hit PC
   
@@ -691,8 +681,9 @@ void AliHMPIDv2::StepManager()
       out[1]=0.5*(out[1]+in[1]);                                                                  //take hit position at the anod plane
       out[2]=0.5*(out[2]+in[2]);                                                                  //>
       Float_t xl,yl;AliHMPIDParam::Instance()->Mars2Lors(copy,out,xl,yl);                         //take LORS position
+       if ( yl < 0  ) Printf("-------------------> SUPER PROBLEM CHARGED>>> Ch: %d, x[]: %f %f %f (MARS)-> xl: %f yl: %f",copy,out[0],out[1],out[2],xl,yl);
       new((*fHits)[fNhits++])AliHMPIDHit(copy,eloss,pid,tid,xl,yl,out);                           //HIT for MIP, position near anod plane, eloss will be set to Q 
-      if(fDoFeed) GenFee(eloss);                                                                  //generate feedback photons 
+      GenFee(eloss);                                                                              //generate feedback photons 
     }else                                                                                         //just going inside
       eloss          += gMC->Edep();                                                              //collect this step eloss 
   }//MIP in GAP
diff --git a/HMPID/AliHMPIDv2.h b/HMPID/AliHMPIDv2.h
index ebc32796743..63f2232c4e1 100644
--- a/HMPID/AliHMPIDv2.h
+++ b/HMPID/AliHMPIDv2.h
@@ -12,7 +12,7 @@
 #include "AliHMPID.h"             //base class 
 #include "AliHMPIDDigitizer.h"    //CreateDigitizer()
 
-class AliHMPIDv2 : public AliHMPID //TObject-TNamed-AliModule-AliDetector-AliHMPID-AliHMPIDv2
+class AliHMPIDv2 : public AliHMPID //TObject-TNamed-AliModule-AliDetector-AliHMPID-AliHMPIDv0
 {
 public:
                  AliHMPIDv2()                                   :AliHMPID(          ),fIdPad(-1),fIdCell(-1) {;}          //default ctor
diff --git a/HMPID/HESDfromKin.C b/HMPID/HESDfromKin.C
deleted file mode 100644
index 613cba8014e..00000000000
--- a/HMPID/HESDfromKin.C
+++ /dev/null
@@ -1,104 +0,0 @@
-AliRunLoader *gAL=0; 
-Int_t gEvt=0; Int_t gMaxEvt=0;
-TObjArray *pNmean;
-TTree *gEsdTr;
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void HESDfromKin()
-{//simulate ESD from kinematics
-
-  if(gSystem->IsFileInIncludePath("galice.root")){// tries to open session
-    if(gAlice) delete gAlice;                                               //in case we execute this in aliroot delete default AliRun object 
-    gAL=AliRunLoader::Open();                                                                    //try to open galice.root from current dir 
-    gAL->LoadgAlice();                                                                           //take new AliRun object from galice.root   
-    if(gAL->LoadHeader()) return;
-    if(gAL->LoadKinematics()) return;
-
-    AliLoader *pHL=gAL->GetDetectorLoader("HMPID");
-    pHL->LoadRecPoints();
-    AliESD *pEsd = new AliESD();   
-    TFile *pEsdFl=TFile::Open("AliESDs.root","recreate"); 
-    gEsdTr=new TTree("esdTree","Sim ESD from kinematics"); 
-    gEsdTr->Branch("ESD", &pEsd);
-         
-  }  else return;  
-
-  OpenCalib();
-    
-  SimEsd(pHL,pEsd);
-//  SimEsdHidden(pHL,pEsd);
-  
-  pEsdFl->Write();pEsdFl->Close();        
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void SimEsd(AliLoader *pHL,AliESD *pEsd)
-{
-  Printf("---------------------------------------");
-  Printf("| Utility to embed ESD from kinematics|");
-  Printf("---------------------------------------");
-  AliHMPIDTracker::SetFieldMap(gAL->GetAliRun()->Field(),kTRUE);
-  AliHMPID *pH=(AliHMPID*)gAL->GetAliRun()->GetDetector("HMPID");
-  Int_t mtid=-1;
-  Int_t iNevt=gAL->GetNumberOfEvents();
-  Printf("Number of events to process: %i",iNevt);
-  for(Int_t iEvt=0;iEvtGetEvent(iEvt);    
-    pHL->TreeR()->GetEntry(0);
-    AliStack *pStack=gAL->Stack();
-    for(Int_t i=0;iGetNtrack();i++){
-      TParticle *pTrack=pStack->Particle(i); 
-      mtid=pTrack->GetFirstMother();
-      if(mtid>=0) continue; // only primaries
-      AliESDtrack trk(pTrack);
-      pEsd->AddTrack(&trk);
-      AliHMPIDTracker::Recon(pEsd,pH->CluLst(),pNmean);
-    }// track loop
-    pEsd->SetMagneticField(AliHMPIDTracker::GetBz());
-    gEsdTr->Fill();
-    pEsd->Reset();
-  }// event loop
-  Printf("Events processed %i",iEvt);
-  gAL->UnloadHeader();  gAL->UnloadKinematics();
-}//EsdFromStack()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void SimEsdHidden(AliLoader *pHL,AliESD *pEsd)
-{  
-  AliHMPIDTracker::SetFieldMap(gAL->GetAliRun()->Field(),kTRUE);
-  AliHMPID *pH=(AliHMPID*)gAL->GetAliRun()->GetDetector("HMPID");
-  Int_t mtid=-1;
-  Int_t iNevt=gAL->GetNumberOfEvents();
-  Printf("Number of events to process: %i",iNevt);
-  for(Int_t iEvt=0;iEvtGetEvent(iEvt);
-    pHL->TreeR()->GetEntry(0);
-    AliESDtrack trk;
-// Hidden Track
-    for(int iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++){
-      AliESDtrack trk;
-       if(AliHMPIDTracker::ReconHiddenTrk(iCh,&trk,pH->CluLst(),pNmean);) continue;
-       pEsd->AddTrack(&trk);
-       Printf(" theta Cerenkov reconstructed %f",trk.GetHMPIDsignal());
-    }
-//    AliHMPIDTracker::Recon(pEsd,pH->CluLst(),pNmean);
-//      
-    pEsd->SetMagneticField(AliHMPIDTracker::GetBz());
-    gEsdTr->Fill();
-    pEsd->Reset();
-  }// event loop
-  Printf("Events processed %i",iEvt);
-  gAL->UnloadHeader();  gAL->UnloadKinematics();
-}//EsdFromStack()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void OpenCalib()
-{
-  AliCDBManager* pCDB = AliCDBManager::Instance();
-  pCDB->SetDefaultStorage("local://$HOME");
-  AliCDBEntry *pQthreEnt=pCDB->Get("HMPID/Calib/Qthre",0);
-  AliCDBEntry *pNmeanEnt=pCDB->Get("HMPID/Calib/Nmean",0);
-  
-  if(!pQthreEnt || ! pNmeanEnt) return;
-  
-  pNmean=(TObjArray*)pNmeanEnt->GetObject(); 
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/HMPID/HMPIDbaseLinkDef.h b/HMPID/HMPIDbaseLinkDef.h
index 772bda35164..cf02931dbde 100644
--- a/HMPID/HMPIDbaseLinkDef.h
+++ b/HMPID/HMPIDbaseLinkDef.h
@@ -8,6 +8,4 @@
 #pragma link C++ class  AliHMPIDHit+;
 #pragma link C++ class  AliHMPIDCluster+;
 #pragma link C++ class  AliHMPIDParam+;
-#pragma link C++ class  AliHMPIDPreprocessor+;
-
 #endif
diff --git a/HMPID/HMPIDrecLinkDef.h b/HMPID/HMPIDrecLinkDef.h
index 187b7ef181c..b25a6215e34 100644
--- a/HMPID/HMPIDrecLinkDef.h
+++ b/HMPID/HMPIDrecLinkDef.h
@@ -6,4 +6,5 @@
 #pragma link C++ class  AliHMPIDReconstructor+;
 #pragma link C++ class  AliHMPIDTracker+;
 #pragma link C++ class  AliHMPIDRecon+;
+#pragma link C++ class  AliHMPIDPreprocessor+;
 #endif
diff --git a/HMPID/Hconfig.C b/HMPID/Hconfig.C
index 054e34af026..942e37e0bf1 100644
--- a/HMPID/Hconfig.C
+++ b/HMPID/Hconfig.C
@@ -15,7 +15,7 @@ public:
           HmpConfig(const char*sFileName);
          ~HmpConfig()                    {Info("ctor","");Cleanup();}
          
-  enum EVersOpts  {kNo=101,kVer0,kVer1,kVer2,kTest, kDeclust=301,kSagita,kFeedback,kElNoise,kQe0=400,kQeNorm,kFlatIdx,kOptics};
+  enum EVersOpts  {kNo=101,kVer0,kVer1,kVer2,kTest, kDeclust=301,kSagita,kFeedback,kElNoise,kQe0=400,kQeNorm,kOptics};
   enum EGenTypes  {kGunZ=1,kGun1,kGun7,kBox,kHijing,kHijingPara,kPythia,kHmpLib,kNotUsed=999};
   
   enum EDetectors {kPIPE=1,kITS,kTPC,kTRD,kTOF,kFRAME,kMAG,kACORDE,kHALL,kPHOS,kT0,kFMD,kABSO,kPMD,kDIPO,kEMCAL,kVZERO,kMUON,kZDC,kSHILD};
@@ -89,7 +89,6 @@ void HmpConfig::GuiHmp(TGHorizontalFrame *pMainHF)
     new TGCheckButton(fOptBG,"Wire sagitta      "  ,kSagita);       fOptBG->SetButton(kSagita);
     new TGCheckButton(fOptBG,"Photon feedback   "  ,kFeedback);     fOptBG->SetButton(kFeedback); 
     new TGCheckButton(fOptBG,"Electronic noise  "  ,kElNoise);     // fOptBG->SetButton(kElNoise); 
-    new TGCheckButton(fOptBG,"C6F14 N=1.292     "  ,kFlatIdx);     
     new TGCheckButton(fOptBG,"Plot optics       "  ,kOptics);     
   pHmpGF->AddFrame(fQeBG=new TGButtonGroup(pHmpGF,""));
     new TGRadioButton(fQeBG,"QE=0"                 ,kQe0);       
@@ -115,11 +114,10 @@ void HmpConfig::WriteHmp(FILE *pF)
   if(!fVerBG->GetButton(kNo)->GetState()){
     TString title;
     if(!fOptBG->GetButton(kSagita)  ->GetState())             fprintf(pF,"  AliHMPIDParam::fgIsWireSagita=kFALSE;\n");
-    if(!fOptBG->GetButton(kFeedback)->GetState())             title+=" NoFeedBack ";
+    if(!fOptBG->GetButton(kFeedback)->GetState())             fprintf(pF,"  AliHMPID::DoFeed(kFALSE);\n");
     if( fOptBG->GetButton(kElNoise) ->GetState())             fprintf(pF,"  AliHMPIDDigitizer::DoNoise(kTRUE);\n");
     if( fOptBG->GetButton(kTest)    ->GetState())             title+=" TestBeam ";
     if( fOptBG->GetButton(kOptics)  ->GetState())             title+=" ShowOptics ";
-    if( fOptBG->GetButton(kFlatIdx) ->GetState())             title+=" FlatIdx ";
     if(title.Length()==0) title="Default";
     
     if     (fVerBG->GetButton(kVer0)->GetState())           fprintf(pF,"  new AliHMPIDv0(\"Gel %s\");\n\n",title.Data());    
@@ -698,7 +696,7 @@ void HmpConfig::WriteConfig()
   WritePhys(pF); //physics processes
   
 //Field
-       if(fMagBG->GetButton(kFld0)->GetState())     fprintf(pF,"  gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",0,1,10,0));       //no field\n\n");
+       if(fMagBG->GetButton(kFld0)->GetState())     fprintf(pF,"  gAlice->SetField(0);        //no field\n\n");
   else if(fMagBG->GetButton(kFld2)->GetState())     fprintf(pF,"  gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,1,10,0));//0.2 Tesla field\n\n");
   else if(fMagBG->GetButton(kFld4)->GetState())     fprintf(pF,"  gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,1,10,1));//0.4 Tesla field\n\n");
   else if(fMagBG->GetButton(kFld5)->GetState())     fprintf(pF,"  gAlice->SetField(new AliMagFMaps(\"Maps\",\"Maps\",2,1,10,2));//0.5 Tesla field\n\n");
diff --git a/HMPID/Hdisp.C b/HMPID/Hdisp.C
index f46af9d3386..916ee395b81 100644
--- a/HMPID/Hdisp.C
+++ b/HMPID/Hdisp.C
@@ -27,11 +27,10 @@ void Hdisp(Int_t cosRun=44)                                                    /
       
       TFile *pEsdFl=TFile::Open("AliESDs.root"); gEsdTr=(TTree*) pEsdFl->Get("esdTree"); gEsdTr->SetBranchAddress("ESD", &gEsd);
       pAll->cd(7); TButton *pBtn=new TButton("Next","ReadEvt()",0,0,0.2,0.1);   pBtn->Draw();
-                   TButton *pHitBtn=new TButton("Print hits","PrintHits()",0  ,0.2,0.3,0.3);   pHitBtn->Draw();
-                   TButton *pSdiBtn=new TButton("Print sdis","PrintSdis()",0  ,0.4,0.3,0.5);   pSdiBtn->Draw();
-                   TButton *pDigBtn=new TButton("Print digs","PrintDigs()",0  ,0.6,0.3,0.7);   pDigBtn->Draw();
-                   TButton *pCluBtn=new TButton("Print clus","PrintClus()",0  ,0.8,0.3,0.9);   pCluBtn->Draw();  
-                   TButton *pEsdBtn=new TButton("Print  ESD"," PrintEsd()",0.4,0.8,0.7,0.9);  pEsdBtn->Draw();  
+                   TButton *pHitBtn=new TButton("Print hits","PrintHits()",0,0.2,0.3,0.3);   pHitBtn->Draw();
+                   TButton *pSdiBtn=new TButton("Print sdis","PrintSdis()",0,0.4,0.3,0.5);   pSdiBtn->Draw();
+                   TButton *pDigBtn=new TButton("Print digs","PrintDigs()",0,0.6,0.3,0.7);   pDigBtn->Draw();
+                   TButton *pCluBtn=new TButton("Print clus","PrintClus()",0,0.8,0.3,0.9);   pCluBtn->Draw();  
       ReadEvt();
     }
     else if ( gSystem->IsFileInIncludePath(Form("cosmic%d.root",cosRun))){                          //clm: Check if cosmic file is in the folder
@@ -77,6 +76,8 @@ void SimEvt()
   TObjArray    digs(7); for(Int_t i=0;i<7;i++) digs.AddAt(new TClonesArray("AliHMPIDDigit"),i);
   TObjArray    clus(7); for(Int_t i=0;i<7;i++) clus.AddAt(new TClonesArray("AliHMPIDCluster"),i);
   AliESD esd;
+  AliHMPIDDigit::fSigmas=4;
+  AliHMPIDDigitizer::DoNoise(kFALSE);
   gEvt++;
   SimEsd(&esd);
   SimHits(&esd,&hits);
@@ -114,8 +115,8 @@ void SimHits(AliESD *pEsd, TClonesArray *pHits)
   Int_t hc=0; 
   for(Int_t iTrk=0;iTrkGetNumberOfTracks();iTrk++){//tracks loop
     AliESDtrack *pTrk=pEsd->GetTrack(iTrk);
-    Float_t xPc,yPc;
-    Int_t ch=AliHMPIDTracker::IntTrkCha(pTrk,xPc,yPc);
+    Float_t xRa,yRa;
+    Int_t ch=AliHMPIDTracker::IntTrkCha(pTrk,xRa,yRa);
     if(ch<0) continue; //this track does not hit HMPID
     Float_t beta = pTrk->GetP()/(TMath::Sqrt(pTrk->GetP()*pTrk->GetP()+0.938*0.938));
     Float_t ckov=TMath::ACos(1./(beta*1.292));
@@ -353,20 +354,6 @@ void PrintClus()
   Printf("totally %i clusters for event %i",iCluCnt,gEvt);
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void PrintEsd()
-{//prints a list of HMPID Esd  for a given event
-  Printf("List of HMPID ESD summary for event %i",gEvt);
-  Int_t nTrks = gEsd->GetNumberOfTracks();
-  
-  for(Int_t iTrk=0;iTrkGetTrack(iTrk);
-    Float_t x,y;Int_t q,nacc;
-    pTrk->GetHMPIDmip(x,y,q,nacc);
-    Printf("Track %02i with p %7.2f with ThetaCer %5.3f with %i photons",iTrk,pTrk->GetP(),pTrk->GetHMPIDsignal(),nacc);
-  }
-  
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void OpenCalib()
 {
   AliCDBManager* pCDB = AliCDBManager::Instance();
diff --git a/HMPID/Hmenu.C b/HMPID/Hmenu.C
index 23c2e62d04c..b0bb6bfdb2f 100644
--- a/HMPID/Hmenu.C
+++ b/HMPID/Hmenu.C
@@ -200,6 +200,9 @@ void t1(Int_t case=1)
   
   cl->Print();  
 }//t1()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void hp(Int_t iEvt=0)
 {
@@ -261,3 +264,16 @@ void cp(Int_t iEvt=0)
   Printf("totally %i clusters for event %i",iCluCnt,iEvt);
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+void ttt()
+{
+  TClonesArray hits ("AliHMPIDDigit");
+  TClonesArray sdigs("AliHMPIDDigit");
+  
+  AliHMPIDHit hit(0,45e-9,kProton,33,0,0);
+  hit.Hit2Sdi(&sdigs);
+  sdigs.Print();
+}
+
+
+#include "Hdisp.C"
diff --git a/HMPID/Hqa.C b/HMPID/Hqa.C
index e707debb3cc..e532bb41c96 100644
--- a/HMPID/Hqa.C
+++ b/HMPID/Hqa.C
@@ -1,116 +1,9 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TObjArray *CreateContainer(const char *classname,TTree *pTree)
-{
-  TObjArray *pOA=new TObjArray(7); pOA->SetOwner();
-  for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++){
-    TClonesArray *pCA=new TClonesArray(classname);
-    pOA->AddAt(pCA,iCh);    
-    pTree->SetBranchAddress(Form("HMPID%i",iCh),&pCA);
-  }
-  return pOA;
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TH1F *hHitQdc; TH2F *hHitMap[7];  
-void Hits(Int_t mode,TTree *pTree=0x0)
-{
-  switch(mode){
-    case 1:
-      hHitQdc=new TH1F("HitQdc","Hit Qdc all chamber;QDC",500,0,4000);
-      for(Int_t iCh=0;iCh<7;iCh++) hHitMap[iCh]=new TH2F(Form("HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),160,0,160,160,0,160);      
-      return;
-    case 2:
-      if(pTree==0) return;
-      TClonesArray *pHits=new TClonesArray("AliHMPIDHit");  pTree->SetBranchAddress("HMPID",&pHits);  
-      for(Int_t iEnt=0;iEntGetEntriesFast();iEnt++){//entries loop
-        pTree->GetEntry(iEnt);
-        for(Int_t iHit=0;iHitGetEntriesFast();iHit++){//hits loop
-          AliHMPIDHit *pHit = (AliHMPIDHit*)pHits->UncheckedAt(iHit);
-          hHitMap[pHit->Ch()]->Fill(pHit->LorsX(),pHit->LorsY());
-          hHitQdc->Fill(pHit->Q());
-        }//hits loop      
-      }//entries loop
-      delete pHits;
-      return;
-    case 3:
-      TCanvas *c1=new TCanvas("HitCan","Hits",1280,800); c1->Divide(3,3);
-  
-      for(Int_t iCh=0;iCh<7;iCh++){
-        if(iCh==6) c1->cd(1); if(iCh==5) c1->cd(2);
-        if(iCh==4) c1->cd(4); if(iCh==3) c1->cd(5); if(iCh==2) c1->cd(6);
-                              if(iCh==1) c1->cd(8); if(iCh==0) c1->cd(9);
-        hHitMap[iCh]->Draw();
-      }  
-      c1->cd(3); gPad->SetLogy(); hHitQdc->Draw();
-      return;
-  }
-}//Hits()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-TH1F *hCluEvt,*hCluChi2,*hCluFlg,*hCluSize;
-void Clus(Int_t mode, TTree *pTree=0x0)
-{
-  switch(mode){
-    case 1:
-      hCluEvt=new TH1F("CluPerEvt","# clusters per event",11,-0.5,10.5);
-      hCluChi2  =new TH1F("CluChi2"  ,"Chi2 "               ,1000,0,100);
-      hCluFlg   =new TH1F("CluFlg"   ,"Cluster flag"        ,14,-1.5,12.5);                       hCluFlg->SetFillColor(5);
-      hCluSize  =new TH1F("CluSize"  ,"Raw cluster size    ",100,0,100);
-      return;
-    case 2:      
-      if(pTree==0) return;
-      TObjArray *pLst=CreateContainer("AliHMPIDCluster",pTree); pTree->GetEntry(0);
-      for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++){//chambers loop
-        TClonesArray *pClus=(TClonesArray *)pLst->UncheckedAt(iCh);
-        hCluEvt->Fill(pClus->GetEntriesFast());
-        for(Int_t iClu=0;iCluGetEntriesFast();iClu++){//clusters loop
-          AliHMPIDCluster *pClu=(AliHMPIDCluster*)pClus->UncheckedAt(iClu);
-          hCluFlg->Fill(pClu->Status());  hCluChi2->Fill(pClu->Chi2());  hCluSize->Fill(pClu->Size());
-        }
-      }
-      delete pLst;           
-      return;  
-    case 3:
-      TCanvas *c1=new TCanvas("CluComCan","Clusters in common",1280,800); c1->Divide(3,3);
-      c1->cd(1); hCluEvt->Draw();       c1->cd(2); hCluChi2->Draw(); 
-      c1->cd(3); hCluFlg->Draw();       c1->cd(4); hCluSize->Draw(); 
-      return;
-  }//switch
-}//Clus()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void Hqa()
 {
-
-  TFile *fh=0; if(gSystem->IsFileInIncludePath("HMPID.Hits.root"))      fh=TFile::Open("HMPID.Hits.root"     ,"read");if(fh->IsZombie()) fh=0;
-  TFile *fd=0; if(gSystem->IsFileInIncludePath("HMPID.Digits.root"))    fd=TFile::Open("HMPID.Digits.root"   ,"read");if(fd->IsZombie()) fd=0;
-  TFile *fc=0; if(gSystem->IsFileInIncludePath("HMPID.RecPoints.root")) fc=TFile::Open("HMPID.RecPoints.root","read");if(fc->IsZombie()) fc=0;
-  if(fh==0 && fd==0 && fc==0){Printf("Nothing to do!"); return;}
-  if(fh) Hits(1); if(fc) Clus(1);  //book
-  Int_t iEvt=0;
-  while(1){
-    TTree *th=0; if(fh) th=(TTree*)fh->Get(Form("Event%i/TreeH",iEvt));
-    TTree *td=0; if(fd) td=(TTree*)fd->Get(Form("Event%i/TreeD",iEvt));
-    TTree *tc=0; if(fc) tc=(TTree*)fc->Get(Form("Event%i/TreeR",iEvt));
-    Hits(2,th);   Clus(2,tc); //fill
-    if(th==0 && td==0 && tc==0) break;
-    iEvt++;
-    Printf("Event %i processed",iEvt);
-  }
-  if(fh) Hits(3);  if(fc) Clus(3); //plot
-}
-
-/*
-
-void BlahQA()
+  gROOT->LoadMacro("Hdisp.C");
+  HitQA();
+}//Hqa()
+void HitQA()
 {
   TFile *pFile = new TFile("Hqa.root","recreate");
   AliHMPIDCluster::DoCorrSin(kFALSE);
@@ -123,6 +16,10 @@ void BlahQA()
   TH1F *hQ500eV=new TH1F("hQ500eV","" ,300,-50,2000);     hQ500eV->SetLineColor(kCyan);     lQ->AddEntry(hQ500eV,"mip 500 eV");
   TH1F *hQ900eV=new TH1F("hQ900eV","" ,300,-50,2000);     hQ900eV->SetLineColor(kGreen);    lQ->AddEntry(hQ900eV,"mip 900 eV");
   
+  TH1F *hCluPerEvt=new TH1F("hCluPerEvt","# clusters per event",11,-0.5,10.5);
+  TH1F *hCluChi2  =new TH1F("hChi2","Chi2 ",1000,0,100);
+  TH1F *hCluFlg   =new TH1F("hCluFlg","Cluster flag",14,-1.5,12.5);                       hCluFlg->SetFillColor(5);
+  TH1F *hCluRawSize= new TH1F("hCluRawSize","Raw cluster size ",100,0,100);
   
   gStyle->SetOptStat(10);
   TH2F *pCluMapSi1  =new TH2F("cluMapSi1","Size 1 map"       ,1700,-10,160,1700,-10,160);
@@ -144,6 +41,7 @@ void BlahQA()
   TH2F *hHitCluDifXY= new TH2F("hHitCluDifXY",";x_{Hit}-x_{Clu};y_{Hit}-y_{Clu}",1000,-1,1,1000,-1,1);hHitCluDifXY->Sumw2();  
   TH1F *hHitCluDifQ = new TH1F("hHitCluDifQ" ,";entries;(Q_{Clu}-Q_{Hit})/Q_{Hit}" ,200 ,-200,200);   hHitCluDifQ->Sumw2();    hHitCluDifQ->SetFillColor(kYellow);
   
+  TH2F *hHitMap= new TH2F("hHitMap",";x_{Hit};y_{Hit}",1700,-10,160,1700,-10,160);  
  
   Float_t e200=200e-9,e500=500e-9,e900=900e-9,e7=7e-9;//predefined  Eloss
   
@@ -188,6 +86,10 @@ void BlahQA()
 
 // From here normal procedure for QA
 
+    for(Int_t iHit=0;iHitFill(pHit->LorsX(),pHit->LorsY());
+    }
     Int_t kMaxCh=(nHits==1)?0:AliHMPIDDigit::kMaxCh;
     for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=kMaxCh;iCh++){//chambers loop
       TClonesArray *pDigs=(TClonesArray *)digs.UncheckedAt(iCh);
@@ -205,6 +107,19 @@ void BlahQA()
         hCluRawSize->Fill(pClu->Size());
 	 
         switch(pClu->Status()){
+/*
+    case        kFrm  : status="formed        "   ;break;
+    case        kUnf  : status="unfolded (fit)"   ;break;
+    case        kCoG  : status="coged         "   ;break;
+    case        kLo1  : status="locmax 1 (fit)"   ;break;
+    case        kMax  : status="exceeded (cog)"   ;break;
+    case        kNot  : status="not done (cog)"   ;break;
+    case        kEmp  : status="empty         "   ;break;
+    case        kEdg  : status="edge     (fit)"   ;break;
+    case 	kSi1  : status="size 1   (cog)"   ;break;
+    case 	kNoLoc: status="no LocMax(fit)"   ;break;
+    case 	kAbn  : status="Abnormal fit  "   ;break;
+*/
             case AliHMPIDCluster::kSi1:   pCluMapSi1->Fill(clux,cluy);  break;
             case AliHMPIDCluster::kLo1:   pCluMapLo1->Fill(clux,cluy);  break;
             case AliHMPIDCluster::kUnf:   pCluMapUnf->Fill(clux,cluy);  break; 
@@ -229,8 +144,55 @@ void BlahQA()
       
     hits.Delete();  sdigs.Delete();  for(int i = 0;i<7;i++){((TClonesArray*)digs.At(i))->Delete();((TClonesArray*)clus.At(i))->Delete();}
   }//events loop      
-}
-
+      
+  gStyle->SetPalette(1);
+  TCanvas *pC2=new TCanvas("Digit canvas","Digit canvas",1280,800); pC2->Divide(3,3);
+  pC2->cd(1);hHitCluDifX->Draw("hist");
+  pC2->cd(2);hHitCluDifY->Draw("hist");
+//  pC2->cd(3);hHitCluDifXY->Draw("colz");
+  // Draw CorrSin
+  AliHMPIDCluster c;
+  TPolyLine *pLine = new TPolyLine(500);
+  for(Int_t i=0;i<500;i++) {
+    Double_t x = 0 + i*AliHMPIDDigit::SizePadX()/500.;
+    c.SetX(x);c.SetY(0);c.CorrSin();
+    pLine->SetPoint(i,x-0.5*AliHMPIDDigit::SizePadX(),c.X()-x);
+  }
+  pC2->cd(3);hHitCluDifXv->Draw("colz");pLine->Draw("C");
+  //
+  pC2->cd(4);hHitCluDifQ->Draw("hist");
+  pC2->cd(5);gPad->SetLogy(1);hCluFlg->Draw();
+  pC2->cd(6);hCluChi2->Draw();
+  pC2->cd(7);                 hCluRawSize->Draw();
+  pC2->cd(8);                 hCluPerEvt->Draw();
+  pC2->cd(9);                 hQ7eV->Draw(); hQ200eV->Draw("same"); hQ500eV->Draw("same"); hQ900eV->Draw("same"); lQ->Draw();
+  TCanvas *pC1=new TCanvas("ClusterMaps","Cluster maps",1280,800); pC1->Divide(3,3);
+  pC1->cd(1);  pCluMapSi1->Draw();  DrawCh(-1);
+  pC1->cd(2);  pCluMapLo1->Draw();  DrawCh(-1);
+  pC1->cd(3);  pCluMapUnf->Draw();  DrawCh(-1);
+  pC1->cd(4);     hHitMap->Draw();  DrawCh(-1);
+  pC1->cd(5);  pCluMapMax->Draw();  DrawCh(-1);
+  pC1->cd(6);  pCluMapEdg->Draw();  DrawCh(-1);
+  pC1->cd(7);  pCluMapNot->Draw();  DrawCh(-1);
+  pC1->cd(8);  pCluMapNoLoc->Draw();DrawCh(-1);
+  pC1->cd(9);  pCluMapEmp->Draw();  DrawCh(-1);
+   
+  pC1->SaveAs("$HOME/HitMaps.png");  //?????
+  pC2->SaveAs("$HOME/HitCluDif.gif");  
 
+  pFile->Write();  
+  Printf("Digits - raw -digits conversion...");  
+  
+  AliHMPIDDigit d1,d2; Int_t ddl,r,d,a;UInt_t w32;
 
-*/
+  for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++)
+  for(Int_t iPc=AliHMPIDDigit::kMinPc;iPc<=AliHMPIDDigit::kMaxPc;iPc++)
+  for(Int_t iPx=AliHMPIDDigit::kMinPx;iPx<=AliHMPIDDigit::kMaxPx;iPx++)
+  for(Int_t iPy=AliHMPIDDigit::kMinPy;iPy<=AliHMPIDDigit::kMaxPy;iPy++){
+    d1.Set(iCh,iPc,iPx,iPy,3040);   //set digit               
+    d1.Raw(w32,ddl,r,d,a);          //get raw word for this digit 
+    d2.Raw(w32,ddl);                //set another digit from that raw word
+    if(d1.Compare(&d2)) {d1.Print(); d2.Print(); Printf("");}//compare them
+  }
+  Printf("OK");
+}//tst()
diff --git a/HMPID/Hshuttle.C b/HMPID/Hshuttle.C
index a1f0cfaccac..fdd3ced0b5e 100644
--- a/HMPID/Hshuttle.C
+++ b/HMPID/Hshuttle.C
@@ -1,44 +1,22 @@
 void Hshuttle(Int_t runTime=1500)
-{// this macro is to simulate the functionality of SHUTTLE.
+{
+// this macro is to simulate the functionality of SHUTTLE.
+// Here the list of DCS aliases is created and packed in TMap of structure "alias name" - TObjArray of AliDCSValue; AliDCSValue is a pair value-time stamp     
+// currently simulated: freon temperature 2 per radiator (inlet,outlet)
+//                      methane pressure 1 per chamber   
   gSystem->Load("libTestShuttle.so");
-  AliTestShuttle::SetMainCDB(TString("local://$HOME/CDB"));
-  
-  TMap *pDcsMap = new TMap;       pDcsMap->SetOwner(1);          //DCS archive map
   
-  AliTestShuttle* pShuttle = new AliTestShuttle(0,0,1000000);   
-  SimPed();   for(Int_t ldc=1;ldc<=4;ldc++) pShuttle->AddInputFile(AliTestShuttle::kDAQ,"HMP","pedestals",Form("LDC%i",ldc),Form("HmpidPeds%i.tgz",ldc));
-  SimMap(pDcsMap,runTime); pShuttle->SetDCSInput(pDcsMap);                                    //DCS map
+  AliTestShuttle::SetMainCDB(TString("local://$HOME"));
   
-  AliPreprocessor* pp = new AliHMPIDPreprocessor(pShuttle); pShuttle->Process();  delete pp;  //here goes preprocessor 
+  TMap        *pDcsMap = new TMap;       pDcsMap->SetOwner(1);          //DCS archive map
 
-  DrawInput(pDcsMap); DrawOutput();
+  SimMap(pDcsMap,runTime);
+  TestShuttle(pDcsMap);  
+  TCanvas *c=new TCanvas("cc","ff",600,600);  
+  DrawInput(c,pDcsMap);
+  DrawOutput();
 }//Hshuttle()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void SimPed()
-{
-  ofstream out;
-  for(Int_t ddl=0;ddl<=13;ddl++){
-    out.open(Form("HmpidPedDdl%02i.txt",ddl));
-    out << 3 <Rndm();
-          Float_t sigma = ddl+gRandom->Gaus();
-          Int_t inhard=((Int_t(mean))<<9)+Int_t(mean+3*sigma);
-          out << Form("%2i %2i %2i %5.2f %5.2f %x\n",row,dil,adr,mean,sigma,inhard);
-        }
-
-    Printf("file ped %02i created",ddl);
-    out.close();
-  }
-  gSystem->Exec("tar czf HmpidPeds1.tgz HmpidPedDdl00.txt HmpidPedDdl01.txt HmpidPedDdl02.txt HmpidPedDdl03.txt");
-  gSystem->Exec("tar czf HmpidPeds2.tgz HmpidPedDdl04.txt HmpidPedDdl05.txt HmpidPedDdl06.txt HmpidPedDdl07.txt");
-  gSystem->Exec("tar czf HmpidPeds3.tgz HmpidPedDdl08.txt HmpidPedDdl09.txt HmpidPedDdl10.txt HmpidPedDdl11.txt");
-  gSystem->Exec("tar czf HmpidPeds4.tgz HmpidPedDdl12.txt HmpidPedDdl13.txt");
-  gSystem->Exec("rm -rf ped*.txt");
-}
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void SimMap(TMap *pDcsMap,Int_t runTime=1500)
 {
   Int_t stepTime=100; //time interval between mesuraments
@@ -50,74 +28,68 @@ void SimMap(TMap *pDcsMap,Int_t runTime=1500)
     TObjArray *pHV=new TObjArray; pHV->SetOwner(1); 
     for(Int_t time=0;timeAdd(new AliDCSValue((Float_t)1005.0 ,time));   //sample CH4 pressure [mBar]
                                                    pHV->Add(new AliDCSValue((Float_t)2010.0,time));   //sample chamber HV [V]
-    pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value"           ,iCh,iCh,iCh)),pP); 
-    pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh)),pHV); 
+      
+    pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fP,iCh,iCh,iCh)),pP); 
+    pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fHV,iCh,iCh,iCh)),pHV); 
         
     for(Int_t iRad=0;iRad<3;iRad++){//radiators loop
       TObjArray *pT1=new TObjArray; pT1->SetOwner(1); 
       TObjArray *pT2=new TObjArray; pT2->SetOwner(1); 
       for (Int_t time=0;timeAdd(new AliDCSValue(13,time));  //sample inlet temperature    Nmean=1.292 @ 13 degrees
-      for (Int_t time=0;timeAdd(new AliDCSValue(14,time));  //sample outlet temperature
-      pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad)) ,pT1); 
-      pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp",iCh,iCh,iRad)),pT2);
+      for (Int_t time=0;timeAdd(new AliDCSValue(13,time));  //sample outlet temperature
+      pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fT1,iCh,iCh,iRad)) ,pT1); 
+      pDcsMap->Add(new TObjString(Form(AliHMPIDPreprocessor::fT2,iCh,iCh,iRad)),pT2);
     }//radiators loop    
   }//chambers loop
 }//SimMap()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void DrawInput(TMap *pDcsMap)
+void TestShuttle(TMap *pDcsMap)
+{
+  AliTestShuttle* pShuttle = new AliTestShuttle(0,0,1000000);   
+  pShuttle->SetDCSInput(pDcsMap);                                                    //DCS map
+  AliPreprocessor* pp = new AliHMPIDPreprocessor(pShuttle);                           //actual ipreprocessor is created here
+  pShuttle->Process();                                                               //run SHUTTLE simulator
+  delete pp;
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void DrawInput(TCanvas *c,TMap *pDcsMap)
 {
-  TCanvas *c=new TCanvas("cc","Input data",600,600);    c->Divide(3,3);
+  c->Divide(3,3);
   
-  AliDCSValue *pVal; Int_t cnt;
+  AliDCSValue *pVal; Int_t cnt=0;
   
   for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
     if(iCh==6) c->cd(1);  if(iCh==5) c->cd(2);                          
     if(iCh==4) c->cd(4);  if(iCh==3) c->cd(5);  if(iCh==2) c->cd(6);
                           if(iCh==1) c->cd(8);  if(iCh==0) c->cd(9); 
                           
-    TObjArray *pHV=(TObjArray*)pDcsMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh,iCh)); //HV
-    TObjArray *pP =(TObjArray*)pDcsMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value",iCh,iCh,iCh)); //P
-    TGraph *pGrHV=new TGraph; pGrHV->SetMarkerStyle(5); TIter nextHV(pHV);
-    TGraph *pGrP =new TGraph; pGrP ->SetMarkerStyle(5); TIter nextP (pP );
+    TObjArray *pHV=(TObjArray*)pDcsMap->GetValue(Form(AliHMPIDPreprocessor::fHV,iCh,iCh,iCh,iCh)); //HV
+    TObjArray *pP =(TObjArray*)pDcsMap->GetValue(Form(AliHMPIDPreprocessor::fP,iCh,iCh,iCh)); //P
+    TGraph *pGr=new TGraph; pGr->SetMarkerStyle(5);
     
-    for(Int_t iRad=0;iRad<3;iRad++){
-      TObjArray *pT1=(TObjArray*)pDcsMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad));  TIter nextT1(pT1);
-      TObjArray *pT2=(TObjArray*)pDcsMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp",iCh,iCh,iRad)); TIter nextT2(pT2);
-      TGraph *pGrT1=new TGraph; pGrT1->SetMarkerStyle(5); 
-      TGraph *pGrT2=new TGraph; pGrT2->SetMarkerStyle(5); 
-      cnt=0; while((pVal=(AliDCSValue*)nextT1())) pGrT1->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());
-      cnt=0; while((pVal=(AliDCSValue*)nextT2())) pGrT2->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());
-      pGrT1->Draw("AP");  pGrT2->Draw("same");
-    }//radiators loop
-  }//chambers loop  
-}//DrawInput()
+    TIter nextp(pP); cnt=0; while((pVal=(AliDCSValue*)nextp())){ pGr->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());}//P
+
+    
+    pGr->Draw("AP");
+  }  
+}
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void DrawOutput()
 {
-  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/CDB"); AliCDBManager::Instance()->SetRun(0);
-  AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre");
-  AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean");
-  AliCDBEntry *pDaqSigEnt=AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");
+  AliCDBManager::Instance()->SetDefaultStorage("local://$HOME");
+  AliCDBEntry *pQthreEnt=AliCDBManager::Instance()->Get("HMPID/Calib/Qthre",0);
+  AliCDBEntry *pNmeanEnt=AliCDBManager::Instance()->Get("HMPID/Calib/Nmean",0);
+  
+  if(!pQthreEnt || ! pNmeanEnt) return;
   
-  if(!pQthreEnt || !pNmeanEnt || !pDaqSigEnt) return;
+  TObjArray *pNmean=(TObjArray*)pNmeanEnt->GetObject(); 
+  TObjArray *pQthre=(TObjArray*)pQthreEnt->GetObject(); 
   
-  TObjArray *pNmean =(TObjArray*)pNmeanEnt ->GetObject(); 
-  TObjArray *pQthre =(TObjArray*)pQthreEnt ->GetObject(); 
-  TObjArray *pDaqSig=(TObjArray*)pDaqSigEnt->GetObject();
-   
   TF1 *pRad0,*pRad1,*pRad2;  
-  TCanvas *c2=new TCanvas("c2","Output"); c2->Divide(3,3);
+  TCanvas *c2=new TCanvas("c2","Nmean"); c2->Divide(3,3);
   
-  TH1F *pSig[7];
   
   for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
-    TMatrix *pM=(TMatrix*)pDaqSig->At(iCh);
-    
-    pSig[iCh]=new TH1F(Form("sig%i",iCh),"Sigma;[QDC]",100,-5,20); //pSig[iCh]->SetLineColor(iCh+kRed);
-    for(Int_t padx=0;padx<160;padx++) for(Int_t pady=0;pady<144;pady++) pSig[iCh]->Fill((*pM)(padx,pady));
-    
-    c2->cd(7);    if(iCh==0) pSig[iCh]->Draw(); else pSig[iCh]->Draw("same");
-    
     if(iCh==6) c2->cd(1);  if(iCh==5) c2->cd(2);                          
     if(iCh==4) c2->cd(4);  if(iCh==3) c2->cd(5);  if(iCh==2) c2->cd(6);
                            if(iCh==1) c2->cd(8);  if(iCh==0) c2->cd(9); 
@@ -125,6 +97,5 @@ void DrawOutput()
     TF1 *pRad0=(TF1*)pNmean->At(iCh*3+0); pRad0->Draw();  pRad0->GetXaxis()->SetTimeDisplay(kTRUE); pRad0->GetYaxis()->SetRangeUser(1.28,1.3);
     TF1 *pRad1=(TF1*)pNmean->At(iCh*3+1); pRad1->Draw("same");
     TF1 *pRad2=(TF1*)pNmean->At(iCh*3+2); pRad2->Draw("same");
-  }//chambers loop    
-}//DrawOutput()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  }//chambers loop  
+}
diff --git a/HMPID/api.txt b/HMPID/api.txt
index 6fa91ed3cd2..1691459cf7a 100644
--- a/HMPID/api.txt
+++ b/HMPID/api.txt
@@ -31,8 +31,7 @@ How to deal with the stack of particles?
 	- total amount of primary particles in stack for a given event (after LoadHeader()): 
         	AliStack::GetNprimary() 
 How to retrieve hits:
-	Hits are stored on primary by primary basis (hits corresponding to primary particles stored in a single entry; total number of entries in hits tree equals
-        to number of primaries; order of primaries is not preserved). Hits for the given primary is TClonesArray.
+	Hits are stored on primary by primary basis. Hits for the given primary is TClonesArray.
    	To retrieve all hits one needs to do:
      	-initialize the root tree and containers:   pRich->GetLoader()->LoadHits();  (AliLoader::LoadHits() returns 0 on success)
      	-read number of entries in TreeH:           pRich->GetLoader()->TreeH()->GetEntries()
@@ -67,6 +66,7 @@ What are the meanings of different VMC flags:
 	gMC->IsTrackDisappeared()
 How to get pad number for a local position:
 	use static TVector AliHMPIDParam::Loc2Pad(TVector2 position);
+Why list of chambers belongs to AliHMPIDParam:
 
 How to check if a given stack particle is primary:
 	Stack is TClonesArray of TParticle. TParticle::GetMother(0) returns -1 if it's primary (no mother)         
@@ -75,7 +75,7 @@ How to loop over all possible object:
     for(Int_t iEntryN=0;iEntryN < GetLoader()->TreeH()->GetEntries();iEntryN++){//TreeH loop
       GetLoader()->TreeH()->GetEntry(iEntryN);//get current entry (prim)  
       for(Int_t iHitN=0;iHitNGetEntries();iHitN++){//hits loop
-        AliHMPIDHit *pHit=(AliHMPIDHit*)Hits()->At(iHitN);//get current hit 
+        AliVHMPIDHit *pHit=(AliVHMPIDHit*)Hits()->At(iHitN);//get current hit 
         
       }//hits loop
     }//TreeH loop
@@ -84,32 +84,29 @@ How to loop over all possible object:
 
 HMPID full simulation-reconstruction sequence
 
-hits creation:
-        HMPID uses 2 types fo hits: MIP hit and photon hit. Both types are implemented in the same class AliHMPIDHit.
-        The difference in ctor patterns is only in energy variable: for photon it is full energy, whereas for MIP it's energy lost in amplification gap gas.
-        Hit for photon is created when photon enters the volume representing a single pad of segmeneted photocathode and survives QE test.
-        Hit for MIP is created when MIP exits amplification gap (or disappired for whatever reason). The responsible code is AliHMPIDv1::StepManager().
-        Internally in ctor, the energy is converted to the total charge accamulated for this hit expressed in QCD channels. This is done in a honest manner for photon:
-        photon always produces a single electron, and the response of the chamber to a single electron pulse is parametrized out of test beam data for few HV sets.
-        For MIP the same procedure is generally wrong: the total energy lost by particle is devided by ionization potential, this value is interpreted as number of electrons
-        created, then each electon contribution is sampled according to puasonian distribution with the same single electron pulse mean as fro photons. The final charge is
-        then a sum of all single electon's contributions, it substitutes the value of energy.
 hits->sdigit:
-	Due to segmented photocathode, single hit might affect few neighboring pads (up to 9 in our default parametrization). The total charge collected by a single pad
-        is the answer to electrostatic problem solved in article by Mathieson (see ref ???). Actual disintegration is implemented in AliHMPIDHit::Hit2Sdi().
-        The implementation creates by default sdigits only for closest neighbours of a pad containing hit positon (further neighbours might also be checked subject to
-        parameterization flag ?????? but the contribution to them from single hit is such a tiny that only large nubmer of close hits may provide something not negligable). 
+	Responsible method is AliHMPID::Hits2SDigits
+	One hit may affect one or more pads.
+        Hit position is taken on the anode wires plane as the most of avalanche is developed there.
+        This position is not directly available, track intersections with entrance and exit of amplification gap are only stored.
+        So the position in the middle of the gap is calculated as average out of pHit->In() and pHit->Out() positions.
+        Then, total charge collected for this hit is calculated by AliHMPIDParam::Hit2Qdc.    
+        Area of disintegration is a list of pads affected by current hit. This is a parameter of Mathienson    
 sdigits->digits:
 	The necessety of sdigits is dictated by the fact that transport engine transports tracks in a continuous sequence track by track. 
-	It means that it may happen that the same pad is affected by few tracks. But this might be known only after the transport of full event is finished. 
-	So the task of this convertion is to collect all the sdigits for the same pad and sum them up. This is done in AliHMPIDDigitizer::Exec(). This technique also provides
-        the possibility to mix events from seperate simulations facilitating studies of rare signals on top of huge background.
+  It means that it may happen that the same pad is affected by few tracks. But this might be known only after the transport of full event is finished. 
+
 digits->clusters
-	The aim of this conversion is to try to reconstruct the initial position of hits.
-        This it done by 2 steps procedure. On first step so called raw cluster is formed as a composition of all neighboring pads (diagonal pads are not allowed).
-        Then center of gravity of the cluster is calculated and used as a naive estimate of hit position. 
-        On second step, the code tries to improve the hit position  knowledge by fitting by local maxima number of Mathieson shapes. If the procedure failes, the cog
-        position is preserved as hit position.
+	A set of neighboring digits compose cluster. The aim of this transformation is to construct a list of clusters out of digits list.
+  The calling sequence is:
+  AliReconstruction::Run()
+  
+  	AliHMPIDReconstructor::Reconstruct() creates an empty clusters list,  loops on chambers, retrieves a list of digits for a given chamber, gives it to the method Dig2Clu() and finally serializes
+                                        the list 
+                                        
+    	AliHMPIDReconstructor::Dig2Clu() which knows no details about 
+
+
 clusters+tracks->theta cerenkov 
 
 	
@@ -281,13 +278,8 @@ HMPID 6
 
 
 
-Manual:
-Diclaimer: We call the operator any persons who wants "to operate" HMPID that is to do something reasonalbe to understand current perfomance coming from the detector. 
-This person is not necesarelly an expert in HMPID hardware and or software. 
-Be also aware that analysis of HMPID data can only be perfomed from AliESD (taking also into acount some info which is not specific to HMPID). The task to plot something from
-hits, digits or clusters is called quality assesment.
 
-From operator point of view, one needs to do 3 different tasks with HMPID: simulation, reconstruction and QA.
+
 
 
 
diff --git a/HMPID/libHMPIDbase.pkg b/HMPID/libHMPIDbase.pkg
index fa6ef686dda..3807a1a9108 100644
--- a/HMPID/libHMPIDbase.pkg
+++ b/HMPID/libHMPIDbase.pkg
@@ -1,4 +1,4 @@
-SRCS:=  AliHMPIDHit.cxx AliHMPIDDigit.cxx  AliHMPIDCluster.cxx AliHMPIDParam.cxx AliHMPIDPreprocessor.cxx
+SRCS:=  AliHMPIDHit.cxx AliHMPIDDigit.cxx  AliHMPIDCluster.cxx AliHMPIDParam.cxx 
 
 HDRS:= $(SRCS:.cxx=.h)
 DHDR:= HMPIDbaseLinkDef.h
diff --git a/HMPID/libHMPIDrec.pkg b/HMPID/libHMPIDrec.pkg
index bcb4defeece..b25ca000a93 100644
--- a/HMPID/libHMPIDrec.pkg
+++ b/HMPID/libHMPIDrec.pkg
@@ -1,4 +1,4 @@
-SRCS:=  AliHMPIDReconstructor.cxx AliHMPIDTracker.cxx AliHMPIDRecon.cxx
+SRCS:=  AliHMPIDReconstructor.cxx AliHMPIDTracker.cxx AliHMPIDRecon.cxx AliHMPIDPreprocessor.cxx
 
 HDRS:= $(SRCS:.cxx=.h)
 DHDR:= HMPIDrecLinkDef.h
diff --git a/ITS/AliITS.cxx b/ITS/AliITS.cxx
index 84bb1ac1d87..852f7075e72 100644
--- a/ITS/AliITS.cxx
+++ b/ITS/AliITS.cxx
@@ -107,8 +107,7 @@ fOpt("All"),
 fIdN(0),
 fIdSens(0),
 fIdName(0),
-fITSmodules(0),
-fTiming(kFALSE)
+fITSmodules(0)
 {
   // Default initializer for ITS
   //      The default constructor of the AliITS class. In addition to
@@ -121,42 +120,6 @@ fTiming(kFALSE)
 //PH    SetMarkerColor(kRed);
 }
 //______________________________________________________________________
-AliITS::AliITS(const Char_t *title):AliDetector("ITS",title),
-fDetTypeSim(0),
-fEuclidOut(0),
-fOpt("All"),
-fIdN(0),
-fIdSens(0),
-fIdName(0),
-fITSmodules(0),
-fTiming(kFALSE)
-{
-    //     The standard Constructor for the ITS class. 
-    // It also zeros the variables
-    // fIshunt (a member of AliDetector class), fEuclidOut, and zeros
-    // the pointers fIdSens and fIdName. To help in displaying hits via the
-    // ROOT macro display.C AliITS also sets the marker color to red. The
-    // variables passes with this constructor, const char *name and *title,
-    // are used by the constructor of AliDetector class. See AliDetector
-    // class for a description of these parameters and its constructor
-    // functions.
-    // Inputs:
-    //   Char_t *title  Simulation title for the ITS
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-  
-    fHits = new TClonesArray("AliITShit",1560); // from AliDetector
-    if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);
-    //fNhits=0;  //done in AliDetector(name,title)
-    SetDetectors(); // default to fOpt="All". This variable not written out.
-    fDetTypeSim   = new AliITSDetTypeSim();
-    //PH  SetMarkerColor(kRed);
-    if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
-    fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
-}
-//______________________________________________________________________
 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
 fDetTypeSim(0),
 fEuclidOut(0),
@@ -164,8 +127,7 @@ fOpt("All"),
 fIdN(0),
 fIdSens(0),
 fIdName(0),
-fITSmodules(0),
-fTiming(kFALSE)
+fITSmodules(0)
 {
   //     The standard Constructor for the ITS class. 
   // It also zeros the variables
@@ -1277,13 +1239,12 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
 void AliITS::UpdateInternalGeometry(){
 
   //reads new geometry from TGeo 
-//   AliDebug(1,"Delete ITSgeom and create a new one reading TGeo");
-
+  AliDebug(1,"Delete ITSgeom and create a new one reading TGeo");
   AliITSVersion_t version = (AliITSVersion_t)IsVersion();
   Int_t minor = 0;
-  if(version==kvPPRasymmFMD) minor=2;  // default minor version for this geom.
-  AliITSInitGeometry initgeom;
-  AliITSgeom* geom = initgeom.CreateAliITSgeom(version,minor);
+  if(version==kvPPRasymmFMD)minor=2;  // default minor version for this geom.
+  AliITSInitGeometry initgeom(version,minor);
+  AliITSgeom* geom = initgeom.CreateAliITSgeom();
   SetITSgeom(geom);
 }
 
diff --git a/ITS/AliITS.h b/ITS/AliITS.h
index 0e761f5d627..e43a5b4a729 100644
--- a/ITS/AliITS.h
+++ b/ITS/AliITS.h
@@ -36,8 +36,7 @@ class AliITS : public AliDetector {
  public:
     //================= Standard Classes ===============================
     AliITS();  // Default creator.
-    AliITS(const Char_t *title); // standard Creator
-    AliITS(const char *name, const char *title); // extended standard Creator
+    AliITS(const char *name, const char *title); // standard Creator
     virtual ~AliITS(); // destructor
     virtual Int_t IsVersion() const {return 1;}
     virtual Int_t DistancetoPrimitive(Int_t , Int_t )  {return 999;}
@@ -157,12 +156,11 @@ class AliITS : public AliDetector {
     Int_t        *fIdSens;     //[fIdN] layer identifier
     TString      *fIdName;     //[fIdN] layer identifier
     TObjArray    *fITSmodules; //! Pointer to ITS modules
-    Bool_t        fTiming;     // flag to turn on/off timers.
 
  private:
     AliITS(const AliITS &source); // copy constructor. Not to be used!
     AliITS& operator=(const AliITS &source); // = operator. Not to be used!
-    ClassDef(AliITS,7) // Base class for ITS
+    ClassDef(AliITS,6) // Base class for ITS
 
 };
 
diff --git a/ITS/AliITSClusterFinder.cxx b/ITS/AliITSClusterFinder.cxx
index 8895cb9beb6..3ec86d3d2f7 100644
--- a/ITS/AliITSClusterFinder.cxx
+++ b/ITS/AliITSClusterFinder.cxx
@@ -159,6 +159,9 @@ void AliITSClusterFinder::InitGeometry(){
   Int_t mmax=AliITSgeomTGeo::GetNModules();
   for (Int_t m=0; mInverse()).GetTranslation()[1];
+    fZshift[m] = (tm->Inverse()).GetTranslation()[2];
     fNdet[m] = (lad-1)*AliITSgeomTGeo::GetNDetectors(lay) + (det-1);
     fNlayer[m] = lay-1;
   }
diff --git a/ITS/AliITSClusterFinder.h b/ITS/AliITSClusterFinder.h
index 71b8d8e012e..76cd75aa4e6 100644
--- a/ITS/AliITSClusterFinder.h
+++ b/ITS/AliITSClusterFinder.h
@@ -129,6 +129,8 @@ class AliITSClusterFinder :public TObject{
     Int_t              fClusterSize;   //! ClusterSize
     Int_t              fNPeaks;        //! NPeaks  
     // Data members needed to fill AliCluster objects
+    Float_t fYshift[2200];       // y-shifts of detector local coor. systems 
+    Float_t fZshift[2200];       // z-shifts of detector local coor. systems 
     Int_t fNdet[2200];           // detector index  
     Int_t fNlayer[2200];         // detector layer
 
@@ -138,7 +140,7 @@ class AliITSClusterFinder :public TObject{
     AliITSClusterFinder& operator=(const AliITSClusterFinder &source);
     
 
-    ClassDef(AliITSClusterFinder,7) //Class for clustering and reconstruction of space points
+    ClassDef(AliITSClusterFinder,6) //Class for clustering and reconstruction of space points
 };
 // Input and output functions for standard C++ input/output.
 ostream &operator<<(ostream &os,AliITSClusterFinder &source);
diff --git a/ITS/AliITSClusterFinderV2SDD.cxx b/ITS/AliITSClusterFinderV2SDD.cxx
index 0ee8f7301e5..b5ab56bea9e 100644
--- a/ITS/AliITSClusterFinderV2SDD.cxx
+++ b/ITS/AliITSClusterFinderV2SDD.cxx
@@ -31,7 +31,6 @@
 #include "AliITSsegmentationSDD.h"
 #include 
 #include "AliITSdigitSDD.h"
-#include "AliITSgeomTGeo.h"
 
 ClassImp(AliITSClusterFinderV2SDD)
 
@@ -112,9 +111,6 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins,
   //------------------------------------------------------------
   // Actual SDD cluster finder
   //------------------------------------------------------------
-
-  const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule);
-
   AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule);
   Int_t ncl=0; 
   TClonesArray &cl=*clusters;
@@ -238,13 +234,11 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins,
 	 
 	 CorrectPosition(zdet,xdet);
 
-         {
-         Double_t loc[3]={xdet,0.,zdet},trk[3]={0.,0.,0.};
-         mT2L->MasterToLocal(loc,trk);
-         y=trk[1];
-         z=trk[2]; 
-         }
-         q/=5.243;  //to have MPV 1 MIP = 86.4 KeV --> this must go to calibr.
+	 y=-(-xdet+fYshift[fModule]);
+	 z=  -zdet+fZshift[fModule];
+	  
+	 q/=5.039;  //to have MPV 1 MIP = 86.4 KeV
+         q/=16.49;  //to be consistent with SSD - provisional 06-APR-2007
          Float_t hit[5] = {y, z, 0.0030*0.0030, 0.0020*0.0020, q};
          Int_t  info[3] = {maxj-minj+1, maxi-mini+1, fNlayer[fModule]};
 
diff --git a/ITS/AliITSClusterFinderV2SPD.cxx b/ITS/AliITSClusterFinderV2SPD.cxx
index f73d843d2fc..06d4f018475 100644
--- a/ITS/AliITSClusterFinderV2SPD.cxx
+++ b/ITS/AliITSClusterFinderV2SPD.cxx
@@ -84,8 +84,6 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
   
   //Cluster finder for SPD (from digits and from rawdata)
 
-  const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(iModule);
-  
   Int_t nclu=0;
   for(Int_t iBin =0; iBin < maxBins;iBin++){
     if(bins[iBin].IsUsed()) continue;
@@ -189,18 +187,15 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
 	z /= q;
 	y -= fHwSPD;
 	z -= fHlSPD;
-
 	Float_t hit[5]; //y,z,sigma(y)^2, sigma(z)^2, charge
-        {
-        Double_t loc[3]={y,0.,z},trk[3]={0.,0.,0.};
-        mT2L->MasterToLocal(loc,trk);
-        hit[0]=trk[1];
-        hit[1]=trk[2];
-	}
+
+	if (iModule <= fLastSPD1) hit[0] = -y+fYshift[iModule];
+        else hit[0] = y+fYshift[iModule];
+
+	hit[1] = -z+fZshift[iModule];
 	hit[2] = fYpitchSPD*fYpitchSPD/12.;
 	hit[3] = fZ1pitchSPD*fZ1pitchSPD/12.;
 	hit[4] = 1.;
-
 	if(!rawdata) milab[3]=fNdet[iModule];
 	Int_t info[3] = {ymax-ymin+1,zmax-zmin+1,fNlayer[iModule]};
 	if(!rawdata){
diff --git a/ITS/AliITSClusterFinderV2SSD.cxx b/ITS/AliITSClusterFinderV2SSD.cxx
index 5b7f3ccf14b..329f8f89873 100644
--- a/ITS/AliITSClusterFinderV2SSD.cxx
+++ b/ITS/AliITSClusterFinderV2SSD.cxx
@@ -28,7 +28,6 @@
 #include "AliITSRawStreamSSD.h"
 #include 
 #include "AliITSdigitSSD.h"
-#include "AliITSCalibrationSSD.h"
 
 ClassImp(AliITSClusterFinderV2SSD)
 
@@ -58,23 +57,13 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
   //------------------------------------------------------------
   // Actual SSD cluster finder
   //------------------------------------------------------------
-  AliITSCalibrationSSD* cal = (AliITSCalibrationSSD*)GetResp(fModule);
-  Float_t gain=0;
-
   Int_t smaxall=alldigits->GetEntriesFast();
   if (smaxall==0) return;
   TObjArray *digits = new TObjArray;
   for (Int_t i=0;iUncheckedAt(i);
-
-    if(d->IsSideP()) gain = cal->GetGainP(d->GetStripNumber());  
-    else gain = cal->GetGainN(d->GetStripNumber());
-
-    Float_t q=gain*d->GetSignal(); // calibration brings mip peaks around 120 (in ADC units)
-    q=cal->ADCToKeV(q); // converts the charge in KeV from ADC units
-    //Float_t q=d->GetSignal()/4.29;// temp. fix (for PID purposed - normalis. to be checked)
+    Float_t q=d->GetSignal()/4.29;// temp. fix (for PID purposed - normalis. to be checked)
     d->SetSignal(Int_t(q));
-
     if (d->GetSignal()<3) continue;
     digits->AddLast(d);
   }
@@ -218,7 +207,7 @@ void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClones
   
 }
 
-void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input, 
+void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStream* input, 
 					TClonesArray** clusters) 
 {
   //------------------------------------------------------------
@@ -235,15 +224,12 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
   Int_t prevStrip = -1;
   Int_t prevFlag = -1;
   Int_t prevModule = -1;
-  Float_t gain=0;
-  AliITSCalibrationSSD* cal=NULL;
-  
 
   // read raw data input stream
   while (kTRUE) {
     Bool_t next = input->Next();
 
-    if(input->GetSignal()<(3*4.) && next) continue;
+    if(input->GetSignal()<(3*4.29) && next) continue;
     // check if a new cluster starts
     Int_t strip = input->GetCoord2();
     Int_t flag = input->GetCoord1();
@@ -295,17 +281,11 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
       nClusters[0] = nClusters[1] = 0;
       y = q = 0.;
       nDigits = 0;
-
-      cal = (AliITSCalibrationSSD*)GetResp(input->GetModuleID());
-
     }
 
-    if(input->GetSideFlag()==0) gain = cal->GetGainP(input->GetStrip());  
-    else gain = cal->GetGainN(input->GetStrip());
-    
     // add digit to current cluster
-    q += cal->ADCToKeV( gain * input->GetSignal() );  // signal is corrected for gain and converted in KeV 
-    y += strip * cal->ADCToKeV( gain * input->GetSignal() );
+    q += input->GetSignal()/4.29;
+    y += strip * input->GetSignal()/4.29;
     nDigits++;
     prevStrip = strip;
     prevFlag = flag;
@@ -323,9 +303,6 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
   //------------------------------------------------------------
   // Actual SSD cluster finder
   //------------------------------------------------------------
-
-  const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule);
-
   TClonesArray &cl=*clusters;
   //
   Float_t tanp=fTanP, tann=fTanN;
@@ -417,12 +394,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       zt-=fHlSSD; yt-=fHwSSD;
       ybest=yt; zbest=zt; 
       qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
-      {
-      Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
-      mT2L->MasterToLocal(loc,trk);
-      lp[0]=trk[1];
-      lp[1]=trk[2];
-      }
+      lp[0]=-(-ybest+fYshift[fModule]);
+      lp[1]=  -zbest+fZshift[fModule];
       lp[2]=0.0025*0.0025;  //SigmaY2
       lp[3]=0.110*0.110;  //SigmaZ2
       
@@ -488,12 +461,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
 	  zt-=fHlSSD; yt-=fHwSSD;
 	  ybest =yt;  zbest=zt; 
 	  qbest =pos[ip].GetQ();
-          {
-          Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
-          mT2L->MasterToLocal(loc,trk);
-          lp[0]=trk[1];
-          lp[1]=trk[2];
-          }
+	  lp[0]=-(-ybest+fYshift[fModule]);
+	  lp[1]=  -zbest+fZshift[fModule];
 	  lp[2]=0.0025*0.0025;  //SigmaY2
 	  lp[3]=0.110*0.110;  //SigmaZ2
 	  
@@ -547,12 +516,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
 	  zt-=fHlSSD; yt-=fHwSSD;
 	  ybest =yt;  zbest=zt; 
 	  qbest =pos[ip2].GetQ();
-          {
-          Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
-          mT2L->MasterToLocal(loc,trk);
-          lp[0]=trk[1];
-          lp[1]=trk[2];
-          }
+	  lp[0]=-(-ybest+fYshift[fModule]);
+	  lp[1]=  -zbest+fZshift[fModule];
 	  lp[2]=0.0025*0.0025;  //SigmaY2
 	  lp[3]=0.110*0.110;  //SigmaZ2
 	  
@@ -623,12 +588,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
 	  zt-=fHlSSD; yt-=fHwSSD;
 	  ybest =yt;  zbest=zt; 
 	  qbest =neg[jn].GetQ();
-          {
-          Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
-          mT2L->MasterToLocal(loc,trk);
-          lp[0]=trk[1];
-          lp[1]=trk[2];
-          }
+	  lp[0]=-(-ybest+fYshift[fModule]);
+	  lp[1]=  -zbest+fZshift[fModule];
 	  lp[2]=0.0025*0.0025;  //SigmaY2
 	  lp[3]=0.110*0.110;  //SigmaZ2
 	  
@@ -681,12 +642,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
 	  zt-=fHlSSD; yt-=fHwSSD;
 	  ybest =yt;  zbest=zt; 
 	  qbest =neg[jn2].GetQ();
-          {
-          Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
-          mT2L->MasterToLocal(loc,trk);
-          lp[0]=trk[1];
-          lp[1]=trk[2];
-          }
+	  lp[0]=-(-ybest+fYshift[fModule]);
+	  lp[1]=  -zbest+fZshift[fModule];
 	  lp[2]=0.0025*0.0025;  //SigmaY2
 	  lp[3]=0.110*0.110;  //SigmaZ2
 	  
@@ -787,12 +744,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       zt-=fHlSSD; yt-=fHwSSD;
       ybest=yt; zbest=zt; 
       qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
-      {
-      Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
-      mT2L->MasterToLocal(loc,trk);
-      lp[0]=trk[1];
-      lp[1]=trk[2];
-      }
+      lp[0]=-(-ybest+fYshift[fModule]);
+      lp[1]=  -zbest+fZshift[fModule];
       lp[2]=0.0025*0.0025;  //SigmaY2
       lp[3]=0.110*0.110;  //SigmaZ2	
       lp[4]=qbest;        //Q
@@ -858,12 +811,8 @@ FindClustersSSD(Ali1Dcluster* neg, Int_t nn,
       if (TMath::Abs(zt)MasterToLocal(loc,trk);
-        lp[0]=trk[1];
-        lp[1]=trk[2];
-        }
+        lp[0]=-(-ybest+fYshift[fModule]);
+        lp[1]=  -zbest+fZshift[fModule];
         lp[2]=0.0025*0.0025;  //SigmaY2
         lp[3]=0.110*0.110;  //SigmaZ2
 
diff --git a/ITS/AliITSClusterFinderV2SSD.h b/ITS/AliITSClusterFinderV2SSD.h
index b3f823f3b9f..fcfc6676b63 100644
--- a/ITS/AliITSClusterFinderV2SSD.h
+++ b/ITS/AliITSClusterFinderV2SSD.h
@@ -10,13 +10,10 @@
 //   Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
 //--------------------------------------------------------------
 #include "AliITSClusterFinderV2.h"
-#include "AliITSDetTypeRec.h"
 
 class TClonesArray;
 class AliRawReader;
 class AliITSRawStream;
-class AliITSRawStreamSSD;
-class AliITSCalibrationSSD;
 
 class AliITSClusterFinderV2SSD : public AliITSClusterFinderV2 {
 public:
@@ -31,9 +28,7 @@ class AliITSClusterFinderV2SSD : public AliITSClusterFinderV2 {
 		       Ali1Dcluster* pos, Int_t np,
 		       TClonesArray *clusters=0x0);
 
-  void FindClustersSSD(AliITSRawStreamSSD* input,TClonesArray** clusters);
-  virtual AliITSCalibrationSSD* GetResp(Int_t mod)const{
-    return (AliITSCalibrationSSD*) fDetTypeRec->GetCalibrationModel(mod);}
+  void FindClustersSSD(AliITSRawStream* input,TClonesArray** clusters);
 
   Int_t fLastSSD1;        //index of the last SSD1 detector   
   Float_t fYpitchSSD;     //strip pitch (cm)
diff --git a/ITS/AliITSCompareHitsRecPoints.C b/ITS/AliITSCompareHitsRecPoints.C
deleted file mode 100644
index f5a10e42ce5..00000000000
--- a/ITS/AliITSCompareHitsRecPoints.C
+++ /dev/null
@@ -1,196 +0,0 @@
-Bool_t AliITSCompareHitsRecPoints(Char_t *rfn="galice.root"){
-    // This macro compares the average location of the hits associated
-    // with a specific track and the best match RecPoint location.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   kTRUE if no errors were encountered, otherwise kFALSE.
-    TProfile *pxg,*pyg,*pzg,*pxl,*pyl,*pzl;
-    Double_t hg[3],hl[3],tof,rg[3],rl[3];
-    Float_t rgf[3];
-
-    // Dynamically link some shared libs
-    if (gClassTable->GetID("AliRun") < 0) {
-        gROOT->LoadMacro("loadlibs.C");
-        loadlibs();
-    } else {
-        if(gAlice){
-            delete gAlice->GetRunLoader();
-            delete gAlice;
-            gAlice=0;
-        } // end if gAlice
-    }// end if gClassTable->GetID()
-
-    gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
-
-    AliRunLoader *runl = AccessFile(rfn); // Set up to read in Data
-    Int_t retval = runl->LoadHeader();
-    if (retval){
-        cerr<<"AliITSPrintRecPoints.C : LoadHeader returned error"<GetLoader("ITSLoader");
-    if(!ITSloader){
-        cerr<<"AliITSPrintRecPoints.C :  ITS loader not found"<Import("geometry.root","");
-    } // end if !gGeoManager
-    if(ITSloader->LoadHits("read")!=0){
-        cerr<<"Error Loading Hits"<LoadHits
-    if(ITSloader->LoadRecPoints("read")!=0){
-        cerr<<"Error Loading RecPoints"<LoadRecPoints
-    AliITS *ITS = 0;
-    ITS = (AliITS*)(gAlice->GetDetector("ITS"));
-    if(!ITS){
-        cout << "Error: no ITS found. Aborting"<GetDetTypeSim())){
-        cout <<"No AliITSDetTypeSim object found in ITS"<GetDetTypeSim();
-    AliITSgeom *gm=0;
-    gm = ITS->GetITSgeom();
-    if(!gm){
-        cout <<"No AliITSgeom object found in ITS"<UpdateInternalGeometry(gGeoManager);
-        } // end if
-    } // end if !AliITSgeom
-    //
-    Int_t nMods= gm->GetIndexMax(),nEvents=gAlice->GetEventsPerRun();
-    Int_t mod=0,evnt=0,size=-1,irp=0,ih=0,trkindexOld=-1;
-    Double_t xmod,nHitPerTrack;
-    TTree            *rpt = 0;
-    TClonesArray     *rpa = 0;
-    AliITSRecPoint   *rp  = 0;
-    AliITSDetTypeRec *rec = new AliITSDetTypeRec(ITSloader);
-    rec->SetDefaults();
-    // We are going to use the following
-    //  == { Sum_j hit_x[i][j] }/N_hits per track
-    // d_x[i] == -recpoint_x[i]
-    //   == {sum_i d_x[i]}/N_RecPoints   (excluding noise and no merging)
-    //         = {sum_i (-recpoint_x[i])}/N_RecPoints
-    //         = {sum_i ((sum_j hit_x[i][j])/N_hits_per_track -recpoinnt_x[i])}/N_Recpoints
-    //         = sum_i sum_j {hit_x[i][j]/N_hits_per_track}/N_Recpoints -
-    //           sum_i {recpoint_x[i]}/N_Recpoints
-    pxg = new TProfile("XdiffGlobal","Mean displacement in gX direction",nMods,
-                       -0.5,(Double_t)(nMods)+0.5," ");
-    pxg->SetXTitle("module");
-    pxg->SetYTitle("Global X [cm]");
-    pyg = new TProfile("YdiffGlobal","Mean displacement in gY direction",nMods,
-                       -0.5,(Double_t)(nMods)+0.5," ");
-    pyg->SetXTitle("module");
-    pyg->SetYTitle("Global Y [cm]");
-    pzg = new TProfile("ZdiffGlobal","Mean displacement in gZ direction",nMods,
-                       -0.5,(Double_t)(nMods)+0.5," ");
-    pzg->SetXTitle("module");
-    pzg->SetYTitle("Global Z [cm]");
-    pxl = new TProfile("XdiffLocal","Mean displacement in lX direction",nMods,
-                       -0.5,(Double_t)(nMods)+0.5," ");
-    pxl->SetXTitle("module");
-    pxl->SetYTitle("local X [cm]");
-    pyl = new TProfile("YdiffLocal","Mean displacement in lY direction",nMods,
-                       -0.5,(Double_t)(nMods)+0.5," ");
-    pyl->SetXTitle("module");
-    pyl->SetYTitle("local Y [cm]");
-    pzl = new TProfile("ZdiffLocal","Mean displacement in lZ direction",nMods,
-                       -0.5,(Double_t)(nMods)+0.5," ");
-    pzl->SetXTitle("module");
-    pzl->SetYTitle("local Z [cm]");
-    //
-    for(evnt=0;evntGetEvent(evnt);
-        ITS->InitModules(size,nMods);
-        ITS->FillModules(evnt,0,-1," "," ");
-        rec->SetTreeAddress();
-        for(mod=0;modGetModule(mod);
-            rec->ResetRecPoints();
-            rpt = ITSloader->TreeR();
-            rpt->GetEvent(mod);
-            rpa = rec->RecPoints();
-            for(irp=0;irpGetEntriesFast();irp++){
-                rp = (AliITSRecPoint*)(rpa->At(irp));
-                rp->GetGlobalXYZ(rgf);rg[0]=rgf[0];rg[1]=rgf[1];rg[2]=rgf[2];
-                rl[0] = rp->GetDetLocalX();
-                rl[1] = 0.0;
-                rl[2] = rp->GetDetLocalZ();
-                pxg->Fill(xmod,-rg[0],0.5);
-                pyg->Fill(xmod,-rg[1],0.5);
-                pzg->Fill(xmod,-rg[2],0.5);
-                pxl->Fill(xmod,-rl[0],0.5);
-                //pyl->Fill(xmod,-rl[1],0.5); // assumed to be zero always.
-                pzl->Fill(xmod,-rl[2],0.5);
-            }// rnf got itp
-            trkindexOld=-1;
-            nHitPerTrack = 0.0;
-            for(ih=0;ihGetNhits();ih++){ // We want the median hit location
-                // for each track.
-                h = m->GetHit(ih);
-                if(m->GetHitTrackIndex(ih)!=trkindexOld){// Enterence location
-                    trkindexOld = m->GetHitTrackIndex(ih);
-                    nHitPerTrack = 1.0;
-                    do{
-                        nHitPerTrack += 1.0;
-                    }while (m->GetHitTrackIndex(ih+nHitPerTrack-1)==trkindexOld);
-                    h->GetPositionG0(hg[0],hg[1],hg[2],tof);
-                    h->GetPositionL0(hl[0],hl[1],hl[2],tof);
-                    pxg->Fill(xmod,hg[0],0.5/nHitPerTrack);
-                    pyg->Fill(xmod,hg[1],0.5/nHitPerTrack);
-                    pzg->Fill(xmod,hg[2],0.5/nHitPerTrack);
-                    pxl->Fill(xmod,hl[0],0.5/nHitPerTrack);
-                    pyl->Fill(xmod,hl[1],1.0/nHitPerTrack); // rl[1]=0 always.
-                    pzl->Fill(xmod,hl[2],0.5/nHitPerTrack);
-                } // end if
-                if(nHitPerTrack==0.0) continue;
-                h->GetPositionG(hg[0],hg[1],hg[2],tof);
-                h->GetPositionL(hl[0],hl[1],hl[2],tof);
-                pxg->Fill(xmod,hg[0],0.5/nHitPerTrack);
-                pyg->Fill(xmod,hg[1],0.5/nHitPerTrack);
-                pzg->Fill(xmod,hg[2],0.5/nHitPerTrack);
-                pxl->Fill(xmod,hl[0],0.5/nHitPerTrack);
-                pyl->Fill(xmod,hl[1],1.0/nHitPerTrack); // rl[1]=0 always.
-                pzl->Fill(xmod,hl[2],0.5/nHitPerTrack);
-            } // end for ih
-        } // end for mod
-        ITS->ClearModules();
-    } // end for evnt
-    //
-    Int_t wh=800;
-    TCanvas *c0 = new TCanvas("c0","Average displacements between hits and RecPoints"
-                              ,1.5*wh,wh);
-    c0->Divide(3,2);
-    c0->cd(1);
-    pxg->Draw();
-    c0->cd(2);
-    pyg->Draw();
-    c0->cd(3);
-    pzg->Draw();
-    c0->cd(4);
-    pxl->Draw();
-    c0->cd(5);
-    pyl->Draw();
-    c0->cd(6);
-    pzl->Draw();
-    c0->Update();
-    return kTRUE;
-}
diff --git a/ITS/AliITSInitGeometry.cxx b/ITS/AliITSInitGeometry.cxx
index 1ccedf7d13c..4cb0249729b 100644
--- a/ITS/AliITSInitGeometry.cxx
+++ b/ITS/AliITSInitGeometry.cxx
@@ -52,7 +52,6 @@
 #include "AliITSsegmentationSSD.h"
 #include "AliITSgeom.h"
 #include "AliITSInitGeometry.h"
-#include 
 
 ClassImp(AliITSInitGeometry)
 
@@ -66,18 +65,16 @@ const Bool_t AliITSInitGeometry::fgkOldSDDshield = kTRUE;
 const Bool_t AliITSInitGeometry::fgkOldSSDshield = kTRUE;
 const Bool_t AliITSInitGeometry::fgkOldServices  = kTRUE;
 const Bool_t AliITSInitGeometry::fgkOldSupports  = kTRUE;
+/*
 //______________________________________________________________________
 AliITSInitGeometry::AliITSInitGeometry():
-TObject(),                   // Base Class
-fName(0),                    // Geometry name
-fMinorVersion(-1),           // Minor version number/type
-fMajorVersion(kvDefault),    // Major versin number
-fTiming(kFALSE),             // Flag to start inilization timing
-fSegGeom(kFALSE),            // Flag to switch between the old use of
-                             // AliITSgeomS?D class, or AliITSsegmentation
-                             // class in fShape of AliITSgeom class.
-fDecode(kFALSE),             // Flag for new/old decoding
-fDebug(0){                   // Debug flag
+TObject(),
+fName(),
+fMinorVersion(0),
+fMajorVersion(0),
+fTiming(kFALSE),
+fSegGeom(kFALSE),
+fDecode(kFALSE){
     // Default Creator
     // Inputs:
     //   none.
@@ -85,22 +82,17 @@ fDebug(0){                   // Debug flag
     //   none.
     // Return:
     //   A default inilized AliITSInitGeometry object
-
-    fName = "Undefined";
 }
+*/
 //______________________________________________________________________
-AliITSInitGeometry::AliITSInitGeometry(AliITSVersion_t version,
-                                       Int_t minorversion):
-TObject(),                   // Base Class
-fName(0),                    // Geometry name
-fMinorVersion(minorversion), // Minor version number/type
-fMajorVersion(version),      // Major versin number
-fTiming(kFALSE),             // Flag to start inilization timing
-fSegGeom(kFALSE),            // Flag to switch between the old use of
-                             // AliITSgeomS?D class, or AliITSsegmentation
-                             // class in fShape of AliITSgeom class.
-fDecode(kFALSE),             // Flag for new/old decoding
-fDebug(0){                   // Debug flag
+AliITSInitGeometry::AliITSInitGeometry(AliITSVersion_t version,Int_t minorversion):
+TObject(),
+fName(0),
+fMinorVersion(minorversion),
+fMajorVersion(version),
+fTiming(kFALSE),
+fSegGeom(kFALSE),
+fDecode(kFALSE){
     // Default Creator
     // Inputs:
     //   none.
@@ -108,16 +100,34 @@ fDebug(0){                   // Debug flag
     //   none.
     // Return:
     //   A default inilized AliITSInitGeometry object
+  if(version == kvPPRasymmFMD && (fMinorVersion==1|| fMinorVersion==2)){
+    fName="AliITSvPPRasymmFMD";
+  }
+  else if(version == kv11Hybrid){
+    fName="AliITSv11Hybrid";
+  }
+  else {
+    AliFatal(Form("Undefined geometry: fMajorVersion=%d, fMinorVersion= %d",(Int_t)fMajorVersion,fMinorVersion));
+  }
+  /*
+
+    if(fName.CompareTo("AliITSvPPRasymmFMD")==0)if(fMinorVersion==1||
+						   fMinorVersion==2) {
+	fMajorVersion=10;
+	return;
+    } // end if
 
-    if(version == kvPPRasymmFMD && (fMinorVersion==1|| fMinorVersion==2)){
-        fName="AliITSvPPRasymmFMD";
-    }else if(version == kv11Hybrid){
-        fName="AliITSv11Hybrid";
-    }else {
-        AliFatal(Form("Undefined geometry: fMajorVersion=%d, "
-                      "fMinorVersion= %d",(Int_t)fMajorVersion,fMinorVersion));
-        fName = "Undefined";
+    if (fName.CompareTo("AliITSv11")==0) {
+	fMajorVersion=11;
+	return;
     } // end if
+
+    // if not defined geometry error
+    Error("AliITSInitGeometry(name,version)"," Name must be AliITSvPPRasymmFMD"
+	" and version must be 1 or 2 for now.");
+    fMinorVersion = 0;
+    fName = "";
+  */
     return;
 }
 //______________________________________________________________________
@@ -134,84 +144,6 @@ AliITSgeom* AliITSInitGeometry::CreateAliITSgeom(){
     //   A pointer to a new properly inilized AliITSgeom class. If
     //   pointer = 0 then failed to init.
 
-
-  AliITSVersion_t version = kvDefault;
-  Int_t minor = 0;
-  TDatime datetime;
-  TGeoVolume *itsV = gGeoManager->GetVolume("ITSV");
-  if(!itsV){
-    Error("CreateAliITSgeom","Can't find ITS volume ITSV, aborting");
-    return 0;
-  }// end if
-  const Char_t *title = itsV->GetTitle();
-  if(!ReadVersionString(title,(Int_t)strlen(title),version,minor,
-			datetime))
-    Warning("UpdateInternalGeometry","Can't read title=%s\n",title);
-  SetTiming(kFALSE);
-  SetSegGeom(kFALSE);
-  SetDecoding(kFALSE);
-  AliITSgeom *geom = CreateAliITSgeom(version,minor);
-  AliDebug(1,"AliITSgeom object has been initialized from TGeo\n");
-  return geom;
-}
-//______________________________________________________________________
-AliITSgeom* AliITSInitGeometry::CreateAliITSgeom(Int_t major,Int_t minor){
-    // Creates and Initilizes the geometry transformation class AliITSgeom
-    // to values appropreate to this specific geometry. Now that
-    // the segmentation is part of AliITSgeom, the detector
-    // segmentations are also defined here.
-    // Inputs:
-    //   Int_t major   major version, see AliITSVersion_t
-    //   Int_t minor   minor version
-    // Outputs:
-    //   none.
-    // Return:
-    //   A pointer to a new properly inilized AliITSgeom class. If
-    //   pointer = 0 then failed to init.
-
-    switch(major){
-    case kvtest:
-        SetGeometryName("AliITSvtest");
-        SetVersion(kvtest,minor);
-        break;
-    case kvSPD02:
-        SetGeometryName("AliITSvSPD02");
-        SetVersion(kvSPD02,minor);
-        break;
-    case kvSDD03:
-        SetGeometryName("AliITSvSDD03");
-        SetVersion(kvSDD03,minor);
-        break;
-    case kvSSD03:
-        SetGeometryName("AliITSvSSD03");
-        SetVersion(kvSSD03,minor);
-        break;
-    case kvITS04:
-        SetGeometryName("AliITSvBeamTest03");
-        SetVersion(kvITS04,minor);
-        break;
-    case kvPPRcourseasymm:
-        SetGeometryName("AliITSvPPRcourseasymm");
-        SetVersion(kvPPRcourseasymm,minor);
-        break;
-    case kvPPRasymmFMD:
-        SetGeometryName("AliITSvPPRasymmFMD");
-        SetVersion(kvPPRasymmFMD,minor);
-        break;
-    case kv11:
-        SetGeometryName("AliITSv11");
-        SetVersion(kv11,minor);
-        break;
-    case kv11Hybrid:
-        SetGeometryName("AliITSv11Hybrid");
-        SetVersion(kv11Hybrid,minor);
-        break;
-    case kvDefault:
-    default:
-        SetGeometryName("Undefined");
-        SetVersion(kvDefault,minor);
-        break;
-    } // end switch
     AliITSgeom *geom = new AliITSgeom();
     if(!InitAliITSgeom(geom)){ // Error initilization failed
 	delete geom;
@@ -232,459 +164,30 @@ Bool_t AliITSInitGeometry::InitAliITSgeom(AliITSgeom *geom){
   // Return:
   //   none.
 
-    if(!gGeoManager){
-        AliFatal("The geometry manager has not been initialized (e.g. "
-                 "TGeoManager::Import(\"geometry.root\")should be "
-                 "called in advance) - exit forced");
-        return kFALSE;
-    } // end if
-    switch(fMajorVersion) {
-    case kvtest: {
-        if(GetMinorVersion()==1) return InitAliITSgeomPPRasymmFMD(geom);
-        else if(GetMinorVersion()==2) return InitAliITSgeomtest2(geom);
-    } break; // end case
-    case kvSPD02: { 
-        return InitAliITSgeomSPD02(geom);
-    } break; // end case
-    case kvSDD03: { 
-        return InitAliITSgeomSDD03(geom);
-    } break; // end case
-    case kvSSD03: { 
-        return InitAliITSgeomSSD03(geom);
-    } break; // end case
-    case kvITS04: { 
-        return InitAliITSgeomITS04(geom);
-    } break; // end case
-    case kvPPRasymmFMD: { 
-        return InitAliITSgeomPPRasymmFMD(geom);
-    } break; // end case
-    case kvPPRcourseasymm: { 
-        return kTRUE; // No sensitive detectors in course geometry
-    } break; // end case
-    case kv11Hybrid: { 
-        return InitAliITSgeomV11Hybrid(geom);
-    } break; // end case
-    case kv11: {
-        return InitAliITSgeomV11(geom);
-    } break; // end case
-    case kvDefault: default: {
-        AliFatal("Undefined geometry");
-        return kFALSE;
-    } break; // end case
-    } // end switch
+  if(!gGeoManager){
+    AliFatal("The geometry manager has not been initialized (e.g. TGeoManager::Import(\"geometry.root\")should be called in advance) - exit forced");
     return kFALSE;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::TransposeTGeoHMatrix(TGeoHMatrix *m)const{
-    // Transpose the rotation matrix part of a TGeoHMatrix. This
-    // is needed because TGeo stores the transpose of the rotation
-    // matrix as compared to what AliITSgeomMatrix uses (and Geant3).
-    // Inputs:
-    //    TGeoHMatrix *m  The matrix to be transposed
-    // Outputs:
-    //    TGEoHMatrix *m  The transposed matrix
-    // Return:
-    //    none.
-    Int_t i;
-    Double_t r[9];
-
-    if(m==0) return; // no matrix to transpose.
-    for(i=0;i<9;i += 4) r[i] = m->GetRotationMatrix()[i]; // diagonals
-    r[1] = m->GetRotationMatrix()[3];
-    r[2] = m->GetRotationMatrix()[6];
-    r[3] = m->GetRotationMatrix()[1];
-    r[5] = m->GetRotationMatrix()[7];
-    r[6] = m->GetRotationMatrix()[2];
-    r[7] = m->GetRotationMatrix()[5];
-    m->SetRotation(r);
-    return;
-}
-//______________________________________________________________________
-Bool_t AliITSInitGeometry::InitAliITSgeomtest2(AliITSgeom *geom){
-    // Initilizes the geometry transformation class AliITSgeom
-    // to values appropreate to this specific geometry. Now that
-    // the segmentation is part of AliITSgeom, the detector
-    // segmentations are also defined here.
-    // Inputs:
-    //   AliITSgeom *geom  A pointer to the AliITSgeom class
-    // Outputs:
-    //   AliITSgeom *geom  This pointer recreated and properly inilized.
-    // Return:
-    //   none.
-    //  const Double_t kcm2micron = 1.0E4;
-    const Int_t kItype=0; // Type of transormation defined 0=> Geant
-    const Int_t klayers = 6; // number of layers in the ITS
-    const Int_t kladders[klayers]   = {1,1,1,1,1,1}; // Number of ladders
-    const Int_t kdetectors[klayers] = {1,1,1,1,1,1};// number of detector/lad
-    const AliITSDetector kIdet[6]   = {kSPD,kSPD,kSDD,kSDD,kSSD,kSSD};
-    const TString kNames[klayers] = {
-	 "/ALIC_1/ITSV_1/ITSspd1_1/ITS1_1", // lay=1
-	 "/ALIC_1/ITSV_1/ITSspd2_1/ITS2_1", // lay=2
-	 "/ALIC_1/ITSV_1/ITSsdd1_1/ITS3_1", // lay=3
-	 "/ALIC_1/ITSV_1/ITSsdd2_1/ITS4_1", // lay=4
-	 "/ALIC_1/ITSV_1/ITSssd1_1/ITS5_1", // lay=5
-	 "/ALIC_1/ITSV_1/ITSssd2_1/ITS6_1"};// Lay=6
-    Int_t mod,nmods=0,lay,lad,det,cpn0,cpn1,cpn2;
-    Double_t tran[3]={0.0,0.0,0.0},rot[10]={9*0.0,1.0};
-    TArrayD shapePar;
-    TString shapeName;
-    TGeoHMatrix matrix;
-    Bool_t initSeg[3]={kFALSE,kFALSE,kFALSE};
-    TStopwatch *time = 0x0;if(fTiming) time=new TStopwatch();
-
-    if(fTiming) time->Start();
-    for(mod=0;modInit(kItype,klayers,kladders,kdetectors,nmods);
-    for(mod=0;modCreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot);
-        RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det.
-        geom->GetGeomMatrix(mod)->SetPath(kNames[lay-1]);
-        GetTransformation(kNames[lay-1].Data(),matrix);
-        geom->SetTrans(mod,matrix.GetTranslation());
-        TransposeTGeoHMatrix(&matrix); // Transpose TGeo's rotation matrixes
-        geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
-        if(initSeg[kIdet[lay-1]]) continue;
-        GetShape(kNames[lay-1],shapeName,shapePar);
-        if(shapeName.CompareTo("BOX")){
-            Error("InitITSgeom2","Geometry changed without proper code update"
-                  "or error in reading geometry. Shape is not BOX shape is %s",
-                  shapeName.Data());
-            return kFALSE;
-        } // end if
-	InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom);
-    } // end for module
-    if(fTiming){
-        time->Stop();
-        time->Print();
-        delete time;
-    } // end if
-    return kTRUE;
-}
-//______________________________________________________________________
-Bool_t AliITSInitGeometry::InitAliITSgeomSPD02(AliITSgeom *geom){
-    // Initilizes the geometry transformation class AliITSgeom
-    // to values appropreate to this specific geometry. Now that
-    // the segmentation is part of AliITSgeom, the detector
-    // segmentations are also defined here.
-    // Inputs:
-    //   AliITSgeom *geom  A pointer to the AliITSgeom class
-    // Outputs:
-    //   AliITSgeom *geom  This pointer recreated and properly inilized.
-    // Return:
-    //   none.
-    const Int_t kltypess=2;
-    const Int_t knlayers=5;
-    const TString knames[kltypess]=
-        {"ALIC_1/ITSV_1/ITEL_%d/IMB0_1/IMBS_1",//lay=1,2,4,5
-         "ALIC_1/ITSV_1/IDET_%d/ITS0_1/ITST_1"};// lay=3
-    const Int_t kitsGeomTreeCopys[2]={4,1};
-    const Int_t knlad[knlayers]={knlayers*1},kndet[knlayers]={knlayers*1};
-    TString path,shapeName;
-    TGeoHMatrix matrix;
-    TArrayD shapePar;
-    TArrayF shapeParF;
-    Double_t trans[3]={3*0.0},rot[10]={10*0.0};
-    Int_t npar=3,mod,i,j,lay,lad,det,cpy;
-    Float_t par[20];
-    TStopwatch *time = 0x0;if(fTiming) time=new TStopwatch();
-
-    par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48;
-    mod=5;;
-    geom->Init(0,knlayers,knlad,kndet,mod);
-
-    if(fTiming) time->Start();
-    for(i=0;i2) lay=cpy+1;
-        if(i==1) lay=3;
-        DecodeDetector(mod,kitsGeomTreeCopys[i],1,cpy,0);
-        DecodeDetectorLayers(mod,lay,lad,det);
-        geom->CreateMatrix(mod,lay,lad,det,kSPD,trans,rot);
-        geom->SetTrans(mod,matrix.GetTranslation());
-        geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
-        geom->GetGeomMatrix(mod)->SetPath(path.Data());
-        if(!(geom->IsShapeDefined((Int_t)kSPD)))
-            geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
-    } // end for i,cpy/
-    if(fTiming){
-        time->Stop();
-        time->Print();
-        delete time;
-    } // end if
-    return kTRUE;
-}
-//______________________________________________________________________
-Bool_t AliITSInitGeometry::InitAliITSgeomSDD03(AliITSgeom *geom){
-    // Initilizes the geometry transformation class AliITSgeom
-    // to values appropreate to this specific geometry. Now that
-    // the segmentation is part of AliITSgeom, the detector
-    // segmentations are also defined here.
-    // Inputs:
-    //   AliITSgeom *geom  A pointer to the AliITSgeom class
-    // Outputs:
-    //   AliITSgeom *geom  This pointer recreated and properly inilized.
-    // Return:
-    //   none
-    const Int_t knlayers=12;
-    //   const Int_t kndeep=6;
-    const Int_t kltypess=2;
-    const AliITSDetector kidet[knlayers]={kSSD,kSDD};
-    const TString knames[kltypess]={
-        "/ALIC_1/ITSV_1/ITEL_%d/ITAI_1/IMB0_1/IMBS_1",
-        "/ALIC_1/ITSV_1/IDET_%d/IDAI_1/ITS0_1/ITST_1"};
-    const Int_t kitsGeomTreeCopys[kltypess]={10,2};
-    const Int_t knp=384;
-    const Float_t kpitch=50.E-4;/*cm*/
-    Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1];
-    Int_t nlad[knlayers]={knlayers*1};
-    Int_t ndet[knlayers]={knlayers*1};
-    Int_t mod=knlayers,lay=0,lad=0,det=0,i,j,cp0;
-    TString path,shapeName;
-    TGeoHMatrix matrix;
-    Double_t trans[3]={3*0.0},rot[10]={10*0.0};
-    TArrayD shapePar;
-    TArrayF shapeParF;
-    Bool_t isShapeDefined[kltypess]={kltypess*kFALSE};
-
-    geom->Init(0,knlayers,nlad,ndet,mod);
-    p[0]=-box[0];
-    n[0]=box[0];
-    // Fill in anode and cathode strip locations (lower edge)
-    for(i=1;iCreateMatrix(mod,lay,lad,det,kidet[i],trans,rot);
-        geom->SetTrans(mod,matrix.GetTranslation());
-        geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
-        geom->GetGeomMatrix(mod)->SetPath(path.Data());
-        switch (kidet[i]){
-        case kSDD: if(!(geom->IsShapeDefined((Int_t)kSDD))){
-            geom->ReSetShape(kSDD,new AliITSgeomSDD256(shapeParF.GetSize(),
-                                                       shapeParF.GetArray()));
-            isShapeDefined[i]=kTRUE;
-        } break;
-        case kSSD:if(!(geom->IsShapeDefined((Int_t)kSSD))){
-            geom->ReSetShape(kSSD,new AliITSgeomSSD(box,0.0,0.0,
-                                                    knp+1,p,knp+1,n));
-            isShapeDefined[i]=kTRUE;
-        } break;
-        default:{} break;
-        } // end switch
-    } // end for i,cp0
-
-    return kTRUE;
-}
-//______________________________________________________________________
-Bool_t AliITSInitGeometry::InitAliITSgeomSSD03(AliITSgeom *geom){
-    // Initilizes the geometry transformation class AliITSgeom
-    // to values appropreate to this specific geometry. Now that
-    // the segmentation is part of AliITSgeom, the detector
-    // segmentations are also defined here.
-    // Inputs:
-    //   AliITSgeom *geom  A pointer to the AliITSgeom class
-    // Outputs:
-    //   AliITSgeom *geom  This pointer recreated and properly inilized.
-    // Return:
-    //   none.
-    const Int_t knlayers=5;
-    //   const Int_t kndeep=6;
-    const Int_t kltypess=3;
-    const AliITSDetector kIdet[knlayers]={kND,kSSD,kND};
-    const TString knames[kltypess]={
-        "/ALIC_1/ITSV_1/ITSA_%d/ITSS_1",
-        "/ALIC_1/ITSV_1/IGAR_%d/IAIR_1/ITST_1",
-        "/ALIC_1/ITSV_1/IFRA_%d/IFRS_1"};
-    const Int_t kitsGeomTreeCopys[kltypess]={3,1,1};
-    const Int_t kitsGeomDetTypes[kltypess]={1,2,3};
-    const Int_t knp=384;
-    const Float_t kpitch=50.E-4;//cm
-    Bool_t initSeg[3]={kFALSE, kFALSE, kFALSE};
-    Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1];
-    Int_t nlad[knlayers]={knlayers*1};
-    Int_t ndet[knlayers]={knlayers*1};
-    Int_t mod=knlayers,lay=0,lad=0,det=0,i,j,cp0;
-    TString path,shapeName;
-    TGeoHMatrix matrix;
-    Double_t trans[3]={3*0.0},rot[10]={10*0.0};
-    TArrayD shapePar;
-    TArrayF shapeParF;
-    Bool_t isShapeDefined[kltypess]={kltypess*kFALSE};
-
-    geom->Init(0,knlayers,nlad,ndet,mod);
-    p[0]=-box[0];
-    n[0]=box[0];
-    // Fill in anode and cathode strip locations (lower edge)
-    for(i=1;iCreateMatrix(mod,lay,lad,det,kIdet[i],trans,rot);
-        geom->SetTrans(mod,matrix.GetTranslation());
-        geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
-        geom->GetGeomMatrix(mod)->SetPath(path.Data());
-        switch (kIdet[i]){
-        case kSSD:if(!(geom->IsShapeDefined((Int_t)kSSD))){
-            InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom);
-            isShapeDefined[i]=kTRUE;
-        } break;
-        default:{} break;
-        } // end switch
-    } // end for i,cp0
-
-    return kTRUE;
-}
-//______________________________________________________________________
-Bool_t AliITSInitGeometry::InitAliITSgeomITS04(AliITSgeom *geom){
-    // Initilizes the geometry transformation class AliITSgeom
-    // to values appropreate to this specific geometry. Now that
-    // the segmentation is part of AliITSgeom, the detector
-    // segmentations are also defined here.
-    // Inputs:
-    //   AliITSgeom *geom  A pointer to the AliITSgeom class
-    // Outputs:
-    //   AliITSgeom *geom  This pointer recreated and properly inilized.
-    // Return:
-    //   none.
-
-  // We can not use AliITSvBeamTestITS04::fgk... data members because
-  // AliITSInitGeometry is part of the base library while AliITSvBeamTestITS04
-  // is part of the simulation library. This would introduce a dependance
-  // between the 2 libraries
-
+  }
+  switch(fMajorVersion) {
 
-    const Int_t knlayers = 6;
-    Int_t nlad[knlayers], ndet[knlayers];
-    
-    nlad[0] = 1; ndet[0] = 2;
-    nlad[1] = 1; ndet[1] = 2;
-    nlad[2] = 1; ndet[2] = 1;
-    nlad[3] = 1; ndet[3] = 1;
-    nlad[4] = 1; ndet[4] = 2;
-    nlad[5] = 1; ndet[5] = 2;
+  case kvPPRasymmFMD: { 
+    return InitAliITSgeomPPRasymmFMD(geom);
+  } break; // end case
 
-    Int_t nModTot = 10;
-    geom->Init(0,knlayers,nlad,ndet,nModTot);
+  case kv11Hybrid: { 
+    return InitAliITSgeomV11Hybrid(geom);
+  } break; // end case
 
-    /*
-    //=== Set default shapes 
-    const Float_t kDxyzSPD[] = {AliITSvBeamTestITS04::fgkSPDwidthSens/2,
-                                AliITSvBeamTestITS04::fgkSPDthickSens/2,
-                                AliITSvBeamTestITS04::fgkSPDlengthSens/2};  
-    if(!(geom->IsShapeDefined(kSPD)))
-       geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(3,(Float_t *)kDxyzSPD));
-    
-    const Float_t kDxyzSDD[] = {AliITSvBeamTestITS04::fgkSDDwidthSens/2.,
-                                AliITSvBeamTestITS04::fgkSDDthickSens/2.,
-                                AliITSvBeamTestITS04::fgkSDDlengthSens/2.};
-    if(!(geom->IsShapeDefined(kSDD)))
-	geom->ReSetShape(kSDD, new AliITSgeomSDD256(3,(Float_t *)kDxyzSDD));
-    
-    const Float_t kDxyzSSD[] = {AliITSvBeamTestITS04::fgkSSDlengthSens/2,
-                                AliITSvBeamTestITS04::fgkSSDthickSens/2,
-                                AliITSvBeamTestITS04::fgkSSDwidthSens/2};
-    if(!(geom->IsShapeDefined(kSSD)))
-       geom->ReSetShape(kSSD,new AliITSgeomSSD75and275(3,(Float_t *)kDxyzSSD));
-    
-    // Creating the matrices in AliITSgeom for each sensitive volume
-    // (like in AliITSv11GeometrySDD) mln
-    // Here, each layer is one detector
-    
-    char layerName[30];
-    Int_t startMod = 0,mod;
-    TGeoVolume *itsmotherVolume = gGeoManager->GetVolume("ITSV");
-    // SPD
-    for (Int_t i=0; i<4;i++) {
-	sprintf(layerName, "ITSspdWafer_%i",i+1);
-	TGeoNode *layNode = itsmotherVolume->GetNode(layerName);
-	if (layNode) {
-	    TGeoHMatrix layMatrix(*layNode->GetMatrix());	    
-	    Double_t *trans  = layMatrix.GetTranslation();
-	    Double_t *r      = layMatrix.GetRotationMatrix();
-	    Double_t rot[10] = {r[0],r[1],r[2],
-				r[3],r[4],r[5],
-				r[6],r[7],r[8], 1.0};
-	    Int_t iDet = 1;
-	    Int_t iLad = 1;
-	    Int_t iLay = 1;
-            DecodeDetector(mod,layNode->GetNumber(),i+1,0,0);
-            DecodeDetectorLayers(mod,iLay,iLad,iDet);
-	    geom->CreateMatrix(startMod,iLay,iLad,iDet,kSPD,trans,rot);
-	    startMod++;
-	};
-    };
-    
-    // SDD
-    for (Int_t i=0; i<2;i++) {
-	sprintf(layerName, "ITSsddWafer_%i",i+4+1);
-	TGeoNode *layNode = itsmotherVolume->GetNode(layerName);
-	if (layNode) {
-	    TGeoHMatrix layMatrix(*layNode->GetMatrix());
-	    Double_t *trans  = layMatrix.GetTranslation();
-	    Double_t *r      = layMatrix.GetRotationMatrix();
-	    Double_t rot[10] = {r[0],r[1],r[2],
-				r[3],r[4],r[5],
-				r[6],r[7],r[8], 1.0};
-	    Int_t iDet = 1;
-	    Int_t iLad = 1;
-	    Int_t iLay = 1;
-            DecodeDetector(mod,layNode->GetNumber(),i+1,0,0);
-            DecodeDetectorLayers(mod,iLay,iLad,iDet);
-	    geom->CreateMatrix(startMod,iLay,iLad,iDet,kSDD,trans,rot);
-	    startMod++;
-	};
-    };
-    
-    // SSD
-    for (Int_t i=0; i<4;i++) {
-	sprintf(layerName, "ITSssdWafer_%i",i+4+2+1);
-	TGeoNode *layNode = itsmotherVolume->GetNode(layerName);
-	if (layNode) {
-	    TGeoHMatrix layMatrix(*layNode->GetMatrix());	    
-	    Double_t *trans  = layMatrix.GetTranslation();
-	    Double_t *r      = layMatrix.GetRotationMatrix();
-	    Double_t rot[10] = {r[0],r[1],r[2],
-				r[3],r[4],r[5],
-				r[6],r[7],r[8], 1.0};
-	    Int_t iDet = 1;
-	    Int_t iLad = 1;
-	    Int_t iLay = 5;
-            DecodeDetector(mod,layNode->GetNumber(),i+1,0,0);
-            DecodeDetectorLayers(mod,iLay,iLad,iDet);
-	    geom->CreateMatrix(startMod,iLay,iLad,iDet,kSSD,trans,rot);
-	    startMod++;
-	};
-    };
+  case kv11: {
+    return InitAliITSgeomV11(geom);
+  } break; // end case
 
-    return kTRUE;
-  */
+  default: {
+    AliFatal("Undefined geometry");
     return kFALSE;
+  } break; // end case
+  } // end switch
+  return kFALSE;
 }
 //______________________________________________________________________
 Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){
@@ -730,7 +233,7 @@ Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){
     Double_t tran[3]={0.0,0.0,0.0},rot[10]={9*0.0,1.0};
     TArrayD shapePar;
     TString path,shapeName;
-    TGeoHMatrix matrix;
+    TGeoHMatrix materix;
     Bool_t initSeg[3]={kFALSE,kFALSE,kFALSE};
     TStopwatch *time = 0x0;if(fTiming) time=new TStopwatch();
 
@@ -744,18 +247,15 @@ Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){
         path.Form(kNames[fMinorVersion-1][lay-1].Data(),
                   kPathbase.Data(),cpn0,cpn1,cpn2);
         geom->GetGeomMatrix(mod)->SetPath(path);
-        GetTransformation(path.Data(),matrix);
-        geom->SetTrans(mod,matrix.GetTranslation());
-	TransposeTGeoHMatrix(&matrix); //Transpose TGeo's rotation matrixes
-        geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
+        GetTransformation(path.Data(),materix);
+        geom->SetTrans(mod,materix.GetTranslation());
+        geom->SetRotMatrix(mod,materix.GetRotationMatrix());
         if(initSeg[kIdet[lay-1]]) continue;
         GetShape(path,shapeName,shapePar);
         if(shapeName.CompareTo("BOX")){
-	  Error("InitITSgeomPPRasymmFMD",
-		"Geometry changed without proper code update or error "
-		"in reading geometry. Shape is not BOX. Shape is %s",
-		shapeName.Data());
-	  return kFALSE;
+            Error("InitITSgeom","Geometry changed without proper code update"
+                  "or error in reading geometry. Shape is not BOX.");
+            return kFALSE;
         } // end if
 	InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom);
     } // end for module
@@ -766,6 +266,7 @@ Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){
     } // end if
     return kTRUE;
 }
+
 //______________________________________________________________________
 Bool_t AliITSInitGeometry::InitAliITSgeomV11Hybrid(AliITSgeom *geom){
     // Initilizes the geometry transformation class AliITSgeom
@@ -818,15 +319,10 @@ Bool_t AliITSInitGeometry::InitAliITSgeomV11Hybrid(AliITSgeom *geom){
 
   for(mod=0;modCreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot);
-//     RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det.
     DecodeDetectorLayers(mod,lay,lad,det); // Write
     geom->CreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot);
     RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det.
 
-
-
     if (SDDIsTGeoNative())
       if (kIdet[lay-1]==kSDD) {
 	cpn0 = lad-1;
@@ -839,7 +335,6 @@ Bool_t AliITSInitGeometry::InitAliITSgeomV11Hybrid(AliITSgeom *geom){
     geom->GetGeomMatrix(mod)->SetPath(path);
     GetTransformation(path.Data(),matrix);
     geom->SetTrans(mod,matrix.GetTranslation());
-    TransposeTGeoHMatrix(&matrix); //Transpose TGeo's rotation matrixes
     geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
     if(initSeg[kIdet[lay-1]]) continue;
     GetShape(path,shapeName,shapePar);
@@ -858,6 +353,7 @@ Bool_t AliITSInitGeometry::InitAliITSgeomV11Hybrid(AliITSgeom *geom){
   } // end if
   return kTRUE;
 }
+
 //______________________________________________________________________
 Bool_t AliITSInitGeometry::InitAliITSgeomV11(AliITSgeom *geom){
   // Initilizes the geometry transformation class AliITSgeom
@@ -908,7 +404,6 @@ Bool_t AliITSInitGeometry::InitAliITSgeomV11(AliITSgeom *geom){
     geom->GetGeomMatrix(mod)->SetPath(path);
     if (GetTransformation(path.Data(),matrix)) {
       geom->SetTrans(mod,matrix.GetTranslation());
-      TransposeTGeoHMatrix(&matrix); //Transpose TGeo's rotation matrixes
       geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
     }
     
@@ -1135,7 +630,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(box->GetDY(),1);
 	par.AddAt(box->GetDZ(),2);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoTrd1::Class()) {
 	shapeType = "TRD1";
 	npar = 4;
@@ -1146,7 +641,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(trd1->GetDy(), 2);
 	par.AddAt(trd1->GetDz(), 3);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoTrd2::Class()) {
 	shapeType = "TRD2";
 	npar = 5;
@@ -1158,7 +653,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(trd2->GetDy2(),3);
 	par.AddAt(trd2->GetDz(), 4);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoTrap::Class()) {
 	shapeType = "TRAP";
 	npar = 11;
@@ -1177,7 +672,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(trap->GetTl2(),9);
 	par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoTube::Class()) {
 	shapeType = "TUBE";
 	npar = 3;
@@ -1187,7 +682,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(tube->GetRmax(),1);
 	par.AddAt(tube->GetDz(),2);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoTubeSeg::Class()) {
 	shapeType = "TUBS";
 	npar = 5;
@@ -1199,7 +694,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(tubs->GetPhi1(),3);
 	par.AddAt(tubs->GetPhi2(),4);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoCone::Class()) {
 	shapeType = "CONE";
 	npar = 5;
@@ -1211,7 +706,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(cone->GetRmin2(),3);
 	par.AddAt(cone->GetRmax2(),4);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoConeSeg::Class()) {
 	shapeType = "CONS";
 	npar = 7;
@@ -1225,7 +720,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(cons->GetPhi1(),5);
 	par.AddAt(cons->GetPhi2(),6);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoSphere::Class()) {
 	shapeType = "SPHE";
 	npar = 6;
@@ -1239,7 +734,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(sphe->GetPhi1(),4);
 	par.AddAt(sphe->GetPhi2(),5);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoPara::Class()) {
 	shapeType = "PARA";
 	npar = 6;
@@ -1252,7 +747,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(para->GetTxz(),4);
 	par.AddAt(para->GetTyz(),5);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoPgon::Class()) {
 	shapeType = "PGON";
 	TGeoPgon *pgon = (TGeoPgon*)shape;
@@ -1272,7 +767,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	    par.AddAt(rmax[i], 4+3*i+2);
 	}
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoPcon::Class()) {
 	shapeType = "PCON";
 	TGeoPcon *pcon = (TGeoPcon*)shape;
@@ -1292,7 +787,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	    par.AddAt(rmax[i], 3+3*i+2);
 	}
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoEltu::Class()) {
 	shapeType = "ELTU";
 	npar = 3;
@@ -1302,7 +797,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(eltu->GetB(),1);
 	par.AddAt(eltu->GetDz(),2);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoHype::Class()) {
 	shapeType = "HYPE";
 	npar = 5;
@@ -1314,7 +809,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(hype->GetStIn(),3);
 	par.AddAt(hype->GetStOut(),4);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoGtra::Class()) {
 	shapeType = "GTRA";
 	npar = 12;
@@ -1334,7 +829,7 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10);
 	par.AddAt(trap->GetTwistAngle(),11);
 	return kTRUE;
-    } // end if
+    }
     if (classType==TGeoCtub::Class()) {
 	shapeType = "CTUB";
 	npar = 11;
@@ -1354,15 +849,14 @@ Bool_t AliITSInitGeometry::GetShape(const TString &volumePath,
 	par.AddAt(tx[1],9);
 	par.AddAt(tx[2],10);
 	return kTRUE;
-    } // end if
+    }
     Error("GetShape","Getting shape parameters for shape %s not implemented",
 	  shape->ClassName());
-    shapeType = "Unknown";
     return kFALSE;
 }
 //______________________________________________________________________
-void AliITSInitGeometry::DecodeDetector(
-    Int_t &mod,Int_t layer,Int_t cpn0,Int_t cpn1,Int_t cpn2) const {
+void AliITSInitGeometry::DecodeDetector(Int_t &mod,Int_t layer,Int_t cpn0,
+                                        Int_t cpn1,Int_t cpn2) const {
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
     // requirements, and New which dose.
@@ -1376,519 +870,10 @@ void AliITSInitGeometry::DecodeDetector(
     //                   of copy numbers.
     // Return:
     //    none.
-
-    // This is a FIXED switch yard function. I (Bjorn Nilsen) Don't 
-    // like them but I see not better way for the moment.
-    switch (fMajorVersion){
-    case kvtest:{
-        if(GetMinorVersion()==1)
-            return DecodeDetectorvPPRasymmFMD(mod,layer,cpn0,cpn1,cpn2);
-        else if(GetMinorVersion()==2)
-            return DecodeDetectorvtest2(mod,layer,cpn0,cpn1,cpn2);
-        Warning("DecodeDetector",
-                "Geometry is kvtest minor version=%d is not defined",
-                GetMinorVersion());
-    }break;
-    case kvDefault:{
-        Error("DecodeDetector","Major version = kvDefault, not supported");
-    }break;
-    case kvSPD02:{
-        return DecodeDetectorvSPD02(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    case kvSDD03:{
-        return DecodeDetectorvSDD03(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    case kvSSD03:{
-        return DecodeDetectorvSSD03(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    case kvITS04:{
-        return DecodeDetectorvITS04(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    case kvPPRcourseasymm:{
-        return DecodeDetectorvPPRcourseasymm(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    case kvPPRasymmFMD:{
-        return DecodeDetectorvPPRasymmFMD(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    case kv11:{
-        return DecodeDetectorv11(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    case kv11Hybrid:{
-        return DecodeDetectorv11Hybrid(mod,layer,cpn0,cpn1,cpn2);
-    }break;
-    default:{
-        Error("DecodeDetector","Major version = %d, not supported",
-              (Int_t)fMajorVersion);
-        return;
-    }break;
-    } // end switch
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::RecodeDetector(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Return:
-    //    none.
-
-    // This is a FIXED switch yard function. I (Bjorn Nilsen) Don't 
-    // like them but I see not better way for the moment.
-    switch (fMajorVersion){
-    case kvtest:{
-        if(GetMinorVersion()==1) 
-            return RecodeDetectorvPPRasymmFMD(mod,cpn0,cpn1,cpn2);
-        else if(GetMinorVersion()==2)
-            return RecodeDetectorvtest2(mod,cpn0,cpn1,cpn2);
-        Warning("RecodeDetector",
-                "Geometry is kvtest minor version=%d is not defined",
-                GetMinorVersion());
-        return;
-    }break;
-    case kvDefault:{
-        Error("RecodeDetector","Major version = kvDefault, not supported");
-        return;
-    }break;
-    case kvSPD02:{
-        return RecodeDetectorvSPD02(mod,cpn0,cpn1,cpn2);
-    }break;
-    case kvSDD03:{
-        return RecodeDetectorvSDD03(mod,cpn0,cpn1,cpn2);
-    }break;
-    case kvSSD03:{
-        return RecodeDetectorvSSD03(mod,cpn0,cpn1,cpn2);
-    }break;
-    case kvITS04:{
-        return RecodeDetectorvITS04(mod,cpn0,cpn1,cpn2);
-    }break;
-    case kvPPRcourseasymm:{
-        return RecodeDetectorvPPRcourseasymm(mod,cpn0,cpn1,cpn2);
-    }break;
-    case kvPPRasymmFMD:{
-        return RecodeDetectorvPPRasymmFMD(mod,cpn0,cpn1,cpn2);
-    }break;
-    case kv11:{
-        return RecodeDetectorv11(mod,cpn0,cpn1,cpn2);
-    }break;
-    case kv11Hybrid:{
-        return RecodeDetectorv11Hybrid(mod,cpn0,cpn1,cpn2);
-    }break;
-    default:{
-        Error("RecodeDetector","Major version = %d, not supported",
-              (Int_t)fMajorVersion);
-        return;
-    }break;
-    } // end switch
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorLayers(Int_t mod,Int_t &layer,
-                                              Int_t &lad,Int_t &det){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose. Note, this use of layer ladder
-    // and detector numbers are strictly for internal use of this
-    // specific code. They do not represent the "standard" layer ladder
-    // or detector numbering except in a very old and obsoleate sence.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t lay     The layer number
-    //    Int_t lad     The ladder number
-    //    Int_t det     the dettector number
-    // Return:
-    //    none.
-
-    // This is a FIXED switch yard function. I (Bjorn Nilsen) Don't 
-    // like them but I see not better way for the moment.
-    switch (fMajorVersion){
-    case kvtest:{
-        if(GetMinorVersion()==1) 
-            return DecodeDetectorLayersvPPRasymmFMD(mod,layer,lad,det);
-        else if(GetMinorVersion()==2)
-            return DecodeDetectorLayersvtest2(mod,layer,lad,det);
-        Warning("DecodeDetectorLayers",
-                "Geometry is kvtest minor version=%d is not defined",
-                GetMinorVersion());
-        return;
-    }break;
-    case kvDefault:{
-        Error("DecodeDetectorLayers",
-              "Major version = kvDefault, not supported");
-        return;
-    }break;
-    case kvSPD02:{
-        return DecodeDetectorLayersvSPD02(mod,layer,lad,det);
-    }break;
-    case kvSDD03:{
-        return DecodeDetectorLayersvSDD03(mod,layer,lad,det);
-    }break;
-    case kvSSD03:{
-        return DecodeDetectorLayersvSSD03(mod,layer,lad,det);
-    }break;
-    case kvITS04:{
-        return DecodeDetectorLayersvITS04(mod,layer,lad,det);
-    }break;
-    case kvPPRcourseasymm:{
-        return DecodeDetectorLayersvPPRcourseasymm(mod,layer,lad,det);
-    }break;
-    case kvPPRasymmFMD:{
-        return DecodeDetectorLayersvPPRasymmFMD(mod,layer,lad,det);
-    }break;
-    case kv11:{
-        return DecodeDetectorLayersv11(mod,layer,lad,det);
-    }break;
-    case kv11Hybrid:{
-        return DecodeDetectorLayersv11Hybrid(mod,layer,lad,det);
-    }break;
-    default:{
-        Error("DecodeDetectorLayers","Major version = %d, not supported",
-              (Int_t)fMajorVersion);
-        return;
-    }break;
-    } // end switch
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorvSPD02(
-    Int_t &mod,Int_t ncpn,Int_t cpy0,Int_t cpy1,Int_t cpy2) const {
-    // decode geometry into detector module number
-    // Inputs:
-    //    Int_t ncpn     The Number of copies of this volume
-    //    Int_t cpy0     The lowest copy number
-    //    Int_t cpy1     The middle copy number
-    //    Int_t cpy2     the highest copy number
-    // Output:
-    //    Int_t &mod     The module number assoicated with this set
-    //                   of copy numbers.
-    // Return:
-    //    none.
-
-    // detector = ladder = 1
-    if(ncpn==4 && cpy1>2) mod = cpy1; // layer = 1,2
-    else mod = cpy1-1; // layer = 4,5
-    if(ncpn==1) mod = 2; // layer=3
-    cpy0 = cpy2;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::RecodeDetectorvSPD02(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Return:
-    //    none.
-
-    cpn2 = 0;
-    if(mod==2){
-        cpn0 = 1;
-        cpn1 = 1;
-        return;
-    } else if(mod<2){
-        cpn0 = 1;
-        cpn1 = mod+1;
-    }else{
-        cpn0 = 1;
-        cpn1 = mod;
-    } // end if
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorLayersvSPD02(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose. Note, this use of layer ladder
-    // and detector numbers are strictly for internal use of this
-    // specific code. They do not represent the "standard" layer ladder
-    // or detector numbering except in a very old and obsoleate sence.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t lay     The layer number
-    //    Int_t lad     The ladder number
-    //    Int_t det     the dettector number
-    // Return:
-    //    none.
-
-    lay = mod+1;
-    lad = det = 1;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorvSDD03(
-    Int_t &mod,Int_t ncpys,Int_t cpy0,Int_t cpy1,Int_t cpy2) const {
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t ncpys    The number of posible copies cpn1
-    //    Int_t cpy0     The lowest copy number
-    //    Int_t cpy1     The middle copy number
-    //    Int_t cpy2     the highest copy number
-    // Output:
-    //    Int_t &mod     The module number assoicated with this set
-    //                   of copy numbers.
-    // Return:
-    //    none.
-
-    if(ncpys==10){ // ITEL detectors
-        if(cpy1>4) mod = cpy1+1;
-        else mod = cpy1-1;
-    }else{ // IDET detectors
-        if(cpy1==1) mod = 4;
-        else mod = 5;
-    } // end if
-    cpy0=cpy2;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::RecodeDetectorvSDD03(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Return:
-    //    none.
-
-    cpn0 = 1;
-    cpn2 = 0;
-    if(mod<4) cpn1 = mod+1;
-    else if(mod==4||mod==5) cpn1 = mod-3;
-    else cpn1 = mod-1;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorLayersvSDD03(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose. Note, this use of layer ladder
-    // and detector numbers are strictly for internal use of this
-    // specific code. They do not represent the "standard" layer ladder
-    // or detector numbering except in a very old and obsoleate sence.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t lay     The layer number
-    //    Int_t lad     The ladder number
-    //    Int_t det     the dettector number
-    // Return:
-    //    none.
-
-    lad = det = 1;
-    lay = mod+1;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorvSSD03(
-    Int_t &mod,Int_t dtype,Int_t cpn0,Int_t cpn1,Int_t cpn2) const {
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t dtype    The detector type 1=ITSA 2=IGAR 3=IFRA
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Output:
-    //    Int_t &mod     The module number assoicated with this set
-    //                   of copy numbers.
-    // Return:
-    //    none.
-
-    if(dtype==2){mod=2; return;}
-    if(dtype==3){mod=3; return;}
-    mod = cpn0-1;
-    if(cpn0==3) mod = 4;
-    cpn1=cpn2;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::RecodeDetectorvSSD03(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Return:
-    //    none.
-
-    cpn1=1;
-    cpn2=0;
-    if(mod<2) cpn0=mod+1;
-    else if (mod==2||mod==3) cpn0=1;
-    else cpn0 = 3;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorLayersvSSD03(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose. Note, this use of layer ladder
-    // and detector numbers are strictly for internal use of this
-    // specific code. They do not represent the "standard" layer ladder
-    // or detector numbering except in a very old and obsoleate sence.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t lay     The layer number
-    //    Int_t lad     The ladder number
-    //    Int_t det     the dettector number
-    // Return:
-    //    none.
-
-    lad = det = 1;
-    lay = mod+1;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorvITS04(
-    Int_t &mod,Int_t dtype,Int_t cpn0,Int_t cpn1,Int_t cpn2) const {
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t dtype    The detector type 1=ITSA 2=IGAR 3=IFRA
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Output:
-    //    Int_t &mod     The module number assoicated with this set
-    //                   of copy numbers.
-    // Return:
-    //    none.
-
-    mod = dtype-1;
-    cpn0 = cpn1 = cpn2;
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::RecodeDetectorvITS04(Int_t mod,Int_t &cpn0,
-                                        Int_t &cpn1,Int_t &cpn2){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Return:
-    //    none.
-
-    cpn1 = cpn2 = 0;
-    switch(mod){
-    case 0:case 1:case 2:case 3:{
-        cpn0 = mod+1;
-    }break;
-    case 4: case 5:{
-        cpn0 = mod-3;
-    }break;
-    case 6:case 7:case 8:case 9:{
-        cpn0 = mod-5;
-    } break;
-    default:
-        cpn0 = 0;
-        break;
-    }// end switch
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorLayersvITS04(Int_t mod,Int_t &lay,
-                                                    Int_t &lad,Int_t &det){
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose. Note, this use of layer ladder
-    // and detector numbers are strictly for internal use of this
-    // specific code. They do not represent the "standard" layer ladder
-    // or detector numbering except in a very old and obsoleate sence.
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t lay     The layer number
-    //    Int_t lad     The ladder number
-    //    Int_t det     the dettector number
-    // Return:
-    //    none.
-
-    lad = 1;
-    switch(mod){
-    case 0:case 1:case 2:case 3:{
-        lay = mod/2 +1;
-        det = mod%2 +1;
-    }break;
-    case 4: case 5:{
-        lay = mod -1;
-    }break;
-    case 6:case 7:case 8:case 9:{
-        lay = mod/2 +2;
-        det = mod%2 +1;
-    }break;
-    default:
-        lay = 0;
-        det = 0;
-        break;
-    } // end switch
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorvPPRasymmFMD(Int_t &mod,Int_t layer,Int_t cpn0,
-                                        Int_t cpn1,Int_t cpn2) const {
-    // decode geometry into detector module number. There are two decoding
-    // Scheams. Old which does not follow the ALICE coordinate system
-    // requirements, and New which dose.
-    // Inputs:
-    //    Int_t layer    The ITS layer
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Output:
-    //    Int_t &mod     The module number assoicated with this set
-    //                   of copy numbers.
-    // Return:
-    //    none.
-    const Int_t kDetPerLadderSPD[2]={2,4};
-    const Int_t kDetPerLadder[6]={4,4,6,8,22,25};
-    const Int_t kLadPerLayer[6]={20,40,14,22,34,38};
-    Int_t lay=-1,lad=-1,det=-1,i;
+    const Int_t kDetPerLadderSPD[2]={2,4};
+    const Int_t kDetPerLadder[6]={4,4,6,8,22,25};
+    const Int_t kLadPerLayer[6]={20,40,14,22,34,38};
+    Int_t lay=-1,lad=-1,det=-1,i;
 
     if(fDecode){ // New decoding scheam
         switch (layer){
@@ -1969,7 +954,7 @@ void AliITSInitGeometry::DecodeDetectorvPPRasymmFMD(Int_t &mod,Int_t layer,Int_t
     return;
 }
 //______________________________________________________________________
-void AliITSInitGeometry::RecodeDetectorvPPRasymmFMD(Int_t mod,Int_t &cpn0,
+void AliITSInitGeometry::RecodeDetector(Int_t mod,Int_t &cpn0,
                                         Int_t &cpn1,Int_t &cpn2){
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
@@ -2076,7 +1061,7 @@ void AliITSInitGeometry::RecodeDetectorvPPRasymmFMD(Int_t mod,Int_t &cpn0,
     return;
 }
 //______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorLayersvPPRasymmFMD(Int_t mod,Int_t &lay,
+void AliITSInitGeometry::DecodeDetectorLayers(Int_t mod,Int_t &lay,
                                               Int_t &lad,Int_t &det){
     // decode geometry into detector module number. There are two decoding
     // Scheams. Old which does not follow the ALICE coordinate system
@@ -2112,149 +1097,7 @@ void AliITSInitGeometry::DecodeDetectorLayersvPPRasymmFMD(Int_t mod,Int_t &lay,
         lad++;
         mod2 += kDetPerLadder[lay-1];
     }while(mod2<=mod); // end while
-    if(lad>kLadPerLayer[lay-1]||lad<1) Error("DecodeDetectorLayers",
-            "lad=%d>kLadPerLayer[lay-1=%d]=%d mod=%d mod2=%d",lad,lay-1,
-                                            kLadPerLayer[lay-1],mod,mod2);
-    mod2 -= kDetPerLadder[lay-1];
-    det = mod-mod2+1;
-    if(det>kDetPerLadder[lay-1]||det<1) Error("DecodeDetectorLayers",
-           "det=%d>detPerLayer[lay-1=%d]=%d mod=%d mod2=%d lad=%d",det,
-                                  lay-1,kDetPerLadder[lay-1],mod,mod2,lad);
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorv11Hybrid(Int_t &mod,Int_t layer,Int_t cpn0,
-                                        Int_t cpn1,Int_t cpn2) const {
-    // decode geometry into detector module number
-    // Inputs:
-    //    Int_t layer    The ITS layer
-    //    Int_t cpn0     The lowest copy number
-    //    Int_t cpn1     The middle copy number
-    //    Int_t cpn2     the highest copy number
-    // Output:
-    //    Int_t &mod     The module number assoicated with this set
-    //                   of copy numbers.
-    // Return:
-    //    none.
-  const Int_t kDetPerLadderSPD[2]={2,4};
-  const Int_t kDetPerLadder[6]={4,4,6,8,22,25};
-  const Int_t kLadPerLayer[6]={20,40,14,22,34,38};
-  Int_t lad=-1,det=-1,i;
-  
-  switch(layer) {
-  case 1: case 2:{
-    lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1);
-    det = cpn2;
-  } break;
-  case 3: case 4:{
-    if (SDDIsTGeoNative()) {
-      lad = cpn0+1;
-      det = cpn1+1;
-    } else {
-      lad = cpn0;
-      det = cpn1;
-    }
-  } break;
-  case 5: case 6:{
-    lad = cpn0;
-    det = cpn1;
-  } break;
-  default:{
-  } break;
-  } // end switch
-  mod = 0;
-  for(i=0;ikITSgeoTreeCopys[lay-1][0]||
-       cpn1>kITSgeoTreeCopys[lay-1][1]||
-       cpn2>kITSgeoTreeCopys[lay-1][2])
-        Error("RecodeDetector",
-              "cpn0=%d cpn1=%d cpn2=%d mod=%d lay=%d lad=%d det=%d",
-              cpn0,cpn1,cpn2,mod,lay,lad,det);
-    return;
-}
-//______________________________________________________________________
-void AliITSInitGeometry::DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay,
-                                              Int_t &lad,Int_t &det) {
-
-    // decode geometry into detector module number for v11Hybrid
-    // Inputs:
-    //    Int_t mod      The module number assoicated with this set
-    //                   of copy numbers.
-    // Output:
-    //    Int_t lay     The layer number
-    //    Int_t lad     The ladder number
-    //    Int_t det     the dettector number
-    // Return:
-    //    none.
-
-    const Int_t kDetPerLadder[6]={4,4,6,8,22,25};
-    const Int_t kLadPerLayer[6]={20,40,14,22,34,38};
-    Int_t mod2;
-
-    det  = 0;
-    lad  = 0;
-    lay  = 0;
-    mod2 = 0;
-    do{
-        mod2 += kLadPerLayer[lay]*kDetPerLadder[lay];
-        lay++;
-    } while(mod2<=mod); // end while
-    if(lay>6||lay<1) Error("DecodeDetectorLayers","06",lay);
-    mod2 -= kLadPerLayer[lay-1]*kDetPerLadder[lay-1];
-    do{
-        lad++;
-        mod2 += kDetPerLadder[lay-1];
-    } while(mod2<=mod); // end while
-    if(lad>kLadPerLayer[lay-1]||lad<1) Error("DecodeDetectorLayers",
+    if(lad>kLadPerLayer[lay-1]||lad<1) Error("DecodeDetectorLayera",
             "lad=%d>kLadPerLayer[lay-1=%d]=%d mod=%d mod2=%d",lad,lay-1,
                                             kLadPerLayer[lay-1],mod,mod2);
     mod2 -= kDetPerLadder[lay-1];
@@ -2265,132 +1108,3 @@ void AliITSInitGeometry::DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay,
     return;
 }
 
-//______________________________________________________________________
-Bool_t AliITSInitGeometry::WriteVersionString(Char_t *str,Int_t length,
-                        AliITSVersion_t maj,Int_t min,
-                        const Char_t *cvsDate,const Char_t *cvsRevision)const{
-    // fills the string str with the major and minor version number
-    // Inputs:
-    //   Char_t *str          The character string to hold the major 
-    //                        and minor version numbers in
-    //   Int_t  length        The maximum number of characters which 
-    //                        can be accomidated by this string. 
-    //                        str[length-1] must exist and will be set to zero
-    //   AliITSVersion_t maj  The major number
-    //   Int_t           min  The minor number
-    //   Char_t *cvsDate      The date string from cvs
-    //   Char_t *cvsRevision  The Revision string from cvs
-    // Outputs:
-    //   Char_t *str          The character string holding the major and minor
-    //                        version numbers. str[length-1] must exist
-    //                        and will be set to zero
-    // Return:
-    //   kTRUE if no errors
-    Int_t i,n,cvsDateLength,cvsRevisionLength;
-
-    cvsDateLength = (Int_t)strlen(cvsDate);
-    cvsRevisionLength = (Int_t)strlen(cvsRevision);
-    i = (Int_t)maj;
-    n = 50+(Int_t)(TMath::Log10(TMath::Abs((Double_t)i)))+1+
-        (Int_t)(TMath::Log10(TMath::Abs((Double_t)min)))+1
-        +cvsDateLength-6+cvsRevisionLength-10;
-    if(GetDebug()>1) printf("AliITSInitGeometry::WriteVersionString:"
-                        "length=%d major=%d minor=%d cvsDate=%s[%d] "
-                        "cvsRevision=%s[%d] n=%d\n",length,i,min,cvsDate,
-                        cvsDateLength,cvsRevision,cvsRevisionLength,n);
-    if(i<0) n++;
-    if(min<0) n++;
-    if(length1)printf("AliITSInitGeometry::WriteVersionString: "
-                       "n=%d str=%s revision[%zu] date[%zu]\n",
-                       n,str,strlen(cvsrevision),strlen(cvsdate));
-    delete[] cvsrevision;
-    delete[] cvsdate;
-    return kTRUE;
-}
-//______________________________________________________________________
-Bool_t AliITSInitGeometry::ReadVersionString(const Char_t *str,Int_t length,
-                                             AliITSVersion_t &maj,Int_t &min,
-                                             TDatime &dt)const{
-    // fills the string str with the major and minor version number
-    // Inputs:
-    //   Char_t *str   The character string to holding the major and minor
-    //                 version numbers in
-    //   Int_t  length The maximum number of characters which can be
-    //                 accomidated by this string. str[length-1] must exist
-    // Outputs:
-    //   Char_t *str   The character string holding the major and minor
-    //                 version numbers unchanged. str[length-1] must exist.
-    //   AliITSVersion_t maj  The major number
-    //   Int_t           min  The minor number
-    //   TDatime         dt   The date and time of the cvs commit
-    // Return:
-    //   kTRUE if no errors
-    Bool_t ok;
-    Char_t cvsRevision[10],cvsDate[11],cvsTime[9];
-    Int_t i,m,n=strlen(str),year,month,day,hours,minuits,seconds;
-
-    if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString:"
-                       "str=%s length=%d\n",
-                       str,length);
-    if(n<35) return kFALSE; // not enough space for numbers
-    m = sscanf(str,"Major Version= %d  Minor Version= %d Revision: %s "
-               "Date: %s %s",&i,&min,cvsRevision,cvsDate,cvsTime);
-    ok = m==5;
-    if(!ok) return !ok;
-    m = sscanf(cvsDate,"%d/%d/%d",&year,&month,&day);
-    ok = m==3;
-    if(!ok) return !ok;
-    m = sscanf(cvsTime,"%d:%d:%d",&hours,&minuits,&seconds);
-    ok = m==3;
-    if(!ok) return !ok;
-    dt.Set(year,month,day,hours,minuits,seconds);
-    if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString: i=%d min=%d "
-                       "cvsRevision=%s cvsDate=%s cvsTime=%s m=%d\n",
-                       i,min,cvsRevision,cvsDate,cvsTime,m);
-    if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString: year=%d"
-                       " month=%d day=%d hours=%d minuits=%d seconds=%d\n",
-                       year,month,day,hours,minuits,seconds);
-    switch (i){
-    case kvITS04:{
-        maj = kvITS04;
-    } break;
-    case kvSPD02:{
-        maj = kvSPD02;
-    } break;
-    case kvSDD03:{
-        maj = kvSDD03;
-    } break;
-    case kvSSD03:{
-        maj = kvSSD03;
-    } break;
-    case kvPPRasymmFMD:{
-        maj = kvPPRasymmFMD;
-    } break;
-    case kv11:{
-        maj = kv11;
-    } break;
-    case kv11Hybrid:{
-        maj = kv11Hybrid;
-    } break;
-    default:{
-        maj = kvDefault;
-    } break;
-    } // end switch
-    return ok;
-}
diff --git a/ITS/AliITSInitGeometry.h b/ITS/AliITSInitGeometry.h
index ec4a419f85c..8c4ea57ee02 100644
--- a/ITS/AliITSInitGeometry.h
+++ b/ITS/AliITSInitGeometry.h
@@ -14,35 +14,25 @@
 
 #include 
 #include 
-#include "AliITSgeom.h"
 
 typedef enum {
-    kvtest=-1,kvDefault=0,
-    kvSPD02=1,kvSDD03=2,kvSSD03=3,kvITS04=4,
-    kvPPRcourseasymm=6,kvPPRasymmFMD=10,
-    kv11=11,kv11Hybrid=110
+  kvPPRasymmFMD=10,kv11=11,kv11Hybrid=110,kvDefault=1
 } AliITSVersion_t;
 
+
+class AliITSgeom;
 class TArrayD;
 class TGeoHMatrix;
-class TDatime;
 
 class AliITSInitGeometry : public TObject{
  public:
-
-    AliITSInitGeometry();//Default Constructor
-    AliITSInitGeometry(AliITSVersion_t version,
-		       Int_t minorversion=2);//Standard Constructor
+    AliITSInitGeometry(AliITSVersion_t 
+       version=kvPPRasymmFMD,Int_t minorversion=2);//Standard Constructor
     //virtual ~AliITSInitGeometry(); // Destructor
     //
-    // Create and initialize geometry from TGeo
-    AliITSgeom* CreateAliITSgeom();
-    AliITSgeom* CreateAliITSgeom(Int_t major,Int_t minor); 
-    Bool_t InitAliITSgeom(AliITSgeom *geom);//Initilize geometry from gGeoManager
-    // Getters and Setters
+    AliITSgeom* CreateAliITSgeom(); // Create and intilize geometry from TGeom
+    Bool_t InitAliITSgeom(AliITSgeom *geom);//Initilize goemetry from gGeoManager
     // Getters and Setters
-    void    SetVersion(AliITSVersion_t maj,Int_t min) {// Set Major and Minor versions
-        fMajorVersion=maj;fMinorVersion=min;}
     TString GetGeometryName()const {return fName;}// Return geometry name
     void    SetGeometryName(const Char_t *name){fName = name;}// Set Geometry name
     Int_t   GetMajorVersion()const {return (Int_t)fMajorVersion;} // Return geometry major version
@@ -53,135 +43,21 @@ class AliITSInitGeometry : public TObject{
     void    SetSegGeom(Bool_t seg=kTRUE){fSegGeom = seg;}// Set the use of AliITSsegmentation class' instead of AliITSgeomS?D class in fShape
     Bool_t  GetDecoding()const{return fDecode;}// Return flag indecating wether to use new/old decoding
     void    SetDecoding(Bool_t newdec=kFALSE){fDecode = newdec;}// Set flag to use new/old decoding
-     // Set debug level. debug=0 no debug info outputted.
-    void    SetDebug(Int_t debug=0){fDebug=debug;};
-    // Retrun debug value
-    Int_t   GetDebug()const{return fDebug;};
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayers(Int_t mod,Int_t &lay,Int_t &lad,Int_t &det);
-    // find module number by layer, and copy numbers
-    void DecodeDetector(Int_t &mod,Int_t lay,Int_t cpn0,
-                        Int_t cpn1,Int_t cpn2) const;
-    // Given module number, find copy numbers.
-    void RecodeDetector(Int_t mod,Int_t &cpn0,Int_t &cpn1,Int_t &cpn2);
-   // fills the string str with the major and minor version number
-    Bool_t WriteVersionString(Char_t *str,Int_t length,
-                              AliITSVersion_t maj,Int_t min,
-                              const Char_t *cvsDate,const Char_t *cvsRev)const;
-    // decodes the string str with the major and minor version number
-    Bool_t ReadVersionString(const Char_t *str,Int_t length,
-                             AliITSVersion_t &maj,Int_t &min,TDatime &dt)const;
 
-    static Bool_t SPDIsTGeoNative() {return !fgkOldSPDbarrel;}
-    static Bool_t SDDIsTGeoNative() {return !fgkOldSDDbarrel;}
-    static Bool_t SSDIsTGeoNative() {return !fgkOldSSDbarrel;}
+    static const Bool_t SPDIsTGeoNative() {return !fgkOldSPDbarrel;}
+    static const Bool_t SDDIsTGeoNative() {return !fgkOldSDDbarrel;}
+    static const Bool_t SSDIsTGeoNative() {return !fgkOldSSDbarrel;}
 
-    static Bool_t SDDconeIsTGeoNative()   {return ! fgkOldSDDcone;} 
-    static Bool_t SSDconeIsTGeoNative()   {return ! fgkOldSSDcone;}
-    static Bool_t SPDshieldIsTGeoNative() {return ! fgkOldSPDshield;}
-    static Bool_t SDDshieldIsTGeoNative() {return ! fgkOldSDDshield; }
-    static Bool_t SSDshieldIsTGeoNative() {return ! fgkOldSSDshield;}
-    static Bool_t ServicesAreTGeoNative() {return ! fgkOldServices;}
-    static Bool_t SupportIsTGeoNative()   {return ! fgkOldSupports;}
+    static const Bool_t SDDconeIsTGeoNative()   {return ! fgkOldSDDcone;} 
+    static const Bool_t SSDconeIsTGeoNative()   {return ! fgkOldSSDcone;}
+    static const Bool_t SPDshieldIsTGeoNative() {return ! fgkOldSPDshield;}
+    static const Bool_t SDDshieldIsTGeoNative() {return ! fgkOldSDDshield; }
+    static const Bool_t SSDshieldIsTGeoNative() {return ! fgkOldSSDshield;}
+    static const Bool_t ServicesAreTGeoNative() {return ! fgkOldServices;}
+    static const Bool_t SupportIsTGeoNative()   {return ! fgkOldSupports;}
 
- private:
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersvtest2(Int_t mod,Int_t &lay,
-                                   Int_t &lad,Int_t &det){
-        lay=mod+1;lad=det=1;};
-    // find module number by layer, and copy numbers
-    void DecodeDetectorvtest2(Int_t &mod,Int_t lay,Int_t cpn0,
-                             Int_t cpn1,Int_t cpn2) const{
-        mod=lay-1;cpn0=cpn1=cpn2=1;};
-    // Given module number, find copy numbers.
-    void RecodeDetectorvtest2(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                             Int_t &cpn2){
-        mod=cpn0=cpn1=cpn2=1;};
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersvSPD02(Int_t mod,Int_t &lay,
-                                   Int_t &lad,Int_t &det);
-    // find module number by layer, and copy numbers
-    void DecodeDetectorvSPD02(Int_t &mod,Int_t lay,Int_t cpn0,
-                             Int_t cpn1,Int_t cpn2) const;
-    // Given module number, find copy numbers.
-    void RecodeDetectorvSPD02(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                             Int_t &cpn2);
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersvSDD03(Int_t mod,Int_t &lay,
-                                   Int_t &lad,Int_t &det);
-    // find module number by layer, and copy numbers
-    void DecodeDetectorvSDD03(Int_t &mod,Int_t lay,Int_t cpn0,
-                             Int_t cpn1,Int_t cpn2) const;
-    // Given module number, find copy numbers.
-    void RecodeDetectorvSDD03(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                             Int_t &cpn2);
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersvSSD03(Int_t mod,Int_t &lay,
-                                   Int_t &lad,Int_t &det);
-    // find module number by layer, and copy numbers
-    void DecodeDetectorvSSD03(Int_t &mod,Int_t lay,Int_t cpn0,
-                             Int_t cpn1,Int_t cpn2) const;
-    // Given module number, find copy numbers.
-    void RecodeDetectorvSSD03(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                             Int_t &cpn2);
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersvITS04(Int_t mod,Int_t &lay,
-                                   Int_t &lad,Int_t &det);
-    // find module number by layer, and copy numbers
-    void DecodeDetectorvITS04(Int_t &mod,Int_t lay,Int_t cpn0,
-                             Int_t cpn1,Int_t cpn2) const;
-    // Given module number, find copy numbers.
-    void RecodeDetectorvITS04(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                             Int_t &cpn2);
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersvPPRcourseasymm(Int_t mod,Int_t &lay,
-                                   Int_t &lad,Int_t &det){
-        lay=lad=det=mod;/*Dummy*/};
-    // find module number by layer, and copy numbers
-    void DecodeDetectorvPPRcourseasymm(Int_t &mod,Int_t lay,Int_t cpn0,
-                             Int_t cpn1,Int_t cpn2) const{
-        mod=lay=cpn0=cpn1=cpn2;/*Dummy*/};
-    // Given module number, find copy numbers.
-    void RecodeDetectorvPPRcourseasymm(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                             Int_t &cpn2){
-        cpn0=cpn1=cpn2=mod;/*Dummy*/};
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersvPPRasymmFMD(Int_t mod,Int_t &lay,
-                                         Int_t &lad,Int_t &det);
-    // find module number by layer, and copy numbers
-    void DecodeDetectorvPPRasymmFMD(Int_t &mod,Int_t lay,Int_t cpn0,
-                                    Int_t cpn1,Int_t cpn2) const;
-    // Given module number, find copy numbers.
-    void RecodeDetectorvPPRasymmFMD(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                                    Int_t &cpn2);
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorLayersv11(Int_t mod,Int_t &lay,
-                                         Int_t &lad,Int_t &det)const{
-        lay=lad=det=mod;};
-    // find module number by layer, and copy numbers
-    void DecodeDetectorv11(Int_t &mod,Int_t lay,Int_t cpn0,
-                                    Int_t cpn1,Int_t cpn2) const{
-        mod=lay=cpn0=cpn1=cpn2;};
-    // Given module number, find copy numbers.
-    void RecodeDetectorv11(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                                    Int_t &cpn2)const{
-        cpn0=cpn1=cpn2=mod;};
-    // Decode module number into old layer, ladder, and detector numbers
-    void DecodeDetectorv11Hybrid(Int_t &mod,Int_t lay,Int_t cpn0,Int_t cpn1,
-                                 Int_t cpn2)const;
-    // find module number by layer, and copy numbers
-    void RecodeDetectorv11Hybrid(Int_t mod,Int_t &cpn0,Int_t &cpn1,
-                                    Int_t &cpn2);
-    // Given module number, find copy numbers.
-    void DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay,Int_t &lad,
-                                    Int_t &det);
-		   
+ private:		   
     // Virtual MC code reproduction
-    Bool_t InitAliITSgeomSPD02(AliITSgeom *geom);
-    Bool_t InitAliITSgeomSDD03(AliITSgeom *geom);
-    Bool_t InitAliITSgeomSSD03(AliITSgeom *geom);
-    Bool_t InitAliITSgeomITS04(AliITSgeom *geom);
-    Bool_t InitAliITSgeomtest2(AliITSgeom *geom);
     Bool_t InitAliITSgeomPPRasymmFMD(AliITSgeom *geom);
     Bool_t InitAliITSgeomV11Hybrid(AliITSgeom *geom);
     Bool_t InitAliITSgeomV11(AliITSgeom *geom);
@@ -191,17 +67,19 @@ class AliITSInitGeometry : public TObject{
 				       TArrayD &shapePar,AliITSgeom *geom);
     Bool_t GetTransformation(const TString &volumePath,TGeoHMatrix &mat);
     Bool_t GetShape(const TString &volumePath,TString &shapeType,TArrayD &par);
-    void TransposeTGeoHMatrix(TGeoHMatrix *m) const;
+    void DecodeDetectorLayers(Int_t mod,Int_t &lay,Int_t &lad,Int_t &det);
+    void DecodeDetector(Int_t &mod,Int_t lay,Int_t cpn0,
+                        Int_t cpn1,Int_t cpn2) const;
+    void RecodeDetector(Int_t mod,Int_t &cpn0,Int_t &cpn1,Int_t &cpn2);
 
-    TString         fName;         // Geometry name
-    Int_t           fMinorVersion; // Geometry minor version
-    AliITSVersion_t fMajorVersion; // Geometry swich value
-    Bool_t          fTiming;       // Flag to start inilization timing
-    Bool_t          fSegGeom;      // Flag to switch between the old use of
-                                   // AliITSgeomS?D class, or AliITSsegmentation
-                                   // class in fShape of AliITSgeom class.
-    Bool_t          fDecode;       // Flag for new/old decoding
-    Int_t           fDebug;        // Debug flag
+    TString   fName;          // Geometry name
+    Int_t           fMinorVersion;  // Geometry minor version
+    AliITSVersion_t fMajorVersion;  // Geometry swich value
+    Bool_t          fTiming;        // Flag to start inilization timing
+    Bool_t          fSegGeom;       // Flag to switch between the old use of
+                              // AliITSgeomS?D class, or AliITSsegmentation
+                              // class in fShape of AliITSgeom class.
+    Bool_t          fDecode;        // Flag for new/old decoding
 
     static const Bool_t fgkOldSPDbarrel;   // use old geo for SPD ?
     static const Bool_t fgkOldSDDbarrel;   // use old geo for SDD ?
diff --git a/ITS/AliITSMultReconstructor.cxx b/ITS/AliITSMultReconstructor.cxx
index 435a9011d41..39a8c80b023 100644
--- a/ITS/AliITSMultReconstructor.cxx
+++ b/ITS/AliITSMultReconstructor.cxx
@@ -27,7 +27,7 @@
 // differencies in Phi (azimuth) and Zeta (longitudinal) are inside 
 // a fiducial volume. In case of multiple candidates it is selected the
 // candidate with minimum distance in Phi. 
-// The parameter AssociationChoice allows to control if two clusters
+// The parameter AssociationChoice allows to control if two clusters 
 // in layer 2 can be associated to the same cluster in layer 1 or not.
 //
 // Two methods return the number of traklets and the number of clusters 
@@ -106,9 +106,9 @@ fhphiClustersLay1(0){
   fAssociationFlag    = new Bool_t[300000];
 
   for(Int_t i=0; i<300000; i++) {
-    fClustersLay1[i]       = new Float_t[6];
-    fClustersLay2[i]       = new Float_t[6];
-    fTracklets[i]          = new Float_t[4];
+    fClustersLay1[i]       = new Float_t[3];
+    fClustersLay2[i]       = new Float_t[3];
+    fTracklets[i]          = new Float_t[3];
     fSClusters[i]           = new Float_t[2];
     fAssociationFlag[i]    = kFALSE;
   }
@@ -259,13 +259,13 @@ AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*
     
     fClustersLay1[iC1][0] = TMath::ACos(z/r);  // Store Theta
     fClustersLay1[iC1][1] = TMath::ATan2(x,y);  // Store Phi
-    fClustersLay1[iC1][2] = z/r;               // Store scaled z
+    fClustersLay1[iC1][2] = z/r;               // Store scaled z 
     if (fHistOn) {
       Float_t eta=fClustersLay1[iC1][0];
       eta= TMath::Tan(eta/2.);
       eta=-TMath::Log(eta);
       fhetaClustersLay1->Fill(eta);    
-      fhphiClustersLay1->Fill(fClustersLay1[iC1][1]);
+      fhphiClustersLay1->Fill(fClustersLay1[iC1][1]);    
     }      
 }
   
@@ -311,7 +311,7 @@ AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*
 	// find the difference in z (between linear projection from layer 1
 	// and the actual point: Dzeta= z1/r1*r2 -z2) 	
 	Float_t r2   = fClustersLay2[iC2][2]/TMath::Cos(fClustersLay2[iC2][0]);
-        Float_t dZeta  = fClustersLay1[iC1][2]*r2 - fClustersLay2[iC2][2];
+        Float_t dZeta  = fClustersLay1[iC1][2]*r2 - fClustersLay2[iC2][2]; 
 
  	if (fHistOn) {
 	  fhClustersDPhiAll->Fill(dPhi);    
@@ -339,7 +339,7 @@ AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*
     if (distmin<100) { // This means that a cluster in layer 2 was found that mathes with iC1
 
       if (fHistOn) {
-	fhClustersDPhiAcc->Fill(dPhimin);
+	fhClustersDPhiAcc->Fill(dPhimin);    
 	fhClustersDThetaAcc->Fill(dThetamin);    
 	fhClustersDZetaAcc->Fill(dZetamin);    
 	fhDPhiVsDThetaAcc->Fill(dThetamin, dPhimin);
@@ -350,40 +350,13 @@ AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*
       
       // store the tracklet
       
-      // use the theta from the clusters in the first layer
+      // use the theta from the clusters in the first layer 
       fTracklets[fNTracklets][0] = fClustersLay1[iC1][0];
-      // use the phi from the clusters in the first layer
+      // use the phi from the clusters in the first layer 
       fTracklets[fNTracklets][1] = fClustersLay1[iC1][1];
       // Store the difference between phi1 and phi2
-      fTracklets[fNTracklets][2] = fClustersLay1[iC1][1] - fClustersLay2[iC2WithBestDist][1];
-
-      // find label
-      Int_t label1 = 0;
-      Int_t label2 = 0;
-      while (label2 < 3)
-      {
-        if ((Int_t) fClustersLay1[iC1][3+label1] != -2 && (Int_t) fClustersLay1[iC1][3+label1] == (Int_t) fClustersLay2[iC2WithBestDist][3+label2])
-          break;
-
-        label1++;
-        if (label1 == 3)
-        {
-          label1 = 0;
-          label2++;
-        }
-      }
-
-      if (label2 < 3)
-      {
-        AliDebug(AliLog::kDebug, Form("Found label %d == %d for tracklet candidate %d\n", (Int_t) fClustersLay1[iC1][3+label1], (Int_t) fClustersLay2[iC2WithBestDist][3+label2], fNTracklets));
-        fTracklets[fNTracklets][3] = fClustersLay1[iC1][3+label1];
-      }
-      else
-      {
-        AliDebug(AliLog::kDebug, Form("Did not find label %d %d %d %d %d %d for tracklet candidate %d\n", (Int_t) fClustersLay1[iC1][3], (Int_t) fClustersLay1[iC1][4], (Int_t) fClustersLay1[iC1][5], (Int_t) fClustersLay2[iC2WithBestDist][3], (Int_t) fClustersLay2[iC2WithBestDist][4], (Int_t) fClustersLay2[iC2WithBestDist][5], fNTracklets));
-        fTracklets[fNTracklets][3] = -2;
-      }
-
+      fTracklets[fNTracklets][2] = fClustersLay1[iC1][1] - fClustersLay2[iC2WithBestDist][1];       
+  
       if (fHistOn) {
 	Float_t eta=fTracklets[fNTracklets][0];
 	eta= TMath::Tan(eta/2.);
@@ -400,13 +373,13 @@ AliITSMultReconstructor::Reconstruct(TTree* clusterTree, Float_t* vtx, Float_t*
 
     // Delete the following else if you do not want to save Clusters! 
 
-    else { // This means that the cluster has not been associated
+    else { // This means that the cluster has not been associated 
 
       // store the cluster
        
       fSClusters[fNSingleCluster][0] = fClustersLay1[iC1][0];
       fSClusters[fNSingleCluster][1] = fClustersLay1[iC1][1];
-      AliDebug(1,Form(" Adding a single cluster %d (cluster %d  of layer 1)",
+      AliDebug(1,Form(" Adding a single cluster %d (cluster %d  of layer 1)", 
 		      fNSingleCluster, iC1));
       fNSingleCluster++;
     }
@@ -464,7 +437,7 @@ AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) {
     
     // loop over clusters
     while(nClusters--) {
-      AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);
+      AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);	
       
       if (cluster->GetLayer()>1) 
 	continue;            
@@ -477,16 +450,12 @@ AliITSMultReconstructor::LoadClusterArrays(TTree* itsClusterTree) {
 	fClustersLay1[fNClustersLay1][0] = x;
 	fClustersLay1[fNClustersLay1][1] = y;
 	fClustersLay1[fNClustersLay1][2] = z;
-	for (Int_t i=0; i<3; i++)
-		fClustersLay1[fNClustersLay1][3+i] = cluster->GetLabel(i);
 	fNClustersLay1++;
       }
-      if (cluster->GetLayer()==1) {
+      if (cluster->GetLayer()==1) {	
 	fClustersLay2[fNClustersLay2][0] = x;
 	fClustersLay2[fNClustersLay2][1] = y;
 	fClustersLay2[fNClustersLay2][2] = z;
-	for (Int_t i=0; i<3; i++)
-		fClustersLay2[fNClustersLay2][3+i] = cluster->GetLabel(i);
 	fNClustersLay2++;
       }
       
@@ -521,4 +490,3 @@ AliITSMultReconstructor::SaveHists() {
   fhetaClustersLay1->Write();
   fhphiClustersLay1->Write();
 }
-
diff --git a/ITS/AliITSPreprocessorSDD.h b/ITS/AliITSPreprocessorSDD.h
index a7ec27689c7..44e69db3b6b 100644
--- a/ITS/AliITSPreprocessorSDD.h
+++ b/ITS/AliITSPreprocessorSDD.h
@@ -17,8 +17,8 @@ class AliITSPreprocessorSDD : public AliPreprocessor {
 
  public:
  
-  AliITSPreprocessorSDD( AliShuttleInterface* shuttle):
-    AliPreprocessor("SDD", shuttle){}
+  AliITSPreprocessorSDD(const char* detector, AliShuttleInterface* shuttle):
+    AliPreprocessor(detector,shuttle){SetName("SDD");}
   virtual ~AliITSPreprocessorSDD(){;}
 
 
diff --git a/ITS/AliITSPrintRecPoints.C b/ITS/AliITSPrintRecPoints.C
index 0809817e098..ad583c7d740 100644
--- a/ITS/AliITSPrintRecPoints.C
+++ b/ITS/AliITSPrintRecPoints.C
@@ -1,5 +1,5 @@
-void AliITSPrintRecPoints(Int_t outtype=1,TString rfn="galice.root",
-                          Int_t mod=-1,Int_t evnt=-1){
+void AliITSPrintRecPoints(TString rfn="galice.root",Int_t mod=-1,
+			  Int_t evnt=-1){
   // Macro to print out the recpoints for all or a specific module
 
   // Dynamically link some shared libs
@@ -30,38 +30,15 @@ void AliITSPrintRecPoints(Int_t outtype=1,TString rfn="galice.root",
     cerr<<"AliITSPrintRecPoints.C :  ITS loader not found"<Import("geometry.root","");
-  } // end if
   ITSloader->LoadHits("read");
   ITSloader->LoadDigits("read");
   ITSloader->LoadRecPoints("read");
-  cout << "loaded hits, digits, and RecPoints"<< endl;
-  AliITS *ITS = 0;
-  ITS = (AliITS*)(gAlice->GetDetector("ITS"));
+  AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
   if(!ITS){
     cout << "Error: no ITS found. Aborting"<GetITSgeom();
-  if(!gm){
-      cout <<"No AliITSgeom object found in ITS"<UpdateInternalGeometry(gGeoManager);
-      } // end if
-  } // end if !AliITSgeom
 
   Int_t evNumber1 = 0;
   Int_t evNumber2 = gAlice->GetEventsPerRun();
@@ -70,19 +47,19 @@ void AliITSPrintRecPoints(Int_t outtype=1,TString rfn="galice.root",
     evNumber2 = evnt+1;
   } // end if evnt>=0
   Int_t mod1 = 0;
-  Int_t mod2 = gm->GetIndexMax();
+  Int_t mod2 = ITS->GetITSgeom()->GetIndexMax();
   if(mod>=0){
     mod1 = mod;
     mod2 = mod+1;
   } // end if mod>=0
   TClonesArray *rpa;
   AliITSRecPoint *rp = 0;
-  AliITSDetTypeRec* rec = new AliITSDetTypeRec(ITSloader);
-  //rec->SetITSgeom(gm);
+  AliITSDetTypeRec* rec = new AliITSDetTypeRec();
+  rec->SetLoader(ITSloader);
+  rec->SetITSgeom(ITS->GetITSgeom());
   rec->SetDefaults();
 
   Int_t event,m,i,i2;
-  Float_t xyz[3];
   for(event = evNumber1; event < evNumber2; event++){
     rl->GetEvent(event);
     rec->SetTreeAddress();
@@ -95,23 +72,10 @@ void AliITSPrintRecPoints(Int_t outtype=1,TString rfn="galice.root",
       cout <<  "Event=" << event << " module=" << m <<
 	" Number of Recpoints=" << i2 <At(i));
-          switch(outtype){
-          case 1:
-              rp->GetGlobalXYZ(xyz);
-              cout << i << " lx=" << rp->GetDetLocalX() 
-                        << " lz=" << rp->GetDetLocalZ() 
-                   << " x=" << rp->GetX() 
-                   << " y=" << rp->GetY()<< " z=" << rp->GetZ() 
-                   <<" gx=" << xyz[0] << " gy="<< xyz[1] <<" gz="<Print((ostream*)cout);
-              cout << endl;
-              break;
-          } // end switch
+	rp = (AliITSRecPoint*)(rpa->At(i));
+	cout << i << " ";
+	rp->Print((ostream*)cout);
+	cout << endl;
       } // end for i
     } // end for m
   } // end for event
diff --git a/ITS/AliITSRecPoint.cxx b/ITS/AliITSRecPoint.cxx
index abd86e619ca..25cd6644b7b 100644
--- a/ITS/AliITSRecPoint.cxx
+++ b/ITS/AliITSRecPoint.cxx
@@ -155,16 +155,11 @@ void AliITSRecPoint::Print(ostream *os){
  
     fmt = os->setf(ios::fixed);  // set fixed floating point output
     *os << GetLabel(0) << " " << GetLabel(1) << " " << GetLabel(2) << " ";
+    *os << fXloc << " " << fZloc << " " << fQ << " ";
     fmt = os->setf(ios::scientific); // set scientific for dEdX.
-    *os << GetX() <<" " << GetY() << " " << GetZ() << " " ;
-    *os << GetSigmaY2() << " " << GetSigmaZ2() << " " << GetSigmaYZ() << " ";
-    fmt = os->setf(ios::fixed);
-    *os << GetVolumeId() << " "<< Misalign() /*fIsMisaligned*/ << " ";
-    fmt = os->setf(ios::scientific); // set scientific for dEdX.
-    *os << fXloc << " " << fZloc << " " << fdEdX << " ";
+    *os << fdEdX << " ";
     fmt = os->setf(ios::fixed); // every fixed
-    *os << fIndex <<" " << fQ << " "<flags(fmt); // reset back to old formating.
     return;
 }
@@ -173,22 +168,17 @@ void AliITSRecPoint::Read(istream *is){
 ////////////////////////////////////////////////////////////////////////
 // Standard input format for this class.
 ////////////////////////////////////////////////////////////////////////
-    Bool_t mis;
-    Int_t lab[4];
-    Float_t hit[6];
-    lab[3] = 0; // ??
-    *is >> lab[0] >> lab[1] >> lab[2];
-    SetLabel(lab[0],0); SetLabel(lab[1],1); SetLabel(lab[2],2);
-    *is >> hit[0] >> hit[1] >> hit[2] >> hit[3] >> hit[4] >> hit[5];
-    SetX(hit[0]);SetY(hit[1]);SetZ(hit[2]);SetSigmaY2(hit[3]);
-    SetSigmaZ2(hit[4]);//fSigmaYZ=hit[5];
-    *is >> lab[0] >> mis;
-    SetVolumeId(lab[0]);// fIsMisalinged = mis;
-    *is >> fXloc >> fZloc >> fdEdX;
-    *is >> fIndex >> fQ >> fLayer >> fNz >> fNy >> fChargeRatio >> fType;
-    *is >> fDeltaProb;
-
-    return;
+ 
+  Int_t lab[4];
+  Float_t hit[5];
+  lab[3] = 0; // ??
+  *is >> lab[0] >> lab[1] >> lab[2] >> hit[0] >> hit[1] >> hit[4];
+  *is >> fdEdX >> hit[2] >> hit[3];
+  Int_t info[3] = {0,0,0};
+  AliITSRecPoint rp(lab,hit,info,kTRUE);
+  *this = rp;
+
+  return;
 }
 //----------------------------------------------------------------------
 ostream &operator<<(ostream &os,AliITSRecPoint &p){
diff --git a/ITS/AliITSReconstructor.cxx b/ITS/AliITSReconstructor.cxx
index 9614b0a24dd..c1bc36bca3d 100644
--- a/ITS/AliITSReconstructor.cxx
+++ b/ITS/AliITSReconstructor.cxx
@@ -29,13 +29,11 @@
 #include "AliITSDetTypeRec.h"
 #include "AliITSLoader.h"
 #include "AliITStrackerMI.h"
-#include "AliITStrackerV2.h"
 #include "AliITStrackerSA.h"
 #include "AliITSVertexerIons.h"
 #include "AliITSVertexerFast.h"
-#include "AliITSVertexer3D.h"
+#include "AliITSVertexerPPZ.h"
 #include "AliITSVertexerZ.h"
-#include "AliITSVertexerCosmics.h"
 #include "AliESD.h"
 #include "AliITSpidESD.h"
 #include "AliITSpidESD1.h"
@@ -170,9 +168,6 @@ AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
   AliTracker* tracker;    
   if (selectedTracker.Contains("MI")) {
     tracker = new AliITStrackerMI(0);
-  }  
-  else if (selectedTracker.Contains("V2")) {
-    tracker = new AliITStrackerV2(0);
   }
   else {
     tracker =  new AliITStrackerSA(0);  // inherits from AliITStrackerMI
@@ -212,13 +207,9 @@ AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) co
     Info("CreateVertexer","a AliITSVertexerFast object has been selected\n"); 
     return new AliITSVertexerFast(smear);
   }
-  if(selectedVertexer.Contains("3d") || selectedVertexer.Contains("3D")){
-    Info("CreateVertexer","a AliITSVertexer3D object has been selected\n");
-    return new AliITSVertexer3D("null");
-  }
-  if(selectedVertexer.Contains("cosmics") || selectedVertexer.Contains("COSMICS")){
-    Info("CreateVertexer","a AliITSVertexerCosmics object has been selected\n");
-    return new AliITSVertexerCosmics();
+  if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
+    Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
+    return new AliITSVertexerPPZ("null");
   }
   // by default an AliITSVertexerZ object is instatiated
   Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
diff --git a/ITS/AliITSVertexer.cxx b/ITS/AliITSVertexer.cxx
index ccb8bcb8960..fb172343018 100644
--- a/ITS/AliITSVertexer.cxx
+++ b/ITS/AliITSVertexer.cxx
@@ -13,8 +13,8 @@ ClassImp(AliITSVertexer)
 //////////////////////////////////////////////////////////////////////
 // Base class for primary vertex reconstruction                     //
 // AliESDVertexer is a class for full 3D primary vertex finding     //
-// derived classes: AliITSVertexerIons AliITSvertexer3D             //
-//                  AliITSVertexerCosmics                           //
+// derived classes: AliITSVertexerIons AliITSvertexerPPZ            //
+//                  AliITSVertexer3D                                //
 //////////////////////////////////////////////////////////////////////
 
 //______________________________________________________________________
@@ -112,12 +112,10 @@ void AliITSVertexer::FindMultiplicity(Int_t evnumber){
   Float_t *tht = new Float_t [notracks];
   Float_t *phi = new Float_t [notracks];
   Float_t *dphi = new Float_t [notracks];
-  Int_t *labels = new Int_t[notracks];
   for(Int_t i=0;iGetNTracklets();i++){
     tht[i] = multReco->GetTracklet(i)[0];
     phi[i] =  multReco->GetTracklet(i)[1];
     dphi[i] = multReco->GetTracklet(i)[2];
-    labels[i] = multReco->GetTracklet(i)[3];
   }
   Int_t nosingleclus=multReco->GetNSingleClusters();
   Float_t *ths = new Float_t [nosingleclus];
@@ -126,7 +124,7 @@ void AliITSVertexer::FindMultiplicity(Int_t evnumber){
     ths[i] = multReco->GetCluster(i)[0];
     phs[i] =  multReco->GetCluster(i)[1];
   }
-  fMult = new AliMultiplicity(notracks,tht,phi,dphi,labels,nosingleclus,ths,phs);
+  fMult = new AliMultiplicity(notracks,tht,phi,dphi,nosingleclus,ths,phs);
   delete [] tht;
   delete [] phi;
   delete [] dphi;
@@ -191,4 +189,3 @@ void AliITSVertexer::WriteCurrentVertex(){
   Int_t rc = itsLoader->PostVertex(fCurrentVertex);
   rc = itsLoader->WriteVertices();
 }
-
diff --git a/ITS/AliITSVertexerCosmics.cxx b/ITS/AliITSVertexerCosmics.cxx
deleted file mode 100644
index f4907a06e17..00000000000
--- a/ITS/AliITSVertexerCosmics.cxx
+++ /dev/null
@@ -1,224 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2007, 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.                  *
- **************************************************************************/
-
-#include 
-#include "AliLog.h"
-#include "AliESDVertex.h"
-#include "AliRunLoader.h"
-#include "AliITSLoader.h"
-#include "AliITSgeom.h"
-#include "AliITSRecPoint.h"
-#include "AliITSVertexerCosmics.h"
-#include "AliStrLine.h"
-
-//------------------------------------------------------------------------
-// This class implements a method to construct a "fake" primary
-// vertex for cosmic events in which the muon crosses the SPD inner
-// layer (SPD1). A fake primary vertex is needed for the reconstruction,
-// with e.g. AliITStrackerSA, of the two tracks produced by the muon 
-// in the ITS.
-//   We build pairs of clusters on SPD1 and define the fake vertex as
-// the mid-point of the straight line joining the two clusters.
-//   We reject the backgroung by requiring at least one clusters on SPD2
-// closer than fMaxDistOnSPD2 to the tracklet prolongation.
-//   We can reject (potentially pathological) events with the muon track
-// tangential to the SPD1 layer by the requiring the radial position of
-// the vertex to be smaller than fMaxVtxRadius.
-//   Due to background clusters, more than one vertex per event can 
-// be found. We consider the first found.
-//   The number of contributors set in the AliESDVertex object is the
-// number of vertices found in the event; if this number is <1, 
-// the procedure could not find a vertex position and by default 
-// the vertex coordinates are set to (0,0,0) with large errors (100,100,100)
-// Number of contributors = 0  --> No SPD1 tracklets matching criteria 
-// Number of contributors = -1 --> No SPD1 recpoints
-//
-// Origin: A.Dainese, andrea.dainese@lnl.infn.it
-//-------------------------------------------------------------------------
-
-ClassImp(AliITSVertexerCosmics)
-
-//-------------------------------------------------------------------------
-AliITSVertexerCosmics::AliITSVertexerCosmics():AliITSVertexer(),
-fFirstSPD1(0),
-fLastSPD1(0),
-fFirstSPD2(0),
-fLastSPD2(0),
-fMaxDistOnSPD2(0),
-fMaxVtxRadius(0),
-fMinDist2Vtxs(0)
-{
-  // Default constructor
-  SetSPD1Modules();
-  SetSPD2Modules();
-  SetMaxDistOnSPD2();
-  SetMaxVtxRadius();
-  SetMinDist2Vtxs();
-}
-//--------------------------------------------------------------------------
-AliESDVertex* AliITSVertexerCosmics::FindVertexForCurrentEvent(Int_t evnumber) 
-{
-  // Defines the AliESDVertex for the current event
-
-  fCurrentVertex = 0;
-  AliRunLoader *rl =AliRunLoader::GetRunLoader();
-  AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader");
-  AliITSgeom* geom = itsLoader->GetITSgeom();
-  itsLoader->LoadRecPoints();
-  rl->GetEvent(evnumber);
-
-  TTree *rpTree = itsLoader->TreeR();
-
-  TClonesArray *recpoints=new TClonesArray("AliITSRecPoint",10000);
-  rpTree->SetBranchAddress("ITSRecPoints",&recpoints);
-
-  Double_t xclspd1[100],yclspd1[100],zclspd1[100],modclspd1[100];
-  Int_t nclspd1stored=0;
-  Double_t xclspd2[100],yclspd2[100],zclspd2[100],modclspd2[100];
-  Int_t nclspd2stored=0;
-  Int_t nrecpoints,nrecpointsSPD1=0;
-
-  Double_t gc[3]={0.,0.,0.};
-  Double_t lc[3]={0.,0.,0.};
-  Int_t lay,lad,det; 
-
-  Double_t x[100],y[100],z[100],p1[3],p2[3],p3[3];
-  Int_t nvtxs;
-  Bool_t good,matchtospd2;
-  Double_t xvtx,yvtx,zvtx,rvtx;
-
-  for(Int_t imodule=fFirstSPD1; imoduleGetEvent(imodule);
-    geom->GetModuleId(imodule,lay,lad,det);
-    nrecpoints=recpoints->GetEntriesFast();
-    if(imoduleUncheckedAt(irp);
-      // Local coordinates of this recpoint
-      lc[0]=rp->GetDetLocalX();
-      lc[2]=rp->GetDetLocalZ();
-      geom->LtoG(imodule,lc,gc); // global coordinates
-      if(lay==1) { // store SPD1 clusters
-	xclspd1[nclspd1stored]=gc[0];
-	yclspd1[nclspd1stored]=gc[1];
-	zclspd1[nclspd1stored]=gc[2];
-	modclspd1[nclspd1stored]=imodule;
-	nclspd1stored++;
-      }
-      if(lay==2) { // store SPD2 clusters
-	xclspd2[nclspd2stored]=gc[0];
-	yclspd2[nclspd2stored]=gc[1];
-	zclspd2[nclspd2stored]=gc[2];
-	modclspd2[nclspd2stored]=imodule;
-	nclspd2stored++;
-      }
-      if(nclspd1stored>100 || nclspd2stored>100) 
-	AliFatal("More than 100 clusters per layer in SPD");
-    }// end clusters in a module
-  }// end SPD modules for a given event
-
-  // build fake vertices
-  nvtxs=0;
-  // SPD1 - first cluster
-  for(Int_t i1spd1=0; i1spd1fMaxVtxRadius) continue;
-      good = kTRUE;
-      for(Int_t iv=0; ivSetNContributors(nvtxs);
-  fCurrentVertex->SetTitle("cosmics fake vertex");
-
-  //if(nvtxs>0) fCurrentVertex->Print();
-
-  delete recpoints;
-  itsLoader->UnloadRecPoints();
-
-  return fCurrentVertex;
-}  
-//-------------------------------------------------------------------------
-void AliITSVertexerCosmics::FindVertices()
-{
-  // computes the vertices of the events in the range FirstEvent - LastEvent
-  AliRunLoader *rl = AliRunLoader::GetRunLoader();
-  AliITSLoader* itsLoader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
-  itsLoader->ReloadRecPoints();
-  for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
-    //  printf("Processing event %d\n",i);
-    rl->GetEvent(i);
-    FindVertexForCurrentEvent(i);
-    if(fCurrentVertex){
-      WriteCurrentVertex();
-    }
-  }
-}
-//-------------------------------------------------------------------------
-void AliITSVertexerCosmics::PrintStatus() const 
-{
-  // Print current status
-  printf("=======================================================\n");
-  printf(" fMaxDistOnSPD2: %f\n",fMaxDistOnSPD2);
-  printf(" fMaxVtxRadius:  %f\n",fMaxVtxRadius);
-  printf(" fMinDist2Vtxs:  %f\n",fMinDist2Vtxs);
-  printf(" First layer first and last modules: %d, %d\n",fFirstSPD1,fLastSPD1);
-  printf(" Second layer first and last modules: %d, %d\n",fFirstSPD2,fLastSPD2);
-  printf("=======================================================\n");
-}
-//-------------------------------------------------------------------------
diff --git a/ITS/AliITSVertexerCosmics.h b/ITS/AliITSVertexerCosmics.h
deleted file mode 100644
index 3136eaaf719..00000000000
--- a/ITS/AliITSVertexerCosmics.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef ALIITSVERTEXERCOSMICS_H
-#define ALIITSVERTEXERCOSMICS_H
-/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-//#include "AliESDVertex.h"
-#include "AliITSVertexer.h"
-
-//-----------------------------------------------------------------------
-//                                                                 
-// Class for constructing a fake primary vertex for cosmics events 
-//                                                                 
-// Origin: A.Dainese andrea.dainese@lnl.infn.it                    
-//-----------------------------------------------------------------------
-
-class AliESDVertex;
-
-class AliITSVertexerCosmics : public AliITSVertexer {
-
- public:
-
-  AliITSVertexerCosmics();
-  virtual ~AliITSVertexerCosmics() {}
-  AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb);
-  void FindVertices();
-  void PrintStatus() const;
-  void SetSPD1Modules(Int_t m1=0,Int_t m2=79) {fFirstSPD1 = m1; fLastSPD1 = m2;}
-  void SetSPD2Modules(Int_t m1=80, Int_t m2=239) {fFirstSPD2 = m1; fLastSPD2 = m2;}
-  void SetMaxDistOnSPD2(Double_t max=0.1) {fMaxDistOnSPD2=max;}
-  Double_t GetMaxDistOnSPD2() const {return fMaxDistOnSPD2;}
-  void SetMaxVtxRadius(Double_t maxr=3.5) {fMaxVtxRadius=maxr;}
-  Double_t GetMaVtxRadius() const {return fMaxVtxRadius;}
-  void SetMinDist2Vtxs(Double_t mind=0.1) {fMinDist2Vtxs=mind;}
-  Double_t GetMinDist2Vtxs() const {return fMinDist2Vtxs;}
-
- private:
-
-  Int_t fFirstSPD1;          // first module of the first pixel layer used
-  Int_t fLastSPD1;           // last module of the first pixel layer used
-  Int_t fFirstSPD2;          // first module of the second pixel layer used
-  Int_t fLastSPD2;           // last module of the second pixel layer used
-  Double_t fMaxDistOnSPD2;   // max dca between SPD1 tracklet and SPD2 cls
-  Double_t fMaxVtxRadius;    // maximum radial pos of vertex
-  Double_t fMinDist2Vtxs;    // minimum distance between two vertices
-
-  ClassDef(AliITSVertexerCosmics,1);
-};
-
-#endif
diff --git a/ITS/AliITSVertexerPPZ.cxx b/ITS/AliITSVertexerPPZ.cxx
new file mode 100644
index 00000000000..a49e4a707e6
--- /dev/null
+++ b/ITS/AliITSVertexerPPZ.cxx
@@ -0,0 +1,413 @@
+/**************************************************************************
+ * Copyright(c) 1998-2003, 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.                  *
+ **************************************************************************/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "AliITSDetTypeRec.h"
+#include "AliITSgeom.h"
+#include "AliITSLoader.h"
+#include "AliITSRecPoint.h"
+/////////////////////////////////////////////////////////////////////////
+//                                                                     //
+// This class is intended to compute the Z coordinate of the           //
+// primary vertex for p-p interactions, or in general when the         //
+// number of secondaries is too slow to use the class                  //
+// AliITSVertexerIons, which in turn is optimized for A-A collsions    //
+// Origin: masera@to.infn.it      9/12/2002                            //
+//                                                                     //
+/////////////////////////////////////////////////////////////////////////
+ClassImp(AliITSVertexerPPZ)
+
+
+
+//______________________________________________________________________
+AliITSVertexerPPZ::AliITSVertexerPPZ():AliITSVertexer(),
+fFirstL1(0),
+fLastL1(0),
+fFirstL2(0),
+fLastL2(0),
+fDiffPhiMax(0),
+fX0(0),
+fY0(0),
+fZFound(0),
+fZsig(0),
+fWindow(0){
+  // Default Constructor
+
+  SetDiffPhiMax(0);
+  SetFirstLayerModules(0);
+  SetSecondLayerModules(0);
+  //fITS = 0;
+  SetWindow(0);
+}
+
+AliITSVertexerPPZ::AliITSVertexerPPZ(TString fn, Float_t x0, Float_t y0):AliITSVertexer(fn),
+fFirstL1(0),
+fLastL1(0),
+fFirstL2(0),
+fLastL2(0),
+fDiffPhiMax(0),
+fX0(x0),
+fY0(y0),
+fZFound(0),
+fZsig(0),
+fWindow(0) {
+  // Standard constructor
+  SetDiffPhiMax();
+  fX0 = x0;
+  fY0 = y0;
+  SetFirstLayerModules();
+  SetSecondLayerModules();
+  //fITS = 0;
+  SetWindow();
+}
+
+//______________________________________________________________________
+AliITSVertexerPPZ::~AliITSVertexerPPZ() {
+  // Default Destructor
+  //fITS = 0;
+}
+
+//________________________________________________________
+void  AliITSVertexerPPZ::EvalZ(TH1F *hist,Int_t sepa, Int_t ncoinc, TArrayF *zval) {
+
+  //Evaluation of Z
+  Float_t deltaVal = hist->GetBinWidth(1)*fWindow; // max window in Z for searching
+  fZFound=0;
+  fZsig=0;
+  Int_t nN=0;
+  Int_t nbinNotZero=0;
+  Float_t totst = 0.;
+  Float_t totst2 = 0.;
+  Float_t curz = 0.;
+  for(Int_t i=1;i<=sepa;i++){
+    Float_t cont=hist->GetBinContent(i);
+    if(cont!=0)curz = hist->GetBinLowEdge(i)+0.5*hist->GetBinWidth(i);
+    totst+=cont;
+    totst2+=cont*cont;
+    nN++;
+    if(cont!=0)nbinNotZero++;
+  }
+  if(nbinNotZero==0){fZFound=-100; fZsig=-100; return;}
+  if(nbinNotZero==1){
+    fZFound = curz;
+    fZsig=0;
+    fCurrentVertex = new AliESDVertex(fZFound,fZsig,nbinNotZero);
+    return;
+  }
+  Float_t errsq = totst2/(nN-1)-totst*totst/nN/(nN-1);
+  if(errsq>=0){
+  totst2=TMath::Sqrt(errsq);
+  }
+  else {
+    Error("EvalZ","Negative variance: %d - %12.7f - %12.7f",nN,totst2,totst);
+    fZFound=-100; 
+    fZsig=-100;
+    return;
+  }
+  totst /= nN;
+  Float_t cut = totst+totst2*2.;
+  //  if(fDebug>1)cout<<"totst, totst2, cut: "<GetBinLowEdge(sepa); 
+  Float_t val2=hist->GetBinLowEdge(1);
+  Float_t valm = 0.;
+  Float_t zmax = 0.;
+  for(Int_t i=1;i<=sepa;i++){
+    Float_t cont=hist->GetBinContent(i);
+    if(cont>valm){
+      valm = cont;
+      zmax = hist->GetBinLowEdge(i)+0.5*hist->GetBinWidth(1);
+    }
+    if(cont>cut){
+      curz=hist->GetBinLowEdge(i);
+      if(curzval2)val2=curz;
+    }
+  }
+  val2+=hist->GetBinWidth(1);
+  if((val2-val1)>deltaVal){
+    val1 = zmax-deltaVal/2.;
+    val2 = zmax+deltaVal/2.;
+    //    if(fDebug>0)cout<<"val1 and val2 recomputed\n";
+  }
+  //  if(fDebug>0)cout<<"Values for Z finding: "<At(i);
+    if(zval2)continue;
+   
+    fZFound+=z;
+    fZsig+=z*z;
+    /*   weights defined by the curvature
+    Float_t wei = 1./curv->At(i);
+    fZFound+=z*wei;
+    fZsig+=wei;
+    */
+    nN++;
+  }
+  if(nN<1){fZFound=-110; fZsig=-110; return;}
+  if(nN==1){
+    fZsig = 0;
+    fCurrentVertex = new AliESDVertex(fZFound,fZsig,nN);
+    return;
+  }
+  errsq = (fZsig/(nN-1)-fZFound*fZFound/nN/(nN-1))/nN;
+  if(errsq>=0.){
+    fZsig=TMath::Sqrt(errsq);
+  }
+  else {
+    Error("evalZ","Negative variance: %d - %12.7f %12.7f",nN,fZsig,fZFound);
+    fZsig=0;
+  }
+  fZFound=fZFound/nN;
+  /* weights defined by the curvature
+  fZsig=1./fZsig;
+  fZFound*=fZsig;
+  fZsig = TMath::Sqrt(fZsig);
+  */
+  fCurrentVertex = new AliESDVertex(fZFound,fZsig,nN);
+}
+
+//______________________________________________________________________
+AliESDVertex* AliITSVertexerPPZ::FindVertexForCurrentEvent(Int_t evnumber){
+  // Defines the AliESDVertex for the current event
+  fCurrentVertex = 0;
+  fZFound = -999;
+  fZsig = -999;
+  AliRunLoader *rl =AliRunLoader::GetRunLoader();
+  AliITSLoader* iTSloader = (AliITSLoader*)rl->GetLoader("ITSLoader");
+  TDirectory * olddir = gDirectory;
+  rl->CdGAFile();
+  AliITSgeom* geom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
+  olddir->cd(); 
+
+  AliITSDetTypeRec detTypeRec;
+
+  if(!geom) {
+    Error("FindVertexForCurrentEvent","ITS geometry is not defined");
+    return fCurrentVertex;
+  }
+  TTree *tR=0;
+  TClonesArray *itsRec  = 0;
+  Float_t lc[3]; for(Int_t ii=0; ii<3; ii++) lc[ii]=0.;
+  Float_t gc[3]; for(Int_t ii=0; ii<3; ii++) gc[ii]=0.;
+  Float_t lc2[3]; for(Int_t ii=0; ii<3; ii++) lc2[ii]=0.;
+  Float_t gc2[3]; for(Int_t ii=0; ii<3; ii++) gc2[ii]=0.;
+
+  tR = iTSloader->TreeR();
+  if(!tR){
+    Error("FindVertexForCurrentEvent","TreeR not found");
+    return fCurrentVertex;
+  }
+  detTypeRec.SetTreeAddressR(tR);
+  itsRec = detTypeRec.RecPoints();
+  // missing
+  // TClonesArray dummy("AliITSRecPoint",10000), *clusters=&dummy;
+  TBranch *branch;
+  branch = tR->GetBranch("ITSRecPoints");
+  if(!branch){ 
+    branch = tR->GetBranch("ITSRecPointsF");
+  }
+  //}
+  if(!branch){
+   Error("FindVertexForCurrentEvent","branch for ITS rec points not found");
+   return fCurrentVertex;
+  }
+  Float_t zave=0;
+  Float_t rmszav=0;
+  Float_t zave2=0;
+  Int_t firipixe=0;
+  for(Int_t module= fFirstL1; module<=fLastL1;module++){
+    branch->GetEvent(module);
+    Int_t nrecp1 = itsRec->GetEntries();
+    for(Int_t i=0; iAt(i);
+      lc[0]=current->GetDetLocalX();
+      lc[2]=current->GetDetLocalZ();
+      geom->LtoG(module,lc,gc);
+      zave+=gc[2];
+      zave2+=gc[2]*gc[2];
+      firipixe++;
+    }
+    detTypeRec.ResetRecPoints();
+  }
+  if(firipixe>1){
+    rmszav=TMath::Sqrt(zave2/(firipixe-1)-zave*zave/firipixe/(firipixe-1));
+    zave=zave/firipixe;
+    //    if(fDebug>1)cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++++++\n Number of firing pixels: "<0){
+    cout<<"Z limits: "<GetBinWidth(1)*10000.<<" micron\n";
+  }
+  */
+  Int_t sizarr=100;
+  TArrayF *zval = new TArrayF(sizarr);
+  //  TArrayF *curv = new TArrayF(sizarr);
+  Int_t ncoinc=0;
+  for(Int_t module= fFirstL1; module<=fLastL1;module++){
+    //    if(fDebug>0)cout<<"processing module   "<GetEvent(module);
+    Int_t nrecp1 = itsRec->GetEntries();
+    TObjArray *poiL1 = new TObjArray(nrecp1);
+    for(Int_t i=0; iAddAt(itsRec->At(i),i);
+    detTypeRec.ResetRecPoints();
+    for(Int_t i=0; iAt(i);
+      lc[0]=current->GetDetLocalX();
+      lc[2]=current->GetDetLocalZ();
+      geom->LtoG(module,lc,gc);
+      gc[0]-=fX0;
+      gc[1]-=fY0;
+      Float_t r1=TMath::Sqrt(gc[0]*gc[0]+gc[1]*gc[1]);
+      Float_t phi1 = TMath::ATan2(gc[1],gc[0]);
+      if(phi1<0)phi1=2*TMath::Pi()+phi1;
+      //      if(fDebug>1)cout<<"module "<GetEvent(modul2);
+	Int_t nrecp2 = itsRec->GetEntries();
+	for(Int_t j=0; jAt(j);
+	  lc2[0]=recp->GetDetLocalX();
+	  lc2[2]=recp->GetDetLocalZ();
+	  geom->LtoG(modul2,lc2,gc2);
+	  gc2[0]-=fX0;
+	  gc2[1]-=fY0;
+	  Float_t r2=TMath::Sqrt(gc2[0]*gc2[0]+gc2[1]*gc2[1]);
+	  Float_t zr0=(r2*gc[2]-r1*gc2[2])/(r2-r1);
+	  Float_t phi2 = TMath::ATan2(gc2[1],gc2[0]);
+	  if(phi2<0)phi2=2.*TMath::Pi()+phi2;
+	  Float_t diff = TMath::Abs(phi2-phi1);
+	  if(diff>TMath::Pi())diff=2.*TMath::Pi()-diff;
+	  if(zr0>zlim1 && zr0Fill(zr0);
+	      zval->AddAt(zr0,ncoinc);
+	      /* uncomment these lines to use curvature as a weight
+	      Float_t cu = Curv(0.,0.,gc[0],gc[1],gc2[0],gc[1]);
+	      curv->AddAt(cu,ncoinc);
+	      */
+	      ncoinc++;
+	      if(ncoinc==(sizarr-1)){
+		sizarr+=100;
+		zval->Set(sizarr);
+		//uncomment next line to use curvature as weight
+		//		curv->Set(sizarr);
+	      }
+	    }
+	  }
+	}
+	detTypeRec.ResetRecPoints();
+      }
+    }
+    delete poiL1;
+  }         // loop on modules
+  /*
+  if(fDebug>0){
+    cout<SetName(name);
+    fCurrentVertex->SetTitle("vertexer: PPZ");
+  }
+
+  return fCurrentVertex;
+}
+
+//______________________________________________________________________
+void AliITSVertexerPPZ::FindVertices(){
+  // computes the vertices of the events in the range FirstEvent - LastEvent
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliITSLoader* iTSloader =  (AliITSLoader*) rl->GetLoader("ITSLoader");
+  iTSloader->ReloadRecPoints();
+  for(Int_t i=fFirstEvent;i<=fLastEvent;i++){
+    cout<<"Processing event "<GetEvent(i);
+    FindVertexForCurrentEvent(i);
+    if(fCurrentVertex){
+      WriteCurrentVertex();
+    }
+    else {
+      /*
+      if(fDebug>0){
+	cout<<"Vertex not found for event "<
+
+/////////////////////////////////////////////////////////////////////
+//                                                                 //
+// Class for primary vertex Z coordinate reconstruction            //
+// Optimized for p-p events (in general: low multiplicity events)  //
+//                                                                 //
+/////////////////////////////////////////////////////////////////////
+
+class TH1F; 
+class TArrayF;
+
+class AliITSVertexerPPZ : public AliITSVertexer {
+
+ public:
+  AliITSVertexerPPZ();
+  AliITSVertexerPPZ(TString fn, Float_t x0=0., Float_t y0=0.);  // standard constructor 
+  virtual ~AliITSVertexerPPZ(); // destructor
+  virtual AliESDVertex* FindVertexForCurrentEvent(Int_t event);
+  virtual void FindVertices();
+  virtual Float_t GetZFound() const {return fZFound;}
+  virtual Float_t GetZsig() const {return fZsig;}
+  virtual void PrintStatus() const;
+  virtual void SetDiffPhiMax(Float_t pm = 0.05){fDiffPhiMax = pm;}
+  virtual void SetFirstLayerModules(Int_t m1 = 0, Int_t m2 = 79){fFirstL1 = m1; fLastL1 = m2;}
+  virtual void SetSecondLayerModules(Int_t m1 = 80, Int_t m2 = 239){fFirstL2 = m1; fLastL2 = m2;}
+  virtual void SetWindow(Float_t w=3.){fWindow = w;}
+  static Float_t Curv(Double_t x1,Double_t y1, Double_t x2,Double_t y2,
+		       Double_t x3,Double_t y3); 
+
+
+ protected:
+  Int_t fFirstL1;          // first module of the first pixel layer
+  Int_t fLastL1;           // last module of the first pixel layer
+  Int_t fFirstL2;          // first module of the second pixel layer
+  Int_t fLastL2;           // last module of the second pixel layer
+  Float_t fDiffPhiMax;     // Maximum delta phi allowed among corr. pixels
+  Float_t fX0;             // Nominal x coordinate of the vertex
+  Float_t fY0;             // Nominal y coordinate of the vertex
+  //AliITS *fITS;            //! pointer to the AliITS object
+  Float_t fZFound;         //! found value for the current event
+  Float_t fZsig;           //! RMS of Z
+  Float_t fWindow;         // window width for Z search in mm (3 mm by def.)
+
+ private:
+  void EvalZ(TH1F *hist,Int_t sepa, Int_t ncoinc, TArrayF *zval);
+
+  ClassDef(AliITSVertexerPPZ,3);
+};
+
+#endif
diff --git a/ITS/AliITSgeom.cxx b/ITS/AliITSgeom.cxx
index 287e67870e6..f618ab4fca5 100644
--- a/ITS/AliITSgeom.cxx
+++ b/ITS/AliITSgeom.cxx
@@ -184,15 +184,13 @@ fShape(5,0)          // Array of shapes and detector information.
     //      Int_t itype   the type of transformation kept.
     //                    bit 0 => Standard GEANT
     //                    bit 1 => ITS tracking
-    //                    bit 2 => A change in the coordinate system 
-    //                    has been made. others are still to be defined 
-    //                    as needed.
-    //      Int_t nlayers The number of ITS layers also set the size of 
-    //                    the arrays
-    //      Int_t *nlads  an array of the number of ladders for each 
+    //                    bit 2 => A change in the coordinate system has been made.
+    //                    others are still to be defined as needed.
+    //      Int_t nlayers The number of ITS layers also set the size of the arrays
+    //      Int_t *nlads  an array of the number of ladders for each layer. This
+    //                    array must be nlayers long.
+    //      Int_t *ndets  an array of the number of detectors per ladder for each
     //                    layer. This array must be nlayers long.
-    //      Int_t *ndets  an array of the number of detectors per ladder
-    //                    for each layer. This array must be nlayers long.
     //      Int_t mods    The number of modules. Typically the sum of all the 
     //                    detectors on every layer and ladder.
     // Outputs:
@@ -212,15 +210,13 @@ void AliITSgeom::Init(Int_t itype,Int_t nlayers,const Int_t *nlads,
     //      Int_t itype   the type of transformation kept.
     //                    bit 0 => Standard GEANT
     //                    bit 1 => ITS tracking
-    //                    bit 2 => A change in the coordinate system 
-    //                    has been made. others are still to be defined 
-    //                    as needed.
-    //      Int_t nlayers The number of ITS layers also set the size of 
-    //                    the arrays
-    //      Int_t *nlads  an array of the number of ladders for each 
+    //                    bit 2 => A change in the coordinate system has been made.
+    //                    others are still to be defined as needed.
+    //      Int_t nlayers The number of ITS layers also set the size of the arrays
+    //      Int_t *nlads  an array of the number of ladders for each layer. This
+    //                    array must be nlayers long.
+    //      Int_t *ndets  an array of the number of detectors per ladder for each
     //                    layer. This array must be nlayers long.
-    //      Int_t *ndets  an array of the number of detectors per ladder 
-    //                    for each layer. This array must be nlayers long.
     //      Int_t mods    The number of modules. Typically the sum of all the 
     //                    detectors on every layer and ladder.
     // Outputs:
@@ -470,9 +466,8 @@ void AliITSgeom::WriteNewFile(const char *filename)const{
     *fp << ", kSDD=" << (Int_t) kSDD << ", kSSD=" << (Int_t) kSSD;
     *fp << ", kSSDp=" << (Int_t) kSSDp << ", and kSDDp=" << (Int_t) kSDDp;
     *fp << "*/" << endl;
-    *fp << "Version "<< fVersion.Length()<<" " << fVersion.Data() << endl;//
-                                                // This should be consistent
-                                                // with the geometry version.
+    *fp << "Version "<< fVersion.Length()<<" " << fVersion.Data() << endl;//This should be consistent
+                                           // with the geometry version.
     *fp << "fTrans " << fTrans << endl;
     *fp << "fNmodules " << fNmodules << endl;
     *fp << "fNlayers " << fNlayers << endl;
@@ -568,8 +563,8 @@ fShape(0,0)      // TObjArray of detector geom.
                &l,&a,&d,&x,&y,&z,&o,&p,&q,&r,&s,&t);
         if(l>lm) lm = l;
         if(l<1 || l>fNlayers) {
-            printf("error in file %s layer=%d min. is 1 max is %d"
-                   " Trying new format\n",filename,l,fNlayers);
+            printf("error in file %s layer=%d min. is 1 max is %d Trying new format\n",
+                   filename,l,fNlayers);
             fclose(pf);
             ReadNewFile(filename);
             return;
@@ -605,8 +600,8 @@ fShape(0,0)      // TObjArray of detector geom.
         sscanf(buff,"%d %d %d %f %f %f %f %f %f %f %f %f",
                &l,&a,&d,&x,&y,&z,&o,&p,&q,&r,&s,&t);
         if(l<1 || l>fNlayers) {
-            Warning("AliITSgeom","error in file %s layer=%d"
-                    " min. is 1 max is %d",filename,l,fNlayers);
+            Warning("AliITSgeom","error in file %s layer=%d min. is 1 max is %d",
+                   filename,l,fNlayers);
             continue;
         }// end if l
         id[0] = l;id[1] = a;id[2] = d;
@@ -634,19 +629,17 @@ fShape(0,0)      // TObjArray of detector geom.
     } // end while ever loop
     fclose(pf);
 }
+
 //______________________________________________________________________
-AliITSgeom::AliITSgeom(const AliITSgeom &source) : 
-TObject(source),
-fVersion(source.fVersion), // Transformation version.
-fTrans(source.fTrans),   // Flag to keep track of which transformation
-fNmodules(source.fNmodules),// The total number of modules
-fNlayers(source.fNlayers), // The number of layers.
-fNlad(source.fNlad),    // Array of the number of ladders/layer(layer)
-fNdet(source.fNdet),    // Array of the number of detector/ladder(layer)
-fGm(source.fGm.GetSize(),source.fGm.LowerBound()),// Structure of 
-                                                  // translation and rotation.
-fShape(source.fShape.GetSize(),source.fShape.LowerBound())// Array of shapes 
-                                                   // and detector information.
+AliITSgeom::AliITSgeom(const AliITSgeom &source) : TObject(source),
+fVersion(source.fVersion),
+fTrans(source.fTrans),
+fNmodules(source.fNmodules),
+fNlayers(source.fNlayers),
+fNlad(source.fNlad),
+fNdet(source.fNdet),
+fGm(source.fGm),
+fShape(source.fShape)
 {
     //     The copy constructor for the AliITSgeom class. It calls the
     // = operator function. See the = operator function for more details.
@@ -657,37 +650,11 @@ fShape(source.fShape.GetSize(),source.fShape.LowerBound())// Array of shapes
     //     none.
     // Return:
     //     none.
-    Int_t i,n;
 
-    n = source.fGm.GetLast()+1;
-    for(i=source.fGm.LowerBound();ifVersion  = source.fVersion;
     this->fTrans    = source.fTrans;
     this->fNmodules = source.fNmodules;
-    this->fNlayers  = source.fNlayers;
-    this->fNlad     = source.fNlad;
-    this->fNdet     = source.fNdet;
-    this->fGm.Expand(this->fNmodules);
-    for(i=source.fGm.LowerBound();ifNlayers = source.fNlayers;
+    this->fNlad.Set(fNlayers,source.fNlad.GetArray());
+    this->fNdet.Set(fNlayers,source.fNdet.GetArray());
     this->fShape.Expand(source.fShape.GetEntriesFast());
-    for(i=source.fShape.LowerBound();ifShape.AddAt(new TObject(*(source.fShape.At(i))),i);
+    this->fShape.SetOwner(kTRUE);
+    this->fGm.Expand(this->fNmodules);
+    this->fGm.SetOwner(kTRUE);
+    for(i=0;ifNmodules;i++)
+	if(i<0||i>=fGm.GetSize()){
+	    Error("ReadNewFile","i<0||i>=fGm.GetSize()=%d",
+		  i,fGm.GetSize());
+	    return *this;
+	} // end if
+        this->fGm.AddAt(new TObject(*(source.fGm.At(i))),i);
     return *this;
 }
+
 //______________________________________________________________________
 Int_t AliITSgeom::GetModuleIndex(Int_t lay,Int_t lad,Int_t det)const{
     //      This routine computes the module index number from the layer,
@@ -777,8 +731,7 @@ Int_t AliITSgeom::GetModuleIndex(Int_t lay,Int_t lad,Int_t det)const{
     return -1;
 }
 //______________________________________________________________________
-void AliITSgeom::GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det)
-const{
+void AliITSgeom::GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det)const{
     //      This routine computes the layer, ladder and detector number 
     // given the module index number. The number of ladders and detectors
     // per layer is determined when this geometry package is constructed,
@@ -892,8 +845,7 @@ Int_t AliITSgeom::GetStartDet(Int_t dtype)const{
     // This assumes that the detector types are different on different layers
     // and that they are not mixed up.
     // Inputs:
-    //    Int_t dtype A detector type number. 0 for SPD, 1 for SDD, 
-    //                and 2 for SSD.
+    //    Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD.
     // Outputs:
     //    none.
     // Return:
@@ -923,8 +875,7 @@ Int_t AliITSgeom::GetLastDet(Int_t dtype)const{
     // This assumes that the detector types are different on different layers
     // and that they are not mixed up.
     // Inputs:
-    //     Int_t dtype A detector type number. 0 for SPD, 1 for SDD, 
-    //                 and 2 for SSD.
+    //     Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD.
     // Outputs:
     // Return:
     //     the module index for the last occurrence of that detector type.
@@ -949,50 +900,6 @@ Int_t AliITSgeom::GetLastDet(Int_t dtype)const{
     return 0;
 }
 //______________________________________________________________________
-Bool_t AliITSgeom::IsInside(Int_t module,Double_t point[3])const{
-    // Determins if the give point is inside of the module as defined
-    // by this set of coordinate transforms.
-    // Inputs:
-    //    Int_t    module    The module to be checked
-    //    Double_t point[3]  A 3 vector global point
-    // Outputs:
-    //    none.
-    // Return:
-    //    kTRUE if point is inside of module, kFALSE otherwise.
-    Double_t l[3],dx,dy,dz;
-    AliITSDetector idet = (AliITSDetector)(this->GetGeomMatrix(module)->
-                                           GetDetectorIndex());
-
-    this->GtoL(module,point,l);
-    switch(idet){
-    case kSPD:{
-        AliITSgeomSPD *spd = (AliITSgeomSPD*)(fShape.At((Int_t)idet));
-        dx = spd->GetDx();
-        dy = spd->GetDy();
-        dz = spd->GetDz();}
-        break;
-    case kSDD: case kSDDp:{
-        AliITSgeomSDD *sdd = (AliITSgeomSDD*)(fShape.At((Int_t)idet));
-        dx = sdd->GetDx();
-        dy = sdd->GetDy();
-        dz = sdd->GetDz();}
-        break;
-    case kSSD: case kSSDp:{
-        AliITSgeomSSD *ssd = (AliITSgeomSSD*)(fShape.At((Int_t)idet));
-        dx = ssd->GetDx();
-        dy = ssd->GetDy();
-        dz = ssd->GetDz();}
-        break;
-    default: // Detector not defined.
-        return kFALSE;
-        break;
-    }// end switch
-    if(TMath::Abs(l[0])>dx) return kFALSE;
-    if(TMath::Abs(l[2])>dz) return kFALSE;
-    if(TMath::Abs(l[1])>dy) return kFALSE;
-    return kTRUE;
-}
-//______________________________________________________________________
 void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other)const{
     //     This function was primarily created for diagnostic reasons. It
     // print to a file pointed to by the file pointer fp the difference
@@ -1012,9 +919,8 @@ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other)const{
     // rather than zooming quickly past you on a screen. fprintf is used to
     // do the printing. The fShapeIndex difference is not printed at this time.
     // Inputs:
-    //    FILE *fp           A file pointer to an opened file for writing 
-    //                       in which the results of the comparison will 
-    //                       be written.
+    //    FILE *fp           A file pointer to an opened file for writing in which
+    //                       the results of the comparison will be written.
     //    AliITSgeom *other  The other AliITSgeom class to which this one is
     //                       being compared.
     // Outputs:
@@ -1078,9 +984,8 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det)const{
     // is given to the user. The output it written to the file pointed
     // to by the file pointer fp. This can be set to stdout if you want.
     // Inputs:
-    //     FILE *fp           A file pointer to an opened file for 
-    //                        writing in which the results of the 
-    //                        comparison will be written.
+    //     FILE *fp           A file pointer to an opened file for writing in which
+    //                        the results of the comparison will be written.
     //     Int_t lay          The layer number. Starting from 1.
     //     Int_t lad          The ladder number. Starting from 1.
     //     Int_t det          The detector number. Starting from 1.
@@ -1104,109 +1009,109 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det)const{
     return;
 }
 //______________________________________________________________________
-void AliITSgeom::PrintGeom(ostream *wb)const{
+ofstream & AliITSgeom::PrintGeom(ofstream &rb)const{
     //     Stream out an object of class AliITSgeom to standard output.
     // Intputs:
-    //     ofstream *wb    The output streaming buffer.
+    //     ofstream &rb    The output streaming buffer.
     // Outputs:
     //     none.
     // Return:
-    //     none.
+    //     ofstream &rb    The output streaming buffer.
     Int_t i,nshapes;
 
-    wb->setf(ios::scientific);
-    *wb << fTrans << " ";
-    *wb << fNmodules << " ";
-    *wb << fNlayers << " ";
-    for(i=0;i> fTrans >> fNmodules >> fNlayers;
+    rb >> fTrans >> fNmodules >> fNlayers;
     fNlad.Set(fNlayers);
     fNdet.Set(fNlayers);
-    for(i=0;i> fNlad[i];
-    for(i=0;i> fNdet[i];
+    for(i=0;i> fNlad[i];
+    for(i=0;i> fNdet[i];
     fGm.Expand(fNmodules);
     fGm.SetOwner(kTRUE);
     for(i=0;i=fGm.GetSize()){
 	    Error("ReadGeom","i<0||i>=fGm.GetSize()=%d",
 		  i,fGm.GetSize());
-	    return;
+	    return rb;
 	} // end if
         fGm.AddAt(new AliITSgeomMatrix,i);
-        *rb >> *(GetGeomMatrix(i));
+        rb >> *(GetGeomMatrix(i));
     } // end for i
-    *rb >> i;
+    rb >> i;
     fShape.Expand(i);
     fShape.SetOwner(kTRUE);
     for(i=0;i> j;
+        rb >> j;
         switch (j){
         case kSPD:{
             AliITSgeomSPD *s = new AliITSgeomSPD();
-            *rb >> *s;
+            rb >> *s;
             fShape.AddAt(s,kSPD);}
             break;
         case kSDD:{
             AliITSgeomSDD *s = new AliITSgeomSDD();
-            *rb >> *s;
+            rb >> *s;
             fShape.AddAt(s,kSDD);}
             break;
         case kSSD:{
             AliITSgeomSSD *s = new AliITSgeomSSD();
-            *rb >> *s;
+            rb >> *s;
             fShape.AddAt(s,kSSD);}
             break;
         case kSSDp:{
             AliITSgeomSSD *s = new AliITSgeomSSD();
-            *rb >> *s;
+            rb >> *s;
             fShape.AddAt(s,kSSDp);}
             break;
         case kSDDp:{
             AliITSgeomSDD *s = new AliITSgeomSDD();
-            *rb >> *s;
+            rb >> *s;
             fShape.AddAt(s,kSDDp);}
             break;
         } // end  switch
     } //  end for i
-    return;
+    return rb;
 }
 //______________________________________________________________________
 //     The following routines modify the transformation of "this"
@@ -1230,8 +1135,8 @@ void AliITSgeom::GlobalChange(const Float_t *tran,const Float_t *rot){
     // respect to the beam line, except for an effective rotation about the
     // beam axis which will just rotate the ITS as a hole about the beam axis.
     // Intputs:
-    //     Float_t *tran   A 3 element array representing the global 
-    //                     translations. the elements are x,y,z in cm.
+    //     Float_t *tran   A 3 element array representing the global translations.
+    //                     the elements are x,y,z in cm.
     //     Float_t *rot    A 3 element array representing the global rotation
     //                     angles about the three axis x,y,z in radians
     // Outputs:
@@ -1279,9 +1184,8 @@ void AliITSgeom::GlobalCylindericalChange(const Float_t *tran,
     // line, except for an effective rotation about the beam axis which will
     // just rotate the ITS as a hole about the beam axis.
     // Intputs:
-    //     Float_t *tran   A 3 element array representing the global 
-    //                     translations. the elements are r,theta,z in 
-    //                     cm/radians.
+    //     Float_t *tran   A 3 element array representing the global translations.
+    //                     the elements are r,theta,z in cm/radians.
     //     Float_t *rot    A 3 element array representing the global rotation
     //                     angles about the three axis x,y,z in radians
     // Outputs:
@@ -1323,12 +1227,10 @@ void AliITSgeom::RandomChange(const Float_t *stran,const Float_t *srot){
     // x y and z translations, and the three element array srot,
     // for the three rotation about the axis x y and z.
     // Intputs:
-    //     Float_t *stran  A 3 element array representing the global 
-    //                     translations variances. The elements are x,
-    //                     y,z in cm.
+    //     Float_t *stran  A 3 element array representing the global translations
+    //                     variances. The elements are x,y,z in cm.
     //     Float_t *srot   A 3 element array representing the global rotation
-    //                     angles variances about the three axis x,y,z in 
-    //                     radians.
+    //                     angles variances about the three axis x,y,z in radians.
     // Outputs:
     //     none.
     // Return:
@@ -1363,12 +1265,10 @@ void AliITSgeom::RandomCylindericalChange(const Float_t *stran,
     // in detector position allow for the simulation of a random uncertainty
     // in the detector positions of the ITS.
     // Intputs:
-    //     Float_t *stran  A 3 element array representing the global 
-    //                     translations variances. The elements are r,
-    //                     theta,z in cm/radians.
+    //     Float_t *stran  A 3 element array representing the global translations
+    //                     variances. The elements are r,theta,z in cm/radians.
     //     Float_t *srot   A 3 element array representing the global rotation
-    //                     angles variances about the three axis x,y,z in 
-    //                     radians.
+    //                     angles variances about the three axis x,y,z in radians.
     // Outputs:
     //     none.
     // Return:
@@ -1582,83 +1482,31 @@ Double_t AliITSgeom::GetAverageRadiusOfLayer(Int_t layer,Double_t &range)const{
     return r;
 }
 //_______________________________________________________________________
-void AliITSgeom::DetLToTrackingV2(Int_t md,Float_t xin,Float_t zin,
-                                  Float_t &yout,Float_t &zout) {
+void AliITSgeom::DetLToTrackingV2(Int_t md, Float_t xin, Float_t zin, Float_t &yout, Float_t &zout) {
 
-    //Conversion from local coordinates on detectors to local
-    //coordinates used for tracking ("v2")
-    // Inputs:
-    //   Int_t   md      Module number
-    //   Float_t xin     Standard local coordinate x
-    //   Float_t zin     Standard local coordinate z
-    // Output:
-    //   Float_t yout    Tracking local coordinate y
-    //   Float_t zout    Tracking local coordinate z
-    // Return:
-    //   none.
-    Float_t x,y,z;
-    Double_t rt[9],al;
-
-    GetTrans(md,x,y,z);
-    GetRotMatrix(md,rt);
-    al = TMath::ATan2(rt[1],rt[0])+TMath::Pi();
-    yout = -(-xin+(x*((Float_t)TMath::Cos(al))+y*((Float_t)TMath::Sin(al))));
-    if(md<(GetModuleIndex(2,1,1))) yout *= -1; 
-    zout = -zin+z; 
+  //Conversion from local coordinates on detectors to local
+  //coordinates used for tracking ("v2")
+  Float_t x,y,z; 
+  Double_t rt[9];
+  GetTrans(md,x,y,z);
+  GetRotMatrix(md,rt);
+  Double_t al=TMath::ATan2(rt[1],rt[0])+TMath::Pi();
+  yout=-(-xin+(x*TMath::Cos(al)+y*TMath::Sin(al)));
+  if ( md<(GetModuleIndex(2,1,1)) ) yout*=-1; 
+  zout=-zin+(Double_t)z; 
 }
-//_______________________________________________________________________
-void AliITSgeom::TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,
-                                  Float_t &xout,Float_t &zout) {
-    //Conversion from local coordinates used for tracking ("v2") to
-    //local detector coordinates  
-    // Inputs:
-    //   Int_t   md      Module number
-    //   Float_t yin     Tracking local coordinate y
-    //   Float_t zin     Tracking local coordinate z
-    // Output:
-    //   Float_t xout    Standard local coordinate x
-    //   Float_t zout    Standard local coordinate z
-    // Return:
-    //   none.
-    Float_t x,y,z;
-    Double_t rt[9],al;
 
-    GetTrans(md,x,y,z);
-    GetRotMatrix(md,rt);
-    al = TMath::ATan2(rt[1],rt[0])+TMath::Pi();
-    xout = yin;
-    if(md<(GetModuleIndex(2,1,1))) xout = -xout;
-    xout += (x*((Float_t)TMath::Cos(al))+y*((Float_t)TMath::Sin(al)));
-    zout  = -zin+z; 
-}
-//----------------------------------------------------------------------
-ostream &operator<<(ostream &os,AliITSgeom &p){
-    // Standard output streaming function.
-    // Inputs:
-    //   ostream    os   The output stream
-    //   AliITSgeom p    The AliITSgeom class to be printed out
-    // Outputs:
-    //   none.
-    // Return:
-    //   The input stream
-
-    p.PrintGeom(&os);
-    return os;
-}
-//----------------------------------------------------------------------
-istream &operator>>(istream &is,AliITSgeom &r){
-    // Standard input streaming function.
-    // Inputs:
-    //   istream    is  The input stream
-    //   AliITSgeom p   The AliITSgeom class to be filled from this 
-    //                  input stream
-    // Outputs:
-    //   none.
-    // Return:
-    //   The input stream
-
-    r.ReadGeom(&is);
-    return is;
+//_______________________________________________________________________
+void AliITSgeom::TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,Float_t &xout,Float_t &zout) {
+  //Conversion from local coordinates used for tracking ("v2") to
+  //local detector coordinates
+  
+  Float_t x,y,z; Double_t rt[9];
+  GetTrans(md,x,y,z);
+  GetRotMatrix(md,rt);
+  Double_t al=TMath::ATan2(rt[1],rt[0])+TMath::Pi();
+  xout=yin;
+  if( md<(GetModuleIndex(2,1,1)) ) xout=-xout;
+  xout+=(x*TMath::Cos(al)+y*TMath::Sin(al));
+  zout=-zin+(Double_t)z; 
 }
-//----------------------------------------------------------------------
-
diff --git a/ITS/AliITSgeom.h b/ITS/AliITSgeom.h
index 470d396cfd0..e05028e3e0f 100644
--- a/ITS/AliITSgeom.h
+++ b/ITS/AliITSgeom.h
@@ -24,7 +24,8 @@
 #include 
 #include 
 #include 
-//
+
+
 #include "AliITSgeomMatrix.h"
 
 typedef enum {kND=-1,kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4} AliITSDetector;
@@ -75,16 +76,10 @@ class AliITSgeom : public TObject {
     //
     //     This function returns a pointer to the particular AliITSgeomMatrix
     // class for a specific module index.
-    AliITSgeomMatrix *GetGeomMatrix(Int_t index){if(index=0)
-        return (AliITSgeomMatrix*)(fGm.At(index));else 
-            Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",
-                  index,fGm.GetSize());return 0;}
-    AliITSgeomMatrix *GetGeomMatrix(Int_t index)const{if(index=0)
-        return (AliITSgeomMatrix*)(fGm.At(index));else 
-            Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",
-                  index,fGm.GetSize());return 0;}
+    AliITSgeomMatrix *GetGeomMatrix(Int_t index){if(index=0)
+        return (AliITSgeomMatrix*)(fGm.At(index));else Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",index,fGm.GetSize());return 0;}
+    AliITSgeomMatrix *GetGeomMatrix(Int_t index)const{if(index=0)
+        return (AliITSgeomMatrix*)(fGm.At(index));else Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",index,fGm.GetSize());return 0;}
     // This function find and return the number of detector types only.
     Int_t GetNDetTypes()const{Int_t max;return GetNDetTypes(max);};
     // This function find and return the number of detector types and the
@@ -249,9 +244,6 @@ class AliITSgeom : public TObject {
     void  SetRotMatrix(Int_t index,Double_t *mat){Double_t rot[3][3];
           for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) rot[i][j]=mat[3*i+j];
           GetGeomMatrix(index)->SetMatrix(rot);}
-    // Return the normal for a specific module
-    void GetGlobalNormal(Int_t index,Double_t n[3]){
-        GetGeomMatrix(index)->GetGlobalNormal(n[0],n[1],n[2]);}
     //
     //     Will define fShape if it isn't already defined.
     void DefineShapes(Int_t size=5){fShape.Expand(size);}
@@ -280,9 +272,6 @@ class AliITSgeom : public TObject {
     // AliITSgeomSDD, or AliITSgeomSSD, for example.
     virtual TObject *GetShape(Int_t lay,Int_t lad,Int_t det)
         {return GetShape(GetModuleIndex(lay,lad,det));}
-    //     Determine if a give point is inside of a detectors sensitive
-    // volume (as defined by these transformations).
-    virtual Bool_t IsInside(Int_t module,Double_t point[3])const;
     //
     //  Setters
     //     Sets the rotation angles and matrix for a give module index
@@ -581,8 +570,8 @@ class AliITSgeom : public TObject {
     // Global coordinate system for the detector id[3].
     // The global and local coordinate are given in two Double point
     // arrays g[3], and l[3].
-    void LtoGMomentumTracking(const Int_t *id,const Double_t *l,Double_t *g)
-        const{LtoGMomentumTracking(GetModuleIndex(id),l,g);}
+    void LtoGMomentumTracking(const Int_t *id,const Double_t *l,Double_t *g)const{
+        LtoGMomentumTracking(GetModuleIndex(id),l,g);}
     //     Transforms of momentum types of quantities from the detector
     // local coordinate system (used for ITS tracking) to the ALICE
     // Global coordinate system for the detector layer ladder and detector
@@ -603,8 +592,8 @@ class AliITSgeom : public TObject {
     // to another detector local coordinate system for the detector
     // id1[3] to the detector id2[3]. The local coordinates are given
     // in two Double point arrays l1[3], and l2[3].
-    void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2)
-        const{LtoL(GetModuleIndex(id1[0],id1[1],id1[2]),
+    void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2)const{
+        LtoL(GetModuleIndex(id1[0],id1[1],id1[2]),
               GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);}
     //
     //     Transforms from one detector local coordinate system (used for
@@ -667,8 +656,7 @@ class AliITSgeom : public TObject {
     // system. The specific detector is determined by the module index
     // number.
     void GtoLErrorMatrix(Int_t index,const Double_t **g,Double_t **l)const{
-        GetGeomMatrix(index)->GtoLPositionError(
-            (Double_t (*)[3])g,(Double_t (*)[3])l);}
+        GetGeomMatrix(index)->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);}
     //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // the ALICE Global coordinate system to a detector local coordinate
@@ -686,18 +674,7 @@ class AliITSgeom : public TObject {
     // system. The specific detector is determined by the module index
     // number.
     void LtoGErrorMatrix(Int_t index,const Double_t **l,Double_t **g)const{
-        GetGeomMatrix(index)->LtoGPositionError(
-            (Double_t (*)[3])l,(Double_t (*)[3])g);}
-    //
-    //     Transforms a matrix, like an Uncertainty or Error matrix from
-    // the detector local coordinate system to a ALICE Global coordinate
-    // system. The specific detector is determined by the module index
-    // number.
-    void LtoGErrorMatrix(Int_t index,const Double_t l[3][3],Double_t g[3][3])
-        const{
-        GetGeomMatrix(index)->LtoGPositionError(
-            (Double_t (*)[3])l,(Double_t (*)[3])g);}
-
+        GetGeomMatrix(index)->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);}
     //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // the detector local coordinate system (used by ITS tracking) to a
@@ -705,21 +682,10 @@ class AliITSgeom : public TObject {
     // by the module index number.
     void LtoGErrorMatrixTracking(Int_t index,const Double_t **l,
                                  Double_t **g)const{
-        if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError(
-            (Double_t (*)[3])g,(Double_t (*)[3])l);
-        else GetGeomMatrix(index)->LtoGPositionErrorTracking(
-            (Double_t (*)[3])l,(Double_t (*)[3])g);}
-    //
-    //     Transforms a matrix, like an Uncertainty or Error matrix from
-    // the detector local coordinate system (used by ITS tracking) to a
-    // ALICE Global coordinate system. The specific detector is determined
-    // by the module index number.
-    void LtoGErrorMatrixTracking(Int_t index,const Double_t l[3][3],
-                                 Double_t g[3][3])const{
-        if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError(
-            (Double_t (*)[3])g,(Double_t (*)[3])l);
-        else GetGeomMatrix(index)->LtoGPositionErrorTracking(
-            (Double_t (*)[3])l,(Double_t (*)[3])g);}
+        if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError((
+                                   Double_t (*)[3])g,(Double_t (*)[3])l);
+        else GetGeomMatrix(index)->LtoGPositionErrorTracking((Double_t (*)[3])l,
+                                                          (Double_t (*)[3])g);}
     //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // one detector local coordinate system to another detector local
@@ -778,9 +744,7 @@ class AliITSgeom : public TObject {
     void RandomCylindericalChange(const Float_t *stran,const Float_t *srot);
     // This function converts these transformations from Alice global and
     // local to Tracking global and local.
-    //
-    // This converts the geometry
-    void GeantToTracking(const AliITSgeom &source);
+    void GeantToTracking(const AliITSgeom &source); // This converts the geometry
     //  Other routines.
     // This routine prints, to a file, the difference between this class
     // and "other".
@@ -789,18 +753,17 @@ class AliITSgeom : public TObject {
     void PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det)const;
     // This function prints out this class in a single stream. This steam
     // can be read by ReadGeom.
-    void PrintGeom(ostream *out)const;
+    ofstream &PrintGeom(ofstream &out)const;
     // This function reads in that single steam printed out by PrintGeom.
-    void ReadGeom(istream *in);
+    ifstream &ReadGeom(ifstream &in);
 
     //Conversion from det. local coordinates to local ("V2") coordinates
     //used for tracking
 
-    void DetLToTrackingV2(Int_t md,Float_t xin,Float_t zin,
-                          Float_t &yout, Float_t &zout); 
+    void DetLToTrackingV2(Int_t md, Float_t xin, Float_t zin, Float_t &yout, Float_t &zout); 
+
+    void TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,Float_t &xout,Float_t &zout);
 
-    void TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,
-                          Float_t &xout,Float_t &zout);
 
  private:
     TString    fVersion; // Transformation version.
@@ -813,9 +776,6 @@ class AliITSgeom : public TObject {
     TObjArray  fShape;   // Array of shapes and detector information.
 
     ClassDef(AliITSgeom,3) // ITS geometry class
-}; 
-// Input and output function for standard C++ input/output.
-ostream& operator<<(ostream &os,AliITSgeom &source);
-istream& operator>>(istream &os,AliITSgeom &source);
+};
 
 #endif
diff --git a/ITS/AliITSgeomMatrix.cxx b/ITS/AliITSgeomMatrix.cxx
index 0f633204a5d..99cb5436cd9 100644
--- a/ITS/AliITSgeomMatrix.cxx
+++ b/ITS/AliITSgeomMatrix.cxx
@@ -47,7 +47,7 @@
 ClassImp(AliITSgeomMatrix)
 //----------------------------------------------------------------------
 AliITSgeomMatrix::AliITSgeomMatrix():
-TObject(),         // Base Class.
+TObject(),
 fDetectorIndex(0), // Detector type index (like fShapeIndex was)
 fid(),       // layer, ladder, detector numbers.
 frot(),      //! vector of rotations about x,y,z [radians].
@@ -84,21 +84,17 @@ fPath(){     // Path in geometry to this module
 	fid[i] = 0;
 	frot[i] = ftran[i] = 0.0;
 	for(j=0;j<3;j++) fm[i][j] = 0.0;
+	fCylR = fCylPhi = 0.0;
     }// end for i
     fm[0][0] = fm[1][1] = fm[2][2] = 1.0;
 }
 
 //----------------------------------------------------------------------
 AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &source) : 
-TObject(source),         // Base Class.
-fDetectorIndex(source.fDetectorIndex),// Detector type index (like 
-                                      // fShapeIndex was)
-fid(),       // layer, ladder, detector numbers.
-frot(),      //! vector of rotations about x,y,z [radians].
-ftran(),     // Translation vector of module x,y,z.
-fCylR(source.fCylR),  //! R Translation in Cylinderical coordinates
-fCylPhi(source.fCylPhi),//! Phi Translation vector in Cylindrical coord.
-fm(),        // Rotation matrix based on frot.
+TObject(source),
+fDetectorIndex(source.fDetectorIndex),
+fCylR(source.fCylR),
+fCylPhi(source.fCylPhi),
 fPath(source.fPath){
     // The standard Copy constructor. This make a full / proper copy of
     // this class.
@@ -108,14 +104,13 @@ fPath(source.fPath){
     //    none.
     // Return:
     //    A copy constructes AliITSgeomMatrix class.
-    Int_t i,j;
-
-    for(i=0;i<3;i++){
-        this->fid[i]     = source.fid[i];
-        this->frot[i]    = source.frot[i];
-        this->ftran[i]   = source.ftran[i];
-        for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
-    }// end for i
+	Int_t i,j;
+	for(i=0;i<3;i++){
+		this->fid[i]     = source.fid[i];
+		this->frot[i]    = source.frot[i];
+		this->ftran[i]   = source.ftran[i];
+		for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
+	}// end for i
 }
 //----------------------------------------------------------------------
 AliITSgeomMatrix& AliITSgeomMatrix::operator=(const AliITSgeomMatrix &source){
@@ -129,26 +124,27 @@ AliITSgeomMatrix& AliITSgeomMatrix::operator=(const AliITSgeomMatrix &source){
     //    none.
     // Return:
     //    A copy of the source AliITSgeomMatrix class.
+  if(this == &source)return *this;
+  Int_t i,j;
 
-    if(this == &source)return *this;
-    Int_t i,j;
+  this->fDetectorIndex = source.fDetectorIndex;
+  this->fCylR      = source.fCylR;
+  this->fCylPhi    = source.fCylPhi;
+  for(i=0;i<3;i++){
+    this->fid[i]     = source.fid[i];
+    this->frot[i]    = source.frot[i];
+    this->ftran[i]   = source.ftran[i];
 
-    this->fDetectorIndex = source.fDetectorIndex;
-    this->fCylR      = source.fCylR;
-    this->fCylPhi    = source.fCylPhi;
-    for(i=0;i<3;i++){
-        this->fid[i]     = source.fid[i];
-        this->frot[i]    = source.frot[i];
-        this->ftran[i]   = source.ftran[i];
-        for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
-    } // end for i
-    this->fPath   = source.fPath;
-    return *this;
+    for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
+  }
+  this->fPath   = source.fPath;
+  return *this;
 }
+
 //----------------------------------------------------------------------
 AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt,const Int_t id[3],
                         const Double_t rot[3],const Double_t tran[3]):
-TObject(),           // Base class
+TObject(),
 fDetectorIndex(idt), // Detector type index (like fShapeIndex was)
 fid(),       // layer, ladder, detector numbers.
 frot(),      //! vector of rotations about x,y,z [radians].
@@ -196,7 +192,7 @@ fPath(){     // Path in geometry to this moduel
 AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt, const Int_t id[3],
                                    Double_t matrix[3][3],
                                    const Double_t tran[3]):
-TObject(),            // Base class
+TObject(),
 fDetectorIndex(idt), // Detector type index (like fShapeIndex was)
 fid(),       // layer, ladder, detector numbers.
 frot(),      //! vector of rotations about x,y,z [radians].
@@ -330,15 +326,11 @@ void AliITSgeomMatrix::MatrixFromSixAngles(const Double_t *ang){
 AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/,
                                    Int_t idt,const Int_t id[3],
                                    const Double_t tran[3]):
-TObject(),            // Base class
-fDetectorIndex(idt), // Detector type index (like fShapeIndex was)
-fid(),       // layer, ladder, detector numbers.
-frot(),      //! vector of rotations about x,y,z [radians].
-ftran(),     // Translation vector of module x,y,z.
-fCylR(0.0),  //! R Translation in Cylinderical coordinates
-fCylPhi(0.0),//! Phi Translation vector in Cylindrical coord.
-fm(),        // Rotation matrix based on frot.
-fPath(){     // Path in geometry to this module
+TObject(),
+fDetectorIndex(idt),
+fCylR(0.),
+fCylPhi(0.),
+fPath(){
     // This is a constructor for the AliITSgeomMatrix class. The matrix 
     // is defined by the 6 GEANT 3.21 rotation angles [degrees], and 
     // the translation vector tran [cm]. In addition the layer, ladder, 
@@ -370,6 +362,7 @@ fPath(){     // Path in geometry to this module
     if(fCylPhi<0.0) fCylPhi += TMath::Pi();
     this->MatrixFromSixAngles(rotd);
 }
+
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::AngleFromMatrix(){
     // Computes the angles from the rotation matrix up to a phase of 
@@ -399,6 +392,7 @@ void AliITSgeomMatrix::AngleFromMatrix(){
     frot[2] = rz;
     return;
 }
+
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::MatrixFromAngle(){
     // Computes the Rotation matrix from the angles [radians] kept in this
@@ -417,57 +411,23 @@ void AliITSgeomMatrix::MatrixFromAngle(){
     //   none
     // Return:
     //   none
-    Double_t sx,sy,sz,cx,cy,cz;
+   Double_t sx,sy,sz,cx,cy,cz;
 
-    sx = TMath::Sin(frot[0]); cx = TMath::Cos(frot[0]);
-    sy = TMath::Sin(frot[1]); cy = TMath::Cos(frot[1]);
-    sz = TMath::Sin(frot[2]); cz = TMath::Cos(frot[2]);
-    fm[0][0] = +cz*cy;             // fr[0]
-    fm[0][1] = +cz*sy*sx - sz*cx;  // fr[1]
-    fm[0][2] = +cz*sy*cx + sz*sx;  // fr[2]
-    fm[1][0] = +sz*cy;             // fr[3]
-    fm[1][1] = +sz*sy*sx + cz*cx;  // fr[4]
-    fm[1][2] = +sz*sy*cx - cz*sx;  // fr[5]
-    fm[2][0] = -sy;                // fr[6]
-    fm[2][1] = +cy*sx;             // fr[7]
-    fm[2][2] = +cy*cx;             // fr[8]
-}
-//----------------------------------------------------------------------
-void AliITSgeomMatrix::SetEulerAnglesChi(const Double_t ang[3]){
-    // Computes the Rotation matrix from the Euler angles [radians], 
-    // Chi-convention, kept in this class. The matrix used in 
-    // AliITSgeomMatrix::SetEulerAnglesChi and 
-    // its inverse AliITSgeomMatrix::GetEulerAnglesChi() are defined in 
-    // the following ways, R = Rb*Rc*Rd (M=R*L+T) where
-    //     C2 +S2  0       1  0    0       C0 +S0  0
-    // Rb=-S2  C2  0  Rc=  0  C1 +S1   Rd=-S0  C0  0
-    //     0   0   1       0 -S1  C1       0   0   1
-    // This form is taken from Wolfram Research's Geometry>
-    // Transformations>Rotations web page (also should be
-    // found in their book).
-    // Inputs:
-    //   Double_t ang[3] The three Euler Angles Phi, Theta, Psi
-    // Outputs:
-    //   none
-    // Return:
-    //   none
-    Double_t s0,s1,s2,c0,c1,c2;
+   sx = TMath::Sin(frot[0]); cx = TMath::Cos(frot[0]);
+   sy = TMath::Sin(frot[1]); cy = TMath::Cos(frot[1]);
+   sz = TMath::Sin(frot[2]); cz = TMath::Cos(frot[2]);
+   fm[0][0] = +cz*cy;             // fr[0]
+   fm[0][1] = +cz*sy*sx - sz*cx;  // fr[1]
+   fm[0][2] = +cz*sy*cx + sz*sx;  // fr[2]
+   fm[1][0] = +sz*cy;             // fr[3]
+   fm[1][1] = +sz*sy*sx + cz*cx;  // fr[4]
+   fm[1][2] = +sz*sy*cx - cz*sx;  // fr[5]
+   fm[2][0] = -sy;                // fr[6]
+   fm[2][1] = +cy*sx;             // fr[7]
+   fm[2][2] = +cy*cx;             // fr[8]
 
-    s0 = TMath::Sin(ang[0]); c0 = TMath::Cos(ang[0]);
-    s1 = TMath::Sin(ang[1]); c1 = TMath::Cos(ang[1]);
-    s2 = TMath::Sin(ang[2]); c2 = TMath::Cos(ang[2]);
-    fm[0][0] = +c2*c0-c1*s0*s2;  // fr[0]
-    fm[0][1] = +c2*s0+c1*c0*s2;  // fr[1]
-    fm[0][2] = +s2*s1;           // fr[2]
-    fm[1][0] = -s2*c0-c1*s0*c2;  // fr[3]
-    fm[1][1] = -s2*s0+c1*c0*c2;  // fr[4]
-    fm[1][2] = +c2*s1;           // fr[5]
-    fm[2][0] = s1*s0;            // fr[6]
-    fm[2][1] = -s1*c0;           // fr[7]
-    fm[2][2] = +c1;              // fr[8]
-    AngleFromMatrix();
-    return ;
 }
+
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]) const {
     // Returns the local coordinates given the global coordinates [cm].
@@ -479,16 +439,16 @@ void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]) const {
     //                  detector coordiante system
     // Return:
     //   none
-    Int_t    i,j;
-    Double_t g[3];
+	Int_t    i,j;
+	Double_t g[3];
 
-    for(i=0;i<3;i++) g[i] = g0[i] - ftran[i];
-    for(i=0;i<3;i++){
-        l[i] = 0.0;
-        for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
-        // g = R l + translation
-    } // end for i
-    return;
+	for(i=0;i<3;i++) g[i] = g0[i] - ftran[i];
+	for(i=0;i<3;i++){
+		l[i] = 0.0;
+		for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
+		// g = R l + translation
+	} // end for i
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::LtoGPosition(const Double_t l[3],Double_t g[3]) const {
@@ -501,15 +461,15 @@ void AliITSgeomMatrix::LtoGPosition(const Double_t l[3],Double_t g[3]) const {
     //                   Global coordinate system
     // Return:
     //   none.
-    Int_t    i,j;
+	Int_t    i,j;
 
-    for(i=0;i<3;i++){
-        g[i] = 0.0;
-        for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
-        g[i] += ftran[i];
-        // g = R^t l + translation
-    } // end for i
-    return;
+	for(i=0;i<3;i++){
+		g[i] = 0.0;
+		for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
+		g[i] += ftran[i];
+		// g = R^t l + translation
+	} // end for i
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::GtoLMomentum(const Double_t g[3],Double_t l[3]) const{
@@ -524,14 +484,14 @@ void AliITSgeomMatrix::GtoLMomentum(const Double_t g[3],Double_t l[3]) const{
     //                 local coordinate system
     // Return:
     //   none.
-    Int_t    i,j;
+	Int_t    i,j;
 
-    for(i=0;i<3;i++){
-        l[i] = 0.0;
-        for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
-        // g = R l
-    } // end for i
-    return;
+	for(i=0;i<3;i++){
+		l[i] = 0.0;
+		for(j=0;j<3;j++) l[i] += fm[i][j]*g[j];
+		// g = R l
+	} // end for i
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::LtoGMomentum(const Double_t l[3],Double_t g[3]) const {
@@ -546,14 +506,14 @@ void AliITSgeomMatrix::LtoGMomentum(const Double_t l[3],Double_t g[3]) const {
     //                 coordinate system
     // Return:
     //   none.
-    Int_t    i,j;
+	Int_t    i,j;
 
-    for(i=0;i<3;i++){
-        g[i] = 0.0;
-        for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
-        // g = R^t l
-    } // end for i
-    return;
+	for(i=0;i<3;i++){
+		g[i] = 0.0;
+		for(j=0;j<3;j++) g[i] += fm[j][i]*l[j];
+		// g = R^t l
+	} // end for i
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::GtoLPositionError(const Double_t g[3][3],
@@ -570,15 +530,15 @@ void AliITSgeomMatrix::GtoLPositionError(const Double_t g[3][3],
     //                    local coordinate system
     // Return:
     //   none.
-    Int_t    i,j,k,m;
+	Int_t    i,j,k,m;
 
-    for(i=0;i<3;i++)for(m=0;m<3;m++){
-        l[i][m] = 0.0;
-        for(j=0;j<3;j++)for(k=0;k<3;k++)
-            l[i][m] += fm[j][i]*g[j][k]*fm[k][m];
-    } // end for i,m
-    // g = R^t l R
-    return;
+	for(i=0;i<3;i++)for(m=0;m<3;m++){
+	    l[i][m] = 0.0;
+	    for(j=0;j<3;j++)for(k=0;k<3;k++)
+		l[i][m] += fm[j][i]*g[j][k]*fm[k][m];
+	} // end for i,m
+	    // g = R^t l R
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::LtoGPositionError(const Double_t l[3][3],
@@ -594,15 +554,15 @@ void AliITSgeomMatrix::LtoGPositionError(const Double_t l[3][3],
     //                    coordinate system
     // Return:
     //   none.
-    Int_t    i,j,k,m;
+	Int_t    i,j,k,m;
 
-    for(i=0;i<3;i++)for(m=0;m<3;m++){
-        g[i][m] = 0.0;
-        for(j=0;j<3;j++)for(k=0;k<3;k++)
-            g[i][m] += fm[i][j]*l[j][k]*fm[m][k];
-    } // end for i,m
-    // g = R l R^t
-    return;
+	for(i=0;i<3;i++)for(m=0;m<3;m++){
+	    g[i][m] = 0.0;
+	    for(j=0;j<3;j++)for(k=0;k<3;k++)
+		g[i][m] += fm[i][j]*l[j][k]*fm[m][k];
+	} // end for i,m
+	    // g = R l R^t
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::GtoLPositionTracking(const Double_t g[3],
@@ -773,22 +733,22 @@ void AliITSgeomMatrix::GtoLPositionErrorTracking(const Double_t g[3][3],
     //   Double_t l[3][3] the error matrix represented in the detector 
     //                    local coordinate system
     // Return:
-    Int_t    i,j,k,m;
-    Double_t rt[3][3];
-    Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
-    Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
+	Int_t    i,j,k,m;
+	Double_t rt[3][3];
+	Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
+	Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
 
-    if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
-        rt[i][k] = a0[i][j]*fm[j][k];
-    else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
-        rt[i][k] = a1[i][j]*fm[j][k];
-    for(i=0;i<3;i++)for(m=0;m<3;m++){
-        l[i][m] = 0.0;
-        for(j=0;j<3;j++)for(k=0;k<3;k++)
-            l[i][m] += rt[j][i]*g[j][k]*rt[k][m];
-    } // end for i,m
-    // g = R^t l R
-    return;
+	if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
+	    rt[i][k] = a0[i][j]*fm[j][k];
+	else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
+	    rt[i][k] = a1[i][j]*fm[j][k];
+	for(i=0;i<3;i++)for(m=0;m<3;m++){
+	    l[i][m] = 0.0;
+	    for(j=0;j<3;j++)for(k=0;k<3;k++)
+		l[i][m] += rt[j][i]*g[j][k]*rt[k][m];
+	} // end for i,m
+	    // g = R^t l R
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::LtoGPositionErrorTracking(const Double_t l[3][3],
@@ -812,22 +772,22 @@ void AliITSgeomMatrix::LtoGPositionErrorTracking(const Double_t l[3][3],
     //                    coordinate system
     // Return:
     //   none.
-    Int_t    i,j,k,m;
-    Double_t rt[3][3];
-    Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
-    Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
+	Int_t    i,j,k,m;
+	Double_t rt[3][3];
+	Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
+	Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
 
-    if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
-        rt[i][k] = a0[i][j]*fm[j][k];
-    else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
-        rt[i][k] = a1[i][j]*fm[j][k];
-    for(i=0;i<3;i++)for(m=0;m<3;m++){
-        g[i][m] = 0.0;
-        for(j=0;j<3;j++)for(k=0;k<3;k++)
-            g[i][m] += rt[i][j]*l[j][k]*rt[m][k];
-    } // end for i,m
-    // g = R l R^t
-    return;
+	if(fid[0]==1) for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
+	    rt[i][k] = a0[i][j]*fm[j][k];
+	else for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)
+	    rt[i][k] = a1[i][j]*fm[j][k];
+	for(i=0;i<3;i++)for(m=0;m<3;m++){
+	    g[i][m] = 0.0;
+	    for(j=0;j<3;j++)for(k=0;k<3;k++)
+		g[i][m] += rt[i][j]*l[j][k]*rt[m][k];
+	} // end for i,m
+	    // g = R l R^t
+	return;
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::PrintTitles(ostream *os) const {
@@ -1045,26 +1005,22 @@ TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName,
     title = nodeTitle;
     //
     mother->cd();
-    TNode *node1 = new TNode(name.Data(),title.Data(),shape,
-                             trans[0],trans[1],trans[2],rot);
+    TNode *node1 = new TNode(name.Data(),title.Data(),shape,trans[0],trans[1],trans[2],rot);
     if(axis){
         Int_t i,j;
         const Float_t kScale=0.5,kLw=0.2;
-        Float_t xchar[13][2]={
-            {0.5*kLw,1.},{0.,0.5*kLw},{0.5-0.5*kLw,0.5},
-            {0.,0.5*kLw},{0.5*kLw,0.},{0.5,0.5-0.5*kLw},
-            {1-0.5*kLw,0.},{1.,0.5*kLw},{0.5+0.5*kLw,0.5},
-            {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5,0.5+0.5*kLw},
-            {0.5*kLw,1.}};
-        Float_t ychar[10][2]={
-            {.5-0.5*kLw,0.},{.5+0.5*kLw,0.},{.5+0.5*kLw,0.5-0.5*kLw},
-            {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5+0.5*kLw,0.5},
-            {0.5*kLw,1.}   ,{0.,1-0.5*kLw} ,{0.5-0.5*kLw,0.5},
-            {.5-0.5*kLw,0.}};
-        Float_t zchar[11][2]={
-            {0.,1.},{0,1.-kLw},{1.-kLw,1.-kLw},{0.,kLw}   ,{0.,0.},
-            {1.,0.},{1.,kLw}  ,{kLw,kLw}      ,{1.,1.-kLw},{1.,1.},
-            {0.,1.}};
+        Float_t xchar[13][2]={{0.5*kLw,1.},{0.,0.5*kLw},{0.5-0.5*kLw,0.5},
+                              {0.,0.5*kLw},{0.5*kLw,0.},{0.5,0.5-0.5*kLw},
+                              {1-0.5*kLw,0.},{1.,0.5*kLw},{0.5+0.5*kLw,0.5},
+                              {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5,0.5+0.5*kLw},
+                              {0.5*kLw,1.}};
+        Float_t ychar[10][2]={{.5-0.5*kLw,0.},{.5+0.5*kLw,0.},{.5+0.5*kLw,0.5-0.5*kLw},
+                              {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5+0.5*kLw,0.5},
+                              {0.5*kLw,1.}   ,{0.,1-0.5*kLw} ,{0.5-0.5*kLw,0.5},
+                              {.5-0.5*kLw,0.}};
+        Float_t zchar[11][2]={{0.,1.},{0,1.-kLw},{1.-kLw,1.-kLw},{0.,kLw}   ,{0.,0.},
+                              {1.,0.},{1.,kLw}  ,{kLw,kLw}      ,{1.,1.-kLw},{1.,1.},
+                              {0.,1.}};
         for(i=0;i<13;i++)for(j=0;j<2;j++){
             if(i<13) xchar[i][j] = kScale*xchar[i][j];
             if(i<10) ychar[i][j] = kScale*ychar[i][j];
@@ -1079,18 +1035,16 @@ TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName,
         TXTRU *axiszl = new TXTRU("z","z","text",10,2);
         for(i=0;i<10;i++) axiszl->DefineVertex(i,zchar[i][0],zchar[i][1]);
         axiszl->DefineSection(0,-0.5*kLw);axiszl->DefineSection(1,0.5*kLw);
-        Float_t lxy[13][2]={
-            {-0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
-            {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},{0.5*kLw,0.8},
-            {0.1,0.8},{0.0,1.0},{-0.1,0.8},{-0.5*kLw,0.8},
-            {-0.5*kLw,-0.5*kLw}};
+        Float_t lxy[13][2]={{-0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
+                            {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},{0.5*kLw,0.8},
+                            {0.1,0.8},{0.0,1.0},{-0.1,0.8},{-0.5*kLw,0.8},
+                            {-0.5*kLw,-0.5*kLw}};
         TXTRU *axisxy = new TXTRU("axisxy","axisxy","text",13,2);
         for(i=0;i<13;i++) axisxy->DefineVertex(i,lxy[i][0],lxy[i][1]);
         axisxy->DefineSection(0,-0.5*kLw);axisxy->DefineSection(1,0.5*kLw);
-        Float_t lz[8][2]={
-            {0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
-            {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},
-            {0.5*kLw,-0.5*kLw}};
+        Float_t lz[8][2]={{0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
+                           {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},
+                           {0.5*kLw,-0.5*kLw}};
         TXTRU *axisz = new TXTRU("axisz","axisz","text",8,2);
         for(i=0;i<8;i++) axisz->DefineVertex(i,lz[i][0],lz[i][1]);
         axisz->DefineSection(0,-0.5*kLw);axisz->DefineSection(1,0.5*kLw);
@@ -1102,8 +1056,7 @@ TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName,
         title = name.Append("axisxy");
         TNode *nodeaxy = new TNode(title.Data(),title.Data(),axisxy);
         title = name.Append("axisz");
-        TNode *nodeaz = new TNode(title.Data(),title.Data(),axisz,
-                                  0.,0.,0.,yaxis90);
+        TNode *nodeaz = new TNode(title.Data(),title.Data(),axisz,0.,0.,0.,yaxis90);
         TNode *textboxX0 = new TNode("textboxX0","textboxX0",axisxl,
                                     lxy[3][0],lxy[3][1],0.0);
         TNode *textboxX1 = new TNode("textboxX1","textboxX1",axisxl,
@@ -1183,10 +1136,8 @@ void AliITSgeomMatrix::MakeFigures() const {
     node0->cd();
     TNode *node1 = new TNode("NODE1","NODE1",det);
     node1->cd();
-    TNode *nodex = new TNode("NODEx","NODEx",arrow,
-                             l[0][0],l[0][1],l[0][2],xarrow);
-    TNode *nodey = new TNode("NODEy","NODEy",arrow,
-                             l[2][0],l[2][1],l[2][2],yarrow);
+    TNode *nodex = new TNode("NODEx","NODEx",arrow,l[0][0],l[0][1],l[0][2],xarrow);
+    TNode *nodey = new TNode("NODEy","NODEy",arrow,l[2][0],l[2][1],l[2][2],yarrow);
     TNode *nodez = new TNode("NODEz","NODEz",arrow,l[4][0],l[4][1],l[4][2]);
     //
     axis->Draw();
diff --git a/ITS/AliITSgeomMatrix.h b/ITS/AliITSgeomMatrix.h
index ebca4d5d96d..29ee980019b 100644
--- a/ITS/AliITSgeomMatrix.h
+++ b/ITS/AliITSgeomMatrix.h
@@ -18,138 +18,131 @@ class TShape;
 
 class AliITSgeomMatrix : public TObject {
  public:
-    AliITSgeomMatrix(); // Default constructor
-    // Standard constructor #1
-    AliITSgeomMatrix(Int_t idt,const Int_t id[3],
-                     const Double_t rot[3],const Double_t tran[3]);
-    // Standard constructor #2
-    AliITSgeomMatrix(Int_t idt,const Int_t id[3],
-                     Double_t matrix[3][3],const Double_t tran[3]);
-    // Standard constructor #3
-    AliITSgeomMatrix(const Double_t rotd[6]/*degrees GEANT angles*/,
-                     Int_t idt,const Int_t id[3],
-                     const Double_t tran[3]);
-    // Copy constructor
-    AliITSgeomMatrix(const AliITSgeomMatrix &source);
-    // Assignment operator
-    AliITSgeomMatrix& operator=(const AliITSgeomMatrix &source); 
-    virtual ~AliITSgeomMatrix(){}; // default constructor.
-    // Prints a line describing the output format of the function Print.
-    void PrintComment(ostream *os) const;
-    // Prints out the content of this class in ASCII format.
-    void Print(ostream *os)const;
-    // Prints out the content of this class in ASCII format but includes
-    // formating and strings that make it more humanly readable.
-    void PrintTitles(ostream *os) const;
-    // Reads in the content of this class in the format of Print
-    void Read(istream *is);
-    virtual void Print(Option_t *option="") const {
-        TObject::Print(option);}
-    virtual Int_t Read(const char *name) {return TObject::Read(name);}
-    
-    // Returns the geometry path corresponding to this transformation
-    TString& GetPath(){return fPath;}
-    // Sets the geometry path
-    void SetPath(const Char_t *p){fPath = p;}
-    void SetPath(const TString &p){fPath = p;}
-    // Given the rotation angles [radians] it fills frot and computes
-    // the rotation matrix fm.
-    void SetAngles(const Double_t rot[3]){// [radians]
-        for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
-    // Sets the translation vector and computes fCylR and fCylPhi.
-    void SetTranslation(const Double_t tran[3]);
-    // sets the rotation matrix and computes the rotation angles [radians]
-    void SetMatrix(const Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
-        for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
-    // Sets the detector index value
-    void SetDetectorIndex(Int_t idt) {fDetectorIndex = idt;}
-    // Sets the detector layer, ladder, detector (id) values.
-    void SetIndex(const Int_t id[3]){
-        for(Int_t i=0;i<3;i++) fid[i] = id[i];}
-    // Returns the rotation angles [radians]
-    void GetAngles(Double_t rot[3]) const {// [radians]
-        for(Int_t i=0;i<3;i++)  rot[i] = frot[i];}
-    // Returns the translation vector [cm]
-    void GetTranslation(Double_t tran[3]) const {
-        for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
-    // Returns the translation vector in cylindrical
-    // coordinates [cm,radians]
-    void GetTranslationCylinderical (Double_t tran[3]) const {
-        tran[0] = fCylR;
-        tran[1] = fCylPhi;
-        tran[2] = ftran[2];}
-    // Returns the values of the rotation matrix
-    void GetMatrix(Double_t matrix[3][3]) const {for(Int_t i=0;i<3;i++)
-        for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
-    // Returns the detector index value.
-    Int_t GetDetectorIndex() const {return fDetectorIndex;}
-    // returns the modules index layer, ladder, detector
-    void  GetIndex(Int_t id[3]) const {for(Int_t i=0;i<3;i++) id[i] = fid[i];}
-    // return the x,y,z components (global) of the normalized normal
-    // vector which helps to define the plane the detector is a part of
-    void GetGlobalNormal(Double_t &nx,Double_t &ny,Double_t &nz)const{
-        Double_t ln[3]={0.0,1.0,0.0},gn[3];LtoGMomentum(ln,gn);
-        nx = gn[0];ny=gn[1];nz=gn[2];return;}
-    // Sets the rotation matrix based on the 6 GEANT rotation
-    // angles [radian]
-    void  MatrixFromSixAngles(const Double_t *ang);
-    // Returns the 6 GEANT rotation angles [radians] from the
-    // existing rotation matrix.
-    void  SixAnglesFromMatrix(Double_t *ang)const;
-    // Set rotation using the Euler's Chi-convention
-    void SetEulerAnglesChi(const Double_t ang[3]);
+	AliITSgeomMatrix(); // Default constructor
+	// Standard constructor #1
+	AliITSgeomMatrix(Int_t idt,const Int_t id[3],
+			 const Double_t rot[3],const Double_t tran[3]);
+	// Standard constructor #2
+        AliITSgeomMatrix(Int_t idt,const Int_t id[3],
+		         Double_t matrix[3][3],const Double_t tran[3]);
+	// Standard constructor #3
+        AliITSgeomMatrix(const Double_t rotd[6]/*degrees GEANT angles*/,
+                         Int_t idt,const Int_t id[3],
+                         const Double_t tran[3]);
+	// Copy constructor
+	AliITSgeomMatrix(const AliITSgeomMatrix &source);
+	// Assignment operator
+	AliITSgeomMatrix& operator=(const AliITSgeomMatrix &source); 
+	virtual ~AliITSgeomMatrix(){}; // default constructor.
+	// Prints a line describing the output format of the function Print.
+	void PrintComment(ostream *os) const;
+	// Prints out the content of this class in ASCII format.
+	void Print(ostream *os)const;
+	// Prints out the content of this class in ASCII format but includes
+	// formating and strings that make it more humanly readable.
+	void PrintTitles(ostream *os) const;
+	// Reads in the content of this class in the format of Print
+	void Read(istream *is);
+     virtual void Print(Option_t *option="") const {
+                       TObject::Print(option);}
+     virtual Int_t Read(const char *name) {return TObject::Read(name);}
 
-    // Given a position in Cartesian ALICE global coordinates [cm]
-    // returns the position in Cartesian detector/module local
-    //coordinates [cm]
-    void GtoLPosition(const Double_t g[3],Double_t l[3]) const;
-    // Given a position in Cartesian detector/module local coordinates [cm]
-    // returns the position in Cartesian ALICE global
-    //coordinates [cm]
-    void LtoGPosition(const Double_t l[3],Double_t g[3]) const;
-    // Given a momentum in Cartesian ALICE global coordinates
-    // returns the momentum in Cartesian detector/module local
-    //coordinates
-    void GtoLMomentum(const Double_t g[3],Double_t l[3]) const;
-    // Given a momentum in Cartesian detector/module local coordinates 
-    // returns the momentum in Cartesian ALICE global coordinates
-    void LtoGMomentum(const Double_t l[3],Double_t g[3]) const;
-    // given a position error matrix in ALICE Cartesian global
-    // coordinates [cm] returns a position error matrix in detector/
-    // module local Cartesian local coordinates [cm]
-    void GtoLPositionError(const Double_t g[3][3],Double_t l[3][3]) const;
-    // given a position error matrix in detector/module Cartesian local
-    // coordinates [cm] returns a position error matrix in ALICE
-    // Cartesian global coordinates [cm]
-    void LtoGPositionError(const Double_t l[3][3],Double_t g[3][3]) const;
-    // Tracking Related Routines
-    void GtoLPositionTracking(const Double_t g[3],Double_t l[3]) const;
-    // Given a position in Cartesian Tracking global coordinates [cm]
-    // returns the position in Cartesian detector/module local
-    // coordinates [cm]
-    void LtoGPositionTracking(const Double_t l[3],Double_t g[3]) const;
-    // Given a position in Cartesian detector/module local coordinates [cm]
-    // returns the position in Cartesian Tracking global
-    //coordinates [cm]
-    void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]) const;
-    // Given a momentum in Cartesian detector/module local coordinates 
-    // returns the momentum in Cartesian Tracking global coordinates
-    void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]) const;
-    // given a position error matrix in Tracking Cartesian global
-    // coordinates [cm] returns a position error matrix in detector/
-    // module local Cartesian local coordinates [cm]
-    void GtoLPositionErrorTracking(const Double_t g[3][3],
-                                   Double_t l[3][3]) const;
-    // given a position error matrix in detector/module Cartesian local
-    // coordinates [cm] returns a position error matrix in Tracking
-    // Cartesian global coordinates [cm]
-    void LtoGPositionErrorTracking(const Double_t l[3][3],
-                                   Double_t g[3][3]) const;
-    // Computes the distance squared [cm^2] between a point t[3] and
-    // this module/detector
-    Double_t Distance2(const Double_t t[3]) const {Double_t d=0.0,q;
-    for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;}
-    return d;}
+     // Returns the geometry path corresponding to this transformation
+     TString& GetPath(){return fPath;}
+     // Sets the geometry path
+     void SetPath(const Char_t *p){fPath = p;}
+     void SetPath(const TString &p){fPath = p;}
+	// Given the rotation angles [radians] it fills frot and computes
+	// the rotation matrix fm.
+	void SetAngles(const Double_t rot[3]){// [radians]
+              for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
+	// Sets the translation vector and computes fCylR and fCylPhi.
+	void SetTranslation(const Double_t tran[3]);
+	// sets the rotation matrix and computes the rotation angles [radians]
+	void SetMatrix(const Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
+	 for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
+	// Sets the detector index value
+	void SetDetectorIndex(Int_t idt) {fDetectorIndex = idt;}
+	// Sets the detector layer, ladder, detector (id) values.
+	void SetIndex(const Int_t id[3]){
+	                   for(Int_t i=0;i<3;i++) fid[i] = id[i];}
+	// Returns the rotation angles [radians]
+	void GetAngles(Double_t rot[3]) const {// [radians]
+	                   for(Int_t i=0;i<3;i++)  rot[i] = frot[i];}
+	// Returns the translation vector [cm]
+	void GetTranslation(Double_t tran[3]) const {
+	                    for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
+	// Returns the translation vector in cylindrical
+	// coordinates [cm,radians]
+	void GetTranslationCylinderical (Double_t tran[3]) const {
+	                    tran[0] = fCylR;
+			    tran[1] = fCylPhi;
+			    tran[2] = ftran[2];}
+	// Returns the values of the rotation matrix
+	void GetMatrix(Double_t matrix[3][3]) const {for(Int_t i=0;i<3;i++)
+		         for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
+	// Returns the detector index value.
+	Int_t GetDetectorIndex() const {return fDetectorIndex;}
+	// returns the modules index layer, ladder, detector
+	void  GetIndex(Int_t id[3]) const {for(Int_t i=0;i<3;i++) id[i] = fid[i];}
+	// Sets the rotation matrix based on the 6 GEANT rotation
+	// angles [radian]
+	void  MatrixFromSixAngles(const Double_t *ang);
+	// Returns the 6 GEANT rotation angles [radians] from the
+	// existing rotation matrix.
+	void  SixAnglesFromMatrix(Double_t *ang)const;
+
+	// Given a position in Cartesian ALICE global coordinates [cm]
+	// returns the position in Cartesian detector/module local
+	//coordinates [cm]
+	void GtoLPosition(const Double_t g[3],Double_t l[3]) const;
+	// Given a position in Cartesian detector/module local coordinates [cm]
+	// returns the position in Cartesian ALICE global
+	//coordinates [cm]
+	void LtoGPosition(const Double_t l[3],Double_t g[3]) const;
+	// Given a momentum in Cartesian ALICE global coordinates
+	// returns the momentum in Cartesian detector/module local
+	//coordinates
+	void GtoLMomentum(const Double_t g[3],Double_t l[3]) const;
+	// Given a momentum in Cartesian detector/module local coordinates 
+	// returns the momentum in Cartesian ALICE global coordinates
+	void LtoGMomentum(const Double_t l[3],Double_t g[3]) const;
+	// given a position error matrix in ALICE Cartesian global
+	// coordinates [cm] returns a position error matrix in detector/
+	// module local Cartesian local coordinates [cm]
+	void GtoLPositionError(const Double_t g[3][3],Double_t l[3][3]) const;
+	// given a position error matrix in detector/module Cartesian local
+	// coordinates [cm] returns a position error matrix in ALICE
+	// Cartesian global coordinates [cm]
+	void LtoGPositionError(const Double_t l[3][3],Double_t g[3][3]) const;
+	// Tracking Related Routines
+	void GtoLPositionTracking(const Double_t g[3],Double_t l[3]) const;
+	// Given a position in Cartesian Tracking global coordinates [cm]
+	// returns the position in Cartesian detector/module local
+	// coordinates [cm]
+	void LtoGPositionTracking(const Double_t l[3],Double_t g[3]) const;
+	// Given a position in Cartesian detector/module local coordinates [cm]
+	// returns the position in Cartesian Tracking global
+	//coordinates [cm]
+	void GtoLMomentumTracking(const Double_t g[3],Double_t l[3]) const;
+	// Given a momentum in Cartesian detector/module local coordinates 
+	// returns the momentum in Cartesian Tracking global coordinates
+	void LtoGMomentumTracking(const Double_t l[3],Double_t g[3]) const;
+	// given a position error matrix in Tracking Cartesian global
+	// coordinates [cm] returns a position error matrix in detector/
+	// module local Cartesian local coordinates [cm]
+	void GtoLPositionErrorTracking(const Double_t g[3][3],
+				       Double_t l[3][3]) const;
+	// given a position error matrix in detector/module Cartesian local
+	// coordinates [cm] returns a position error matrix in Tracking
+	// Cartesian global coordinates [cm]
+	void LtoGPositionErrorTracking(const Double_t l[3][3],
+				       Double_t g[3][3]) const;
+	// Computes the distance squared [cm^2] between a point t[3] and
+	// this module/detector
+	Double_t Distance2(const Double_t t[3]) const {Double_t d=0.0,q;
+                 for(Int_t i=0;i<3;i++){q = t[i]-ftran[i]; d += q*q;}
+                 return d;}
      //
      // Documentation related Class
      TPolyLine3D* CreateLocalAxis() const;
@@ -159,25 +152,25 @@ class AliITSgeomMatrix : public TObject {
      void MakeFigures() const;
      //
  private: // private functions
-     // Given the rotation matrix fm it fills the rotation angles frot
-     void MatrixFromAngle();
-     // Given the rotation angles frot it fills the rotation matrix fm
-     void AngleFromMatrix();
+	// Given the rotation matrix fm it fills the rotation angles frot
+	void MatrixFromAngle();
+	// Given the rotation angles frot it fills the rotation matrix fm
+	void AngleFromMatrix();
  private: // Data members.
-     Int_t    fDetectorIndex; // Detector type index (like fShapeIndex was)
-     Int_t    fid[3];         // layer, ladder, detector numbers.
-     Double_t frot[3];        //! vector of rotations about x,y,z [radians].
-     Double_t ftran[3];       // Translation vector of module x,y,z.
-     Double_t fCylR,fCylPhi;  //! Translation vector in Cylindrical coord.
-     Double_t fm[3][3];       // Rotation matrix based on frot.
-     TString  fPath;          // Path within Geometry to this volume
-     
-     // Note, fCylR and fCylPhi are added as data members because it costs
-     // about a factor of 10 to compute them over looking them up. Since
-     // they are used in some tracking algorithms this can be a large cost
-     // in computing time. They are not written out but computed.
-     
-     ClassDef(AliITSgeomMatrix,2) // Matrix class used by AliITSgeom.
+	Int_t    fDetectorIndex; // Detector type index (like fShapeIndex was)
+	Int_t    fid[3];         // layer, ladder, detector numbers.
+	Double_t frot[3];        //! vector of rotations about x,y,z [radians].
+	Double_t ftran[3];       // Translation vector of module x,y,z.
+	Double_t fCylR,fCylPhi;  //! Translation vector in Cylindrical coord.
+	Double_t fm[3][3];       // Rotation matrix based on frot.
+	TString  fPath;          // Path within Geometry to this volume
+
+	// Note, fCylR and fCylPhi are added as data members because it costs
+	// about a factor of 10 to compute them over looking them up. Since
+	// they are used in some tracking algorithms this can be a large cost
+	// in computing time. They are not written out but computed.
+
+	ClassDef(AliITSgeomMatrix,2) // Matrix class used by AliITSgeom.
 };
 // Input and output function for standard C++ input/output.
 ostream &operator<<(ostream &os,AliITSgeomMatrix &source);
diff --git a/ITS/AliITShit.cxx b/ITS/AliITShit.cxx
index a40ae04ae8b..dcb73d141e8 100644
--- a/ITS/AliITShit.cxx
+++ b/ITS/AliITShit.cxx
@@ -17,8 +17,7 @@
 
 #include 
 
-#include 
-#include 
+#include
 
 #include "AliRun.h"
 #include "AliITS.h"
@@ -191,19 +190,20 @@ ClassImp(AliITShit)
 ////////////////////////////////////////////////////////////////////////
 //_____________________________________________________________________________
 AliITShit::AliITShit():AliHit(),
-fStatus(0), // Track Status
-fModule(0),  // Module number 
-fPx(0.0),     // PX of particle at the point of the hit
-fPy(0.0),     // PY of particle at the point of the hit
-fPz(0.0),     // PZ of particle at the point of the hit
-fDestep(0.0), // Energy deposited in the current step
-fTof(0.0),    // Time of flight at the point of the hit
-fStatus0(0),// Track Status of Starting point
-fx0(0.0),     // Starting point of this step
-fy0(0.0),     // Starting point of this step
-fz0(0.0),     // Starting point of this step
-ft0(0.0)     // Starting point of this step
-{
+fStatus(0),
+fLayer(0),
+fLadder(0),
+fDet(0),
+fPx(0.0),
+fPy(0.0),
+fPz(0.0),
+fDestep(0.0),
+fTof(0.0),
+fStatus0(0),
+fx0(0.0),
+fy0(0.0),
+fz0(0.0),
+ft0(0.0){
     // Default Constructor
     // Zero data member just to be safe.
     // Intputs:
@@ -214,85 +214,84 @@ ft0(0.0)     // Starting point of this step
     //    A default created AliITShit class.
 
 }
-//----------------------------------------------------------------------
 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
-                     Float_t tof,TLorentzVector &x,TLorentzVector &x0,
-                     TLorentzVector &p) :
-AliHit(shunt, track), // AliHit
-fStatus(vol[3]), // Track Status
-fModule(vol[0]),  // Module number 
-fPx(p.Px()),     // PX of particle at the point of the hit
-fPy(p.Py()),     // PY of particle at the point of the hit
-fPz(p.Pz()),     // PZ of particle at the point of the hit
-fDestep(edep), // Energy deposited in the current step
-fTof(tof),    // Time of flight at the point of the hit
-fStatus0(vol[4]),// Track Status of Starting point
-fx0(x0.X()),     // Starting point of this step
-fy0(x0.Y()),     // Starting point of this step
-fz0(x0.Z()),     // Starting point of this step
-ft0(x0.T())     // Starting point of this step
-{
-    // Create ITS hit
-    //     The creator of the AliITShit class. The variables shunt and
-    // track are passed to the creator of the AliHit class. See the AliHit
-    // class for a full description. In the units of the Monte Carlo
-    // Inputs:
+		     Float_t tof,TLorentzVector &x,TLorentzVector &x0,
+		     TLorentzVector &p) : AliHit(shunt, track),
+fStatus(vol[3]),
+fLayer(vol[0]),
+fLadder(vol[2]),
+fDet(vol[1]),
+fPx(p.Px()),
+fPy(p.Py()),
+fPz(p.Pz()),
+fDestep(edep),
+fTof(tof),
+fStatus0(vol[4]),
+fx0(x0.X()),
+fy0(x0.Y()),
+fz0(x0.Z()),
+ft0(x0.T()){
+////////////////////////////////////////////////////////////////////////
+// Create ITS hit
+//     The creator of the AliITShit class. The variables shunt and
+// track are passed to the creator of the AliHit class. See the AliHit
+// class for a full description. In the units of the Monte Carlo
+////////////////////////////////////////////////////////////////////////
+    // Intputs:
     //    Int_t shunt   See AliHit
     //    Int_t track   Track number, see AliHit
     //    Int_t *vol     Array of integer hit data,
-    //                     vol[0] module
-    //                     vol[1] not used
-    //                     vol[2] not used
+    //                     vol[0] Layer where the hit is, 1-6 typicaly
+    //                     vol[1] Ladder where the hit is.
+    //                     vol[2] Detector number where the hit is
     //                     vol[3] Set of status bits
     //                     vol[4] Set of status bits at start
-    //    Float_t edep       The energy deposited GeV during the transport
-    //                       of this step
-    //    Float_t tof        The time of flight of this particle at this step
-    //    TLorenzVector &x   The Global position of this step [cm]
-    //    TLorenzVector &x0  The Global position of where this step 
-    //                       started from [cm]
-    //    TLorenzVector &p   The Global momentum of the particle at this
-    //                       step [GeV/c]
     // Outputs:
     //    none.
     // Return:
     //    A default created AliITShit class.
 
-    SetPosition(x);
+
+
+    fX          = x.X();   // Track X global position
+    fY          = x.Y();   // Track Y global position
+    fZ          = x.Z();   // Track Z global position
 }
 //______________________________________________________________________
 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
-    AliHit(shunt, track), // AliHit
-fStatus(vol[3]), // Track Status
-fModule(vol[0]),  // Module number 
-fPx(hits[3]),     // PX of particle at the point of the hit
-fPy(hits[4]),     // PY of particle at the point of the hit
-fPz(hits[5]),     // PZ of particle at the point of the hit
-fDestep(hits[6]), // Energy deposited in the current step
-fTof(hits[7]),    // Time of flight at the point of the hit
-fStatus0(vol[4]),// Track Status of Starting point
-fx0(hits[8]),     // Starting point of this step
-fy0(hits[9]),     // Starting point of this step
-fz0(hits[10]),     // Starting point of this step
-ft0(hits[11])     // Starting point of this step
-{
-    // Create ITS hit
-    //     The creator of the AliITShit class. The variables shunt and
-    // track are passed to the creator of the AliHit class. See the AliHit
-    // class for a full description. the integer array *vol contains, in order,
-    // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
-    // The array *hits contains, in order, fX = hits[0], fY = hits[1],
-    // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
-    // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
+    AliHit(shunt, track),
+fStatus(vol[3]),
+fLayer(vol[0]),
+fLadder(vol[2]),
+fDet(vol[1]),
+fPx(hits[3]),
+fPy(hits[4]),
+fPz(hits[5]),
+fDestep(hits[6]),
+fTof(hits[7]),
+fStatus0(0),
+fx0(0.0),
+fy0(0.0),
+fz0(0.0),
+ft0(0.0){
+////////////////////////////////////////////////////////////////////////
+// Create ITS hit
+//     The creator of the AliITShit class. The variables shunt and
+// track are passed to the creator of the AliHit class. See the AliHit
+// class for a full description. the integer array *vol contains, in order,
+// fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
+// The array *hits contains, in order, fX = hits[0], fY = hits[1],
+// fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
+// fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
+////////////////////////////////////////////////////////////////////////
     // Intputs:
     //    Int_t shunt   See AliHit
     //    Int_t track   Track number, see AliHit
     //    Int_t *vol     Array of integer hit data,
-    //                     vol[0] module number
-    //                     vol[1] not used
-    //                     vol[2] not used
+    //                     vol[0] Layer where the hit is, 1-6 typicaly
+    //                     vol[1] Ladder where the hit is.
+    //                     vol[2] Detector number where the hit is
     //                     vol[3] Set of status bits
-    //                     vol[4] Set of status bits at start
     //    Float_t *hits   Array of hit information
     //                     hits[0] X global position of this hit
     //                     hits[1] Y global position of this hit
@@ -302,123 +301,46 @@ ft0(hits[11])     // Starting point of this step
     //                     hits[5] Pz global position of this hit
     //                     hits[6] Energy deposited by this step
     //                     hits[7] Time of flight of this particle at this step
-    //                     hits[8] X0 global position of start of step
-    //                     hits[9] Y0 global position of start of step
-    //                     hits[10] Z0 global position of start of step
-    //                     hits[11] Time of flight of this particle before step
     // Outputs:
     //    none.
     // Return:
     //    A standard created AliITShit class.
-
-    fX          = hits[0];  // Track X global position
-    fY          = hits[1];  // Track Y global position
-    fZ          = hits[2];  // Track Z global position
+  fX          = hits[0];  // Track X global position
+  fY          = hits[1];  // Track Y global position
+  fZ          = hits[2];  // Track Z global position
 }
 //______________________________________________________________________
-AliITShit::AliITShit(const AliITShit &h):
-AliHit(h), // AliHit
-fStatus(h.fStatus), // Track Status
-fModule(h.fModule),  // Module number 
-fPx(h.fPx),     // PX of particle at the point of the hit
-fPy(h.fPy),     // PY of particle at the point of the hit
-fPz(h.fPz),     // PZ of particle at the point of the hit
-fDestep(h.fDestep), // Energy deposited in the current step
-fTof(h.fTof),    // Time of flight at the point of the hit
-fStatus0(h.fStatus0),// Track Status of Starting point
-fx0(h.fx0),     // Starting point of this step
-fy0(h.fy0),     // Starting point of this step
-fz0(h.fz0),     // Starting point of this step
-ft0(h.ft0)     // Starting point of this step
-{
-    // The standard copy constructor
-    // Inputs:
-    //   AliITShit   &h the sourse of this copy
-    // Outputs:
-    //   none.
-    // Return:
-    //  A copy of the sourse hit h
-
-    //Info("CopyConstructor","Coping hit");
+void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
+////////////////////////////////////////////////////////////////////////
+//     Returns the position of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
+    AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+    Float_t g[3],l[3];
 
-    if(this == &h) return;
+    g[0] = fX;
+    g[1] = fY;
+    g[2] = fZ;
+    if(gm) {
+      gm->GtoL(fLayer,fLadder,fDet,g,l);
+      x = l[0];
+      y = l[1];
+      z = l[2];
+    } else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      // AliITSv7 - SDD case
+      x=fX;
+      y=fY;
+      z=fZ;
+    }
     return;
 }
 //______________________________________________________________________
-AliITShit& AliITShit::operator=(const AliITShit &h){
-    // The standard = operator
-    // Inputs:
-    //   AliITShit   &h the sourse of this copy
-    // Outputs:
-    //   none.
-    // Return:
-    //  A copy of the sourse hit h
-
-    if(this == &h) return *this;
-    this->fStatus  = h.fStatus;
-    this->fModule  = h.fModule;
-    this->fPx      = h.fPx;
-    this->fPy      = h.fPy;
-    this->fPz      = h.fPz;
-    this->fDestep  = h.fDestep;
-    this->fTof     = h.fTof;
-    this->fStatus0 = h.fStatus0;
-    this->fx0      = h.fx0;
-    this->fy0      = h.fy0;
-    this->fz0      = h.fz0;
-    this->ft0      = h.ft0;
-    return *this;
-}
-//______________________________________________________________________
-void AliITShit::SetShunt(Int_t shunt){
-    // Sets track flag based on shunt value. Code copied from
-    // AliHit standar constructor.
-    // Inputs:
-    //   Int_t shunt    A flag to indecate what to do with track numbers
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-    Int_t primary,track,current,parent;
-    TParticle *part;
-
-    track = fTrack;
-    if(shunt == 1) {
-        primary = gAlice->GetMCApp()->GetPrimary(track);
-        gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit);
-        fTrack=primary;
-    }else if (shunt == 2) {
-        // the "primary" particle associated to the hit is
-        // the last track that has been flagged in the StepManager
-        // used by PHOS to associate the hit with the decay gamma
-        // rather than with the original pi0
-        parent=track;
-        while (1) {
-            current=parent;
-            part = gAlice->GetMCApp()->Particle(current);
-            parent=part->GetFirstMother();
-            if(parent<0 || part->TestBit(kKeepBit))
-                break;
-        }
-        fTrack=current;
-    }else {
-        fTrack=track;
-        gAlice->GetMCApp()->FlagTrack(fTrack);
-    } // end if shunt
-}
-//______________________________________________________________________
 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
-    //     Returns the position and time of flight of this hit in the local
-    // coordinates of this module, and in the units of the Monte Carlo.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   Float_t x   Global position of this hit [cm]
-    //   Float_t y   Global position of this hit [cm]
-    //   Float_t z   Global poistion of this hit [cm]
-    //   Float_t tof Time of flight of particle at this hit
-    // Return:
-    //   none.
+////////////////////////////////////////////////////////////////////////
+//     Returns the position and time of flight of this hit in the local
+// coordinates of this module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
     Float_t g[3],l[3];
 
@@ -426,35 +348,27 @@ void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
     g[1] = fY;
     g[2] = fZ;
     if(gm) {
-        gm->GtoL(fModule,g,l);
-        x = l[0];
-        y = l[1];
-        z = l[2];
+      gm->GtoL(fLayer,fLadder,fDet,g,l);
+      x = l[0];
+      y = l[1];
+      z = l[2];
     } else {
-        Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
-        // AliITSv7 - SDD case
-        x=fX;
-        y=fY;
-        z=fZ;
-    } // end if
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      // AliITSv7 - SDD case
+      x=fX;
+      y=fY;
+      z=fZ;
+    }
     tof = fTof;
     return;
 }
 //______________________________________________________________________
 void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
-                              Double_t &tof){
-    //     Returns the initial position and time of flight of this hit 
-    // in the local coordinates of this module, and in the units of the 
-    // Monte Carlo.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   Double_t x   Global position of this hit [cm]
-    //   Double_t y   Global position of this hit [cm]
-    //   Double_t z   Global poistion of this hit [cm]
-    //   Double_t tof Time of flight of particle at this hit
-    // Return:
-    //   none.
+			      Double_t &tof){
+////////////////////////////////////////////////////////////////////////
+//     Returns the initial position and time of flight of this hit in the local
+// coordinates of this module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
     Float_t g[3],l[3];
 
@@ -462,31 +376,86 @@ void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
     g[1] = fy0;
     g[2] = fz0;
     if(gm) {
-        gm->GtoL(fModule,g,l);
-        x = l[0];
-        y = l[1];
-        z = l[2];
+      gm->GtoL(fLayer,fLadder,fDet,g,l);
+      x = l[0];
+      y = l[1];
+      z = l[2];
     } else {
-        Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
-        x=fx0;
-        y=fy0;
-        z=fz0;
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      // AliITSv7 - SDD case
+      x=fx0;
+      y=fy0;
+      z=fz0;
     }
     tof = ft0;
     return;
 }
 //______________________________________________________________________
+Float_t AliITShit::GetXL(){
+////////////////////////////////////////////////////////////////////////
+//     Returns the x position of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
+    AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+    Float_t g[3],l[3];
+
+    g[0] = fX;
+    g[1] = fY;
+    g[2] = fZ;
+    if(gm) {
+      gm->GtoL(fLayer,fLadder,fDet,g,l);
+      return l[0];
+    } else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      return fX;
+    }
+}
+//______________________________________________________________________
+Float_t AliITShit::GetYL(){
+////////////////////////////////////////////////////////////////////////
+//     Returns the y position of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
+    AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+    Float_t g[3],l[3];
+
+    g[0] = fX;
+    g[1] = fY;
+    g[2] = fZ;
+    if (gm) {
+      gm->GtoL(fLayer,fLadder,fDet,g,l);
+      return l[1];
+    } else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      return fZ;
+    }
+}
+//______________________________________________________________________
+Float_t AliITShit::GetZL(){
+////////////////////////////////////////////////////////////////////////
+//     Returns the z position of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
+    AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+    Float_t g[3],l[3];
+
+    g[0] = fX;
+    g[1] = fY;
+    g[2] = fZ;
+    if(gm) {
+      gm->GtoL(fLayer,fLadder,fDet,g,l);
+      return l[2];
+    } else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      return fY;
+    }
+}
+//______________________________________________________________________
 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
-    //     Returns the momentum of this hit in the local coordinates of this
-    // module, and in the units of the Monte Carlo.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   Float_t px   Track x momentum at this hit [GeV/c]
-    //   Float_t py   Track y momentum at this hit [GeV/c]
-    //   Float_t pz   Track z momentum at this hit [GeV/c]
-    // Return:
-    //   none.
+////////////////////////////////////////////////////////////////////////
+//     Returns the momentum of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
     Float_t g[3],l[3];
 
@@ -494,60 +463,107 @@ void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
     g[1] = fPy;
     g[2] = fPz;
     if (gm) {
-        gm->GtoLMomentum(fModule,g,l);
-        px = l[0];
-        py = l[1];
-        pz = l[2];
+      gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+      px = l[0];
+      py = l[1];
+      pz = l[2];
     } else {
-        Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
-        px=fPx;
-        py=fPy;
-        pz=fPz;
-    } // end if
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      px=fPx;
+      py=fPy;
+      pz=fPz;
+    }
     return;
 }
 //______________________________________________________________________
-TParticle * AliITShit::GetParticle() const {
-    //     Returns the pointer to the TParticle for the particle that created
-    // this hit. From the TParticle all kinds of information about this 
-    // particle can be found. See the TParticle class.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   The TParticle of the track that created this hit.
+Float_t AliITShit::GetPXL(){
+////////////////////////////////////////////////////////////////////////
+//     Returns the X momentum of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
+    AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+    Float_t g[3],l[3];
 
-    return gAlice->GetMCApp()->Particle(GetTrack());
+    g[0] = fPx;
+    g[1] = fPy;
+    g[2] = fPz;
+    if (gm) {
+      gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+      return l[0];
+    } else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      return fPx;
+    }
 }
-//----------------------------------------------------------------------
-void AliITShit::GetDetectorID(Int_t &layer,Int_t &ladder,Int_t &det)const{
-    // Returns the layer ladder and detector number lables for this
-    // ITS module. The use of layer, ladder and detector number for
-    // discribing the ITS is obsoleate.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   Int_t   &layer   Layer lable
-    //   Int_t   &ladder  Ladder lable
-    //   Int_t   &det     Detector lable
-    // Return:
-    //    none.
+//______________________________________________________________________
+Float_t AliITShit::GetPYL(){
+////////////////////////////////////////////////////////////////////////
+//     Returns the Y momentum of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+    Float_t g[3],l[3];
 
-    gm->GetModuleId(fModule,layer,ladder,det);
-    return;
+    g[0] = fPx;
+    g[1] = fPy;
+    g[2] = fPz;
+    if (gm) {
+      gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+      return l[1];
+    } else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      return fPy;
+    }
+
+}
+//______________________________________________________________________
+Float_t AliITShit::GetPZL(){
+////////////////////////////////////////////////////////////////////////
+//     Returns the Z momentum of this hit in the local coordinates of this
+// module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
+    AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+    Float_t g[3],l[3];
+
+    g[0] = fPx;
+    g[1] = fPy;
+    g[2] = fPz;
+    if (gm) {
+      gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+      return l[2];
+    } else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      return fPz;
+    }
+
+}
+//___________________________________________________________________________;
+Int_t AliITShit::GetModule(){
+////////////////////////////////////////////////////////////////////////
+//     Returns the module index number of the module where this hit was in.
+////////////////////////////////////////////////////////////////////////
+    AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+
+    if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
+    else {
+      Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+      return 0;
+    }
+}
+//______________________________________________________________________
+TParticle * AliITShit::GetParticle() const {
+////////////////////////////////////////////////////////////////////////
+//     Returns the pointer to the TParticle for the particle that created
+// this hit. From the TParticle all kinds of information about this 
+// particle can be found. See the TParticle class.
+////////////////////////////////////////////////////////////////////////
+    return gAlice->GetMCApp()->Particle(GetTrack());
 }  
 //----------------------------------------------------------------------
 void AliITShit::Print(ostream *os) const {
-    // Standard output format for this class.
-    // Inputs:
-    //   ostream *os   The output stream
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-
+////////////////////////////////////////////////////////////////////////
+// Standard output format for this class.
+////////////////////////////////////////////////////////////////////////
 #if defined __GNUC__
 #if __GNUC__ > 2
     ios::fmtflags fmt;
@@ -567,7 +583,7 @@ void AliITShit::Print(ostream *os) const {
     fmt = os->setf(ios::hex); // set hex for fStatus only.
     *os << fStatus << " ";
     fmt = os->setf(ios::dec); // every thing else decimel.
-    *os << fModule << " ";
+    *os << fLayer << " " << fLadder << " " << fDet << " ";;
     *os << fPx << " " << fPy << " " << fPz << " ";
     *os << fDestep << " " << fTof;
     *os << " " << fx0 << " " << fy0 << " " << fz0;
@@ -577,44 +593,32 @@ void AliITShit::Print(ostream *os) const {
 }
 //----------------------------------------------------------------------
 void AliITShit::Read(istream *is) {
-    // Standard input format for this class.
-    // Inputs:
-    //   istream *is  the input stream
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
+////////////////////////////////////////////////////////////////////////
+// Standard input format for this class.
+////////////////////////////////////////////////////////////////////////
+ 
 
     *is >> fTrack >> fX >> fY >> fZ;
-    *is >> fStatus >> fModule >> fPx >> fPy >> fPz >> fDestep >> fTof;
+    *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
+	   fDestep >> fTof;
     *is >> fx0 >> fy0 >> fz0;
     return;
 }
 //----------------------------------------------------------------------
 ostream &operator<<(ostream &os,AliITShit &p){
-    // Standard output streaming function.
-    // Inputs:
-    //   ostream os  The output stream
-    //   AliITShit p The his to be printed out
-    // Outputs:
-    //   none.
-    // Return:
-    //   The input stream
-
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+ 
     p.Print(&os);
     return os;
 }
 //----------------------------------------------------------------------
 istream &operator>>(istream &is,AliITShit &r){
-    // Standard input streaming function.
-    // Inputs:
-    //   istream is  The input stream
-    //   AliITShit p The AliITShit class to be filled from this input stream
-    // Outputs:
-    //   none.
-    // Return:
-    //   The input stream
-
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+ 
     r.Read(&is);
     return is;
 }
diff --git a/ITS/AliITShit.h b/ITS/AliITShit.h
index 020c65e0922..a750127d8a2 100644
--- a/ITS/AliITShit.h
+++ b/ITS/AliITShit.h
@@ -84,10 +84,10 @@
 //
 //
 ////////////////////////////////////////////////////////////////////////
-#include 
 
 #include "AliHit.h" 
 
+class TLorentzVector;
 class TParticle;
 
 class AliITShit : public AliHit {
@@ -98,148 +98,127 @@ class AliITShit : public AliHit {
     AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
     // New Standard Constructor
     AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,Float_t tof,
-              TLorentzVector &x,TLorentzVector &x0,TLorentzVector &p);
-    // Copy Constructor
-    AliITShit(const AliITShit &h);
-    // Equals operator
-    AliITShit& operator=(const AliITShit &h);
+	      TLorentzVector &x,TLorentzVector &x0,TLorentzVector &p);
     // Default destructor
-    virtual ~AliITShit() {};
+    virtual ~AliITShit() {}
     // Get Hit information functions.
     // virtual int GetTrack() const {return fTrack;} // define in AliHit
     // virtual void SetTrack(int track) const {fTrack=track;) // AliHit
-    virtual void SetModule(Int_t mod){fModule=mod;};
-    virtual void SetShunt(Int_t shunt);
-    virtual void SetPosition(TLorentzVector &x){fX=x.X();fY=x.Y();fZ=x.Z();}
-    virtual void SetStartPosition(TLorentzVector &x){fx0=x.X();fy0=x.Y();
-                                                     fz0=x.Z();}
-    virtual void SetTime(Float_t t){fTof = t;}
-    virtual void SetStartTime(Float_t t){ft0 = t;}
-    virtual void SetStatus(Int_t stat){fStatus = stat;}
-    virtual void SetStartStatus(Int_t stat){fStatus0 = stat;}
-    virtual void SetEdep(Float_t de){fDestep = de;}
-    virtual void SetMomentum(TLorentzVector &p){fPx=p.Pz();fPy=p.Py();
-                                                fPz=p.Pz();}
     virtual Int_t GetTrackStatus() const {//returns the status code
-        return fStatus;}
+	return fStatus;}
     virtual Int_t GetTrackStatus0() const {//returns the status code
-        return fStatus0;}
-    virtual Int_t GetLayer() const{Int_t a,b,c;// returns the layer number
-    GetDetectorID(a,b,c); return a;}
-    virtual Int_t GetLadder() const{Int_t a,b,c;// returns the ladder number
-    GetDetectorID(a,b,c); return b;}
-    virtual Int_t GetDetector() const{Int_t a,b,c;//returns the detector number
-    GetDetectorID(a,b,c); return c;}
+	return fStatus0;}
+    virtual Int_t GetLayer() const {// returns the layer number
+	return fLayer;}
+    virtual Int_t GetLadder() const {// returns the ladder number
+	return fLadder;}
+    virtual Int_t GetDetector() const {// returns the detector number
+	return fDet;}
+    virtual void  GetDetectorID(Int_t &layer,Int_t &ladder,Int_t &det)const {
 	// returns the detector ID
-    virtual void  GetDetectorID(Int_t &layer,Int_t &ladder,Int_t &det)const;
-    virtual Int_t GetModule(){return fModule;};
-    virtual Float_t GetIonization() const {return fDestep;}//returns the Destep
+	layer=fLayer;ladder=fLadder;det=fDet;return;};
+    virtual Int_t GetModule();
+    virtual Float_t GetIonization() const {// returns the Destep
+	return fDestep;}
     //
     virtual void GetPositionG(Float_t &x,Float_t &y,Float_t &z)const {
-        // returns the position in the Global frame
-        x=fX;y=fY;z=fZ;return;};
+	// returns the position in the Global frame
+	x=fX;y=fY;z=fZ;return;};
     virtual void GetPositionG(Double_t &x,Double_t &y,Double_t &z)const {
-        // returns the position in the Global frame
-        x=fX;y=fY;z=fZ;return;};
+	// returns the position in the Global frame
+	x=fX;y=fY;z=fZ;return;};
     virtual Float_t GetTOF() const {// returns the time of flight
-        return fTof;}
+	return fTof;}
     // Returns particle 3 position at this hit in global coordinates.
     virtual void GetPositionG(Float_t &x,Float_t &y,Float_t &z,Float_t &tof)
-        const {// returns the position in the Global frame and the time of
-        // flight
-        x=fX;y=fY;z=fZ,tof=fTof;return;};
+	const {// returns the position in the Global frame and the time of
+	// flight
+	x=fX;y=fY;z=fZ,tof=fTof;return;};
     virtual void GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &t)
-        const {// Returns particle 3 position and the time of flight at this
-        // hit in global coordinates.
-        x=fX;y=fY;z=fZ,t=fTof;return;};
+	const {// Returns particle 3 position and the time of flight at this
+	// hit in global coordinates.
+	x=fX;y=fY;z=fZ,t=fTof;return;};
     virtual Float_t GetXG()const {// Returns particle X position at this hit
-        // in global coordinates.
-        return fX;}
+	// in global coordinates.
+	return fX;}
     virtual Float_t GetYG()const {// Returns particle X position at this hit
-        // in global coordinates.
-        return fY;}
+	// in global coordinates.
+	return fY;}
     virtual Float_t GetZG()const {// Returns particle Z position at this hit
-        // in global coordinates.
-        return fZ;}
+	// in global coordinates.
+	return fZ;}
     // Returns particle 3 position at this hit in global coordinates.
     virtual void GetPositionG0(Float_t &x,Float_t &y,Float_t &z,Float_t &tof)
-        const {// returns the initial position in the Global frame and the
-        // time of flight
-        x=fx0;y=fy0;z=fz0,tof=fTof;return;};
+	const {// returns the initial position in the Global frame and the
+	// time of flight
+	x=fx0;y=fy0;z=fz0,tof=fTof;return;};
     // Returns particle 3 position at this hit in global coordinates.
     virtual void GetPositionG0(Double_t &x,Double_t &y,Double_t &z,
-                               Double_t &tof)const {
-        // returns the initial position in the Global frame and the
-        // time of flight
-        x=fx0;y=fy0;z=fz0,tof=fTof;return;};
-    virtual void GetPositionL(Float_t &x,Float_t &y,Float_t &z){
-        // Returns particle 3 position at this hit in local coordinates.
-        Float_t tf;GetPositionL(x,y,z,tf);}
+			       Double_t &tof)
+	const {// returns the initial position in the Global frame and the
+	// time of flight
+	x=fx0;y=fy0;z=fz0,tof=fTof;return;};
+    virtual void GetPositionL(Float_t &x,Float_t &y,Float_t &z);
+    // Returns particle 3 position at this hit in local coordinates.
     virtual void GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof);
     virtual void GetPositionL(Double_t &x,Double_t &y,Double_t &z){
-        // Returns particle 3 position at this hit in local coordinates.
-        Float_t xf,yf,zf,tf;GetPositionL(xf,yf,zf,tf);x=xf,y=yf;z=zf;}
+	 // Returns particle 3 position at this hit in local coordinates.
+	 Float_t xf,yf,zf;GetPositionL(xf,yf,zf);x=xf,y=yf;z=zf;}
     virtual void GetPositionL(Double_t &x,Double_t &y,Double_t &z,Double_t &t){
-        // Returns particle 3 position and the time of flight at this hit
-        // in local coordinates.
-        Float_t xf,yf,zf,tf;GetPositionL(xf,yf,zf,tf);x=xf,y=yf;z=zf;t=tf;}
+    // Returns particle 3 position and the time of flight at this hit
+    // in local coordinates.
+	 Float_t xf,yf,zf,tf;GetPositionL(xf,yf,zf,tf);x=xf,y=yf;z=zf;t=tf;}
     // Returns particle 3 initial position and the time of flight at this hit
     // in local coordinates.
-    virtual void GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
-                               Double_t &t);
-    virtual Float_t GetXL(){
-        // Returns particle X position at this hit in local coordinates.
-        Float_t xf,yf,zf,tf;GetPositionL(xf,yf,zf,tf);return xf;}
-    virtual Float_t GetYL(){
-        // Returns particle Y position at this hit in local coordinates.
-        Float_t xf,yf,zf,tf;GetPositionL(xf,yf,zf,tf);return yf;}
-    virtual Float_t GetZL(){
-        // Returns particle Z position at this hit in local coordinates.
-        Float_t xf,yf,zf,tf;GetPositionL(xf,yf,zf,tf);return zf;}
+    virtual void GetPositionL0(Double_t &x,Double_t &y,Double_t &z,Double_t &t);
+    virtual Float_t GetXL();
+    // Returns particle X position at this hit in local coordinates.
+    virtual Float_t GetYL();
+    // Returns particle Y position at this hit in local coordinates.
+    virtual Float_t GetZL();
+    // Returns particle Z position at this hit in local coordinates.
     // Get Monti Carlo information about hit.
     virtual void GetMomentumG(Float_t &px,Float_t &py,Float_t &pz)const {
-        // returns the particle momentum in the Global frame
-        px=fPx;py=fPy;pz=fPz;return;};
+	// returns the particle momentum in the Global frame
+	px=fPx;py=fPy;pz=fPz;return;};
     virtual void GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)const {
-        // returns the particle momentum in the Global frame
-        px=fPx;py=fPy;pz=fPz;return;};
+	// returns the particle momentum in the Global frame
+	px=fPx;py=fPy;pz=fPz;return;};
     virtual Float_t GetPXG()const {// Returns particle X momentum at this hit
-        // in global coordinates.
-        return fPx;}
+	// in global coordinates.
+	return fPx;}
     virtual Float_t GetPYG()const {// Returns particle Y momentum at
-        // this hit in global coordinates.
-        return fPy;}
+	// this hit in global coordinates.
+	return fPy;}
     virtual Float_t GetPZG()const {// Returns particle Z momentum at
-        // this hit in global coordinates.
-        return fPz;}
+	// this hit in global coordinates.
+	return fPz;}
     virtual void GetMomentumL(Float_t &px,Float_t &py,Float_t &pz);
     virtual void GetMomentumL(Double_t &px,Double_t &py,Double_t &pz){
-        // Returns particle 3 momentum at this hit in local coordinates.	 
-        Float_t x,y,z;GetMomentumL(x,y,z);px=x,py=y,pz=z;}
-    virtual Float_t GetPXL(){Float_t px,py,pz;GetMomentumL(px,py,pz);
-                             return px;}
+       // Returns particle 3 momentum at this hit in local coordinates.	 
+	    Float_t x,y,z;GetMomentumL(x,y,z);px=x,py=y,pz=z;}
+    
+    virtual Float_t GetPXL();
     // Returns particle X momentum at this hit in local coordinates.
-    virtual Float_t GetPYL(){Float_t px,py,pz;GetMomentumL(px,py,pz);
-                             return py;}
+    virtual Float_t GetPYL();
     // Returns particle Y momentum at this hit in local coordinates.
-    virtual Float_t GetPZL(){Float_t px,py,pz;GetMomentumL(px,py,pz);
-                             return pz;}
+    virtual Float_t GetPZL();
     // Returns particle Z momentum at this hit in local coordinates.
     virtual TParticle * GetParticle() const; // Returns ptr to this particle.
     Bool_t StatusInside() const {// checks if the particle is "inside"
-        if((fStatus&0x0001)==0) return kFALSE;else return kTRUE;}
+	if((fStatus&0x0001)==0) return kFALSE;else return kTRUE;}
     Bool_t StatusEntering() const {// checks if the particle is "entering"
-        if((fStatus&0x0002)==0) return kFALSE;else return kTRUE;}
+	if((fStatus&0x0002)==0) return kFALSE;else return kTRUE;}
     Bool_t StatusExiting() const {// checks if the particle is "exiting"
-        if((fStatus&0x0004)==0) return kFALSE;else return kTRUE;}
+	if((fStatus&0x0004)==0) return kFALSE;else return kTRUE;}
     Bool_t StatusOut() const {// checks if the particle is "out"
-        if((fStatus&0x0008)==0) return kFALSE;else return kTRUE;}
+	if((fStatus&0x0008)==0) return kFALSE;else return kTRUE;}
     Bool_t StatusDisappeared() const {// checks if the part. is "disappeared"
-        if((fStatus&0x00010)==0) return kFALSE;else return kTRUE;}
+	if((fStatus&0x00010)==0) return kFALSE;else return kTRUE;}
     Bool_t StatusStop() const {// checks if the particle is "stopped"
-        if((fStatus&0x00020)==0) return kFALSE;else return kTRUE;}
+	if((fStatus&0x00020)==0) return kFALSE;else return kTRUE;}
     Bool_t StatusAlive() const {// checks if the particle is "alive"
-        if((fStatus&0x00030)==0) return kFALSE;else return kTRUE;}
+	if((fStatus&0x00030)==0) return kFALSE;else return kTRUE;}
     // Prints out the content of this class in ASCII format.
     void Print(ostream *os) const; 
     // Reads in the content of this class in the format of Print
@@ -250,7 +229,9 @@ class AliITShit : public AliHit {
 
  protected:
     Int_t     fStatus; // Track Status
-    Int_t     fModule; // Module number 
+    Int_t     fLayer;  // Layer number
+    Int_t     fLadder; // Ladder number
+    Int_t     fDet;    // Detector number  
     Float_t   fPx;     // PX of particle at the point of the hit
     Float_t   fPy;     // PY of particle at the point of the hit
     Float_t   fPz;     // PZ of particle at the point of the hit
@@ -262,7 +243,7 @@ class AliITShit : public AliHit {
     Float_t   fz0;     // Starting point of this step
     Float_t   ft0;     // Starting point of this step
 
-    ClassDef(AliITShit,3)  //Hits object for set:ITS
+    ClassDef(AliITShit,2)  //Hits object for set:ITS
 	 
 }; 
 // Input and output function for standard C++ input/output.
diff --git a/ITS/AliITSsimulationSSD.cxx b/ITS/AliITSsimulationSSD.cxx
index 8904fc0a3a4..a53c121828f 100644
--- a/ITS/AliITSsimulationSSD.cxx
+++ b/ITS/AliITSsimulationSSD.cxx
@@ -592,7 +592,6 @@ void AliITSsimulationSSD::ChargeToSignal(Int_t module,AliITSpList *pList) {
 	// if strip is dead -> gain=0
 	if( ((k==0)&&(res->GetGainP(ix)==0)) || ((k==1)&&(res->GetGainN(ix)==0))) continue;
 	
-	signal = fMapA2->GetSignal(k,ix);
 	// signal has to be uncalibrated
 	// In real life, gains are supposed to be calculated from calibration runs,
 	// stored in the calibration DB and used in the reconstruction
@@ -601,7 +600,7 @@ void AliITSsimulationSSD::ChargeToSignal(Int_t module,AliITSpList *pList) {
 	else signal /= res->GetGainN(ix);
 
 	// signal is converted in unit of ADC
-	signal = res->GetDEvToADC(signal);
+	signal = res->GetDEvToADC(fMapA2->GetSignal(k,ix));
 	if(signal>4096.) signal = 4096.;//if exceeding, accumulate last one
 
 	// threshold for zero suppression is set on the basis of the noise
diff --git a/ITS/AliITStrackerV2.cxx b/ITS/AliITStrackerV2.cxx
index a44bcb44271..0597776f451 100644
--- a/ITS/AliITStrackerV2.cxx
+++ b/ITS/AliITStrackerV2.cxx
@@ -1044,7 +1044,7 @@ Bool_t AliITStrackerV2::RefitAt(Double_t xx,AliITStrackV2 *t,
      Double_t maxchi2=kMaxChi2;
 
      Int_t idx=index[i];
-     if (idx>=0) {
+     if (idx>0) {
         const AliITSRecPoint *c=(AliITSRecPoint *)GetCluster(idx); 
         if (idet != c->GetDetectorIndex()) {
            idet=c->GetDetectorIndex();
diff --git a/ITS/AliITSv11.cxx b/ITS/AliITSv11.cxx
index 27f5dc983e6..2a56a44ae05 100644
--- a/ITS/AliITSv11.cxx
+++ b/ITS/AliITSv11.cxx
@@ -62,26 +62,20 @@ ClassImp(AliITSv11)
 
 
 //______________________________________________________________________
-AliITSv11::AliITSv11() : 
-AliITS(),
-fGeomDetOut(kFALSE),
-fGeomDetIn(kFALSE),
-fByThick(kTRUE),
-fMajorVersion(IsVersion()),
-fMinorVersion(0),
-fEuclidGeomDet(),
-fRead(),
-fWrite(),
-//fSPDgeom(),
-fSDDgeom(0),
-//fSupgeom(),
-fIgm(kv11)
+AliITSv11::AliITSv11() : AliITS(),
+  fGeomDetOut(kFALSE),
+  fGeomDetIn(kFALSE),
+  fByThick(kTRUE),
+  fMajorVersion(11),
+  fMinorVersion(0),
+  fSDDgeom(0)
 {
   //    Standard default constructor for the ITS version 11.
 
     fIdN          = 0;
     fIdName       = 0;
     fIdSens       = 0;
+    fEuclidOut    = kFALSE; // Don't write Euclide file
     Int_t i;
     for(i=0;i<60;i++) fRead[i] = '\0';
     for(i=0;i<60;i++) fWrite[i] = '\0';
@@ -91,20 +85,14 @@ fIgm(kv11)
 
 
 //______________________________________________________________________
-AliITSv11::AliITSv11(const char *name, const char *title): 
-AliITS("ITS", title),
-fGeomDetOut(kFALSE),
-fGeomDetIn(kFALSE),
-fByThick(kTRUE),
-fMajorVersion(IsVersion()),
-fMinorVersion(0),
-fEuclidGeomDet(),
-fRead(),
-fWrite(),
-//fSPDgeom(),
-fSDDgeom(0),
-//fSupgeom(),
-fIgm(kv11)
+AliITSv11::AliITSv11(const char *name, const char *title)
+  : AliITS("ITS", title),
+    fGeomDetOut(kFALSE),
+    fGeomDetIn(kFALSE),
+    fByThick(kTRUE),
+    fMajorVersion(11),
+    fMinorVersion(0),
+    fSDDgeom(0)
 {
   //    Standard constructor for the ITS version 11.
 
@@ -122,6 +110,8 @@ fIgm(kv11)
   fIdName[5] = "ITS6";
   fIdSens    = new Int_t[fIdN];
   for(i=0;iGetTopVolume();
-
-    TGeoPcon *sITS = new TGeoPcon("ITS Top Volume",0.0,360.0,2);
-
-    // DefineSection(section number, Z, Rmin, Rmax).
-    const Double_t kcm = 1.0;
-    sITS->DefineSection(0,-300.0*kcm,0.01*kcm,50.0*kcm);
-    sITS->DefineSection(1,+300.0*kcm,0.01*kcm,50.0*kcm);
-
-    TGeoMedium *air = gGeoManager->GetMedium("ITS_AIR$");
-    TGeoVolume *vITS = new TGeoVolume("ITSV",sITS,air);
-    vITS->SetVisibility(kFALSE);
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-        vITS->SetTitle(vstrng);
-    //printf("Title set to %s\n",vstrng);
-    vALIC->AddNode(vITS,1,0);
+  //
+  // Create ROOT geometry
+  //
+
+  TGeoManager *geoManager = gGeoManager;
+  TGeoVolume *vALIC = geoManager->GetTopVolume();
+
+  TGeoPcon *sITS = new TGeoPcon("ITS Top Volume",0.0,360.0,2);
+
+  // DefineSection(section number, Z, Rmin, Rmax).
+  const Double_t kcm = 1.0;
+  sITS->DefineSection(0,-300.0*kcm,0.01*kcm,50.0*kcm);
+  sITS->DefineSection(1,+300.0*kcm,0.01*kcm,50.0*kcm);
+
+  TGeoMedium *air = gGeoManager->GetMedium("ITS_AIR$");
+  TGeoVolume *vITS = new TGeoVolume("ITSV",sITS,air);
+  vITS->SetVisibility(kFALSE);
+  vALIC->AddNode(vITS,1,0);
 
 //   fSPDgeom->CenteralSPD(vITS);
 
@@ -1215,7 +1198,7 @@ void AliITSv11::CreateMaterials(){
     AliMaterial(96, "SSD cone$",63.546, 29., 1.15, 1.265, 999);
     AliMedium(96,"SSD cone$",96,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
 }
-/*
+
 //______________________________________________________________________
 void AliITSv11::InitAliITSgeom(){
   //
@@ -1328,7 +1311,7 @@ void AliITSv11::InitAliITSgeom(){
 
 //   fSDDgeom->ExportSensorGeometry(GetITSgeom(), +3, 0);  //SDD
 }
-*/
+
 //______________________________________________________________________
 void AliITSv11::Init(){
   //
@@ -1337,12 +1320,6 @@ void AliITSv11::Init(){
 
   //AliInfo(Form("Minor version %d",fMinorVersion));
     //
-    UpdateInternalGeometry();
-    AliITS::Init();
-    if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
-
-    //
-/*
     if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
     if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
     if(GetITSgeom()!=0) SetITSgeom(0x0);
@@ -1352,7 +1329,7 @@ void AliITSv11::Init(){
     else this->InitAliITSgeom();
     if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
     AliITS::Init();
-*/    //
+    //
 }
 
 // //______________________________________________________________________
diff --git a/ITS/AliITSv11.h b/ITS/AliITSv11.h
index 1a572628112..2d28e535042 100644
--- a/ITS/AliITSv11.h
+++ b/ITS/AliITSv11.h
@@ -10,7 +10,7 @@
 //
 // B. Nilsen, L. Gaudichet
 //************************************************************************
-#include "AliITSInitGeometry.h"
+ 
 #include "AliITS.h"
 class AliITSv11GeometrySPD;
 class AliITSv11GeometrySDD;
@@ -34,7 +34,7 @@ class AliITSv11 : public AliITS {
     //virtual AliITSv11GeometrySPD*     GetSPDGeometry(){return fSPDgeom;}
     virtual AliITSv11GeometrySDD*    GetSDDGeometry(){return fSDDgeom;}
     //virtual AliITSv11GeometrySupport* GetSupGeometry(){return fSupgeom;}
-    virtual Int_t  IsVersion() const { return kv11;}  // ITS version number 
+    virtual Int_t  IsVersion() const { return fMajorVersion;}  // ITS version number 
     virtual Int_t  GetMajorVersion() const {// return Major Version Number
                     return fMajorVersion;}
     virtual Int_t  GetMinorVersion() const {// return Major Version Number
@@ -76,21 +76,22 @@ class AliITSv11 : public AliITS {
  private:
     AliITSv11(const AliITSv11 &source);            // copy constructor
     AliITSv11& operator=(const AliITSv11 &source); // assignment operator
-    //void InitAliITSgeom();
+    void InitAliITSgeom();
 
-    Bool_t fGeomDetOut;       // Flag to write .det file out
-    Bool_t fGeomDetIn;        // Flag to read .det file or directly from Geat.
-    Bool_t fByThick;          // Flag to use services materials by thickness
+    Bool_t   fGeomDetOut;       // Flag to write .det file out
+    Bool_t   fGeomDetIn;        // Flag to read .det file or directly from Geat.
+    Bool_t   fByThick;          // Flag to use services materials by thickness
                                 // ture, or mass false.
-    Int_t  fMajorVersion;     // Major version number == IsVersion
-    Int_t  fMinorVersion;     // Minor version number
-    char   fEuclidGeomDet[60];// file where detector transormation are define.
-    char   fRead[60];         //! file name to read .det file
-    char   fWrite[60];        //! file name to write .det file
+    Int_t    fMajorVersion;     // Major version number == IsVersion
+    Int_t    fMinorVersion;     // Minor version number
+    char     fEuclidGeomDet[60];// file where detector transormation are define.
+    char     fRead[60];         //! file name to read .det file
+    char     fWrite[60];        //! file name to write .det file
+
+
     //AliITSv11GeometrySPD *fSPDgeom;      //SPD Geometry
     AliITSv11GeometrySDD *fSDDgeom;      //! SDD Geometry
     //AliITSv11GeometrySupport /fSupgeom;  //Support Geometry
-    AliITSInitGeometry fIgm; //! Geometry initlization object
 
     ClassDef(AliITSv11,1)  // ITS version 11 
 };
diff --git a/ITS/AliITSv11Hybrid.cxx b/ITS/AliITSv11Hybrid.cxx
index 4f7b3a575dd..034acc3e6fc 100644
--- a/ITS/AliITSv11Hybrid.cxx
+++ b/ITS/AliITSv11Hybrid.cxx
@@ -13,12 +13,6 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id$
-
-// $Log$
-// Revision 1.3  2007/05/08 16:57:42  masera
-// Updates concerning the geometry: versioning system, new V11hybrid version, bug fixes (B.Nilsend and L. Gaudichet
-//
 
 //========================================================================
 //
@@ -26,8 +20,6 @@
 //
 //  This geometry is a mix between the old geometry (originally coded
 //  in AliITSvPPRasymmFMD) and the new TGeo geometry (v11).
-//  The flags which indicate whether the old or the new part is used
-//  is set in AliITSInitGeometry.cxx
 // 
 // Ludovic Gaudichet  (gaudichet@to.infn.it)
 //
@@ -90,10 +82,9 @@ AliITSv11Hybrid::AliITSv11Hybrid():
   fRails(0),
   fFluid(0),
   fIDMother(0),
-  fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
   fSDDgeom(0)
  {
-    //    Standard default constructor
+    //    Standard default constructor for the ITS version 10.
     // Inputs:
     //   none.
     // Outputs:
@@ -121,9 +112,8 @@ AliITSv11Hybrid::AliITSv11Hybrid(const char *name, const char *title)
     fRails(0),
     fFluid(0),
     fIDMother(0),
-    fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
     fSDDgeom(0) {
-    //    Standard constructor for the v11Hybrid geometry.
+    //    Standard constructor for the ITS version 10.
     // Inputs:
     //   const char * name   Ignored, set to "ITS"
     //   const char * title  Arbitrary title
@@ -225,6 +215,7 @@ void AliITSv11Hybrid::SetT2Lmatrix(const char *name, Double_t dAlpha,
   delete matLtoT;
   alignableEntry->SetMatrix(matTtoL);
 }
+
 //______________________________________________________________________
 void AliITSv11Hybrid::AddAlignableVolumes() const
 {
@@ -651,14 +642,6 @@ void AliITSv11Hybrid::CreateGeometry() {
   CreateOldGeometry();
   TGeoVolume *vITS = geoManager->GetVolume("ITSV");
 
-  const Char_t *cvsDate="$Date$";
-  const Char_t *cvsRevision="$Revision$";
-  const Int_t length=100;
-  Char_t vstrng[length];
-  if(fInitGeom.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-			     fMinorVersion,cvsDate,cvsRevision))
-    vITS->SetTitle(vstrng);
-
   if (AliITSInitGeometry::SDDIsTGeoNative()) {
     fSDDgeom->Layer3(vITS);
     fSDDgeom->Layer4(vITS);
@@ -5353,6 +5336,7 @@ void AliITSv11Hybrid::DrawModule() const{
     gMC->Gdhead(1111, "Inner Tracking System Version 1");
     gMC->Gdman(17, 6, "MAN");
 }
+
 //______________________________________________________________________
 void AliITSv11Hybrid::StepManager(){
     //    Called for every step in the ITS, then calles the AliITShit class
@@ -5369,94 +5353,108 @@ void AliITSv11Hybrid::StepManager(){
     // Return:
     //   none.
 
-    if(!(this->IsActive())) return;
+    static TLorentzVector position0;
+    static Int_t stat0=0;
+
+    if(!(this->IsActive())) {
+	return;
+    } // end if !Active volume.
+
     if(!(gMC->TrackCharge())) return;
 
-    Int_t  copy, id, lay;
-    Bool_t sensvol = kFALSE;
-    id = gMC->CurrentVolID(copy);
-    for(lay=0; layIsTrackExiting())) {
-      copy = fTrackReferences->GetEntriesFast();
-      TClonesArray &lTR = *fTrackReferences;
-      // Fill TrackReference structure with this new TrackReference.
-      new(lTR[copy]) AliTrackReference(
-		     gAlice->GetMCApp()->GetCurrentTrackNumber());
+    Int_t kk = 0, copy;
+    Int_t id = gMC->CurrentVolID(copy);
+    while ((id != fIdSens[kk]) && (kk<6)) ++kk;
+
+    if((kk<6) && (gMC->IsTrackExiting())) {
+	copy = fTrackReferences->GetEntriesFast();
+	TClonesArray &lTR = *fTrackReferences;
+	// Fill TrackReference structure with this new TrackReference.
+	new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
     } // if Outer ITS mother Volume
 
-    static TLorentzVector position, momentum; // Saves on calls to construtors
-    static AliITShit hit;// Saves on calls to constructors
-    Int_t   cpn0, cpn1, cpn2, status, mod;
-    //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
-    TClonesArray &lhits = *(Hits());
-    //
+    Int_t   copy1, copy2;  
+    Int_t   vol[5];
+    TClonesArray &lhits = *fHits;
+
     // Track status
-    status = 0;
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
-    //
-    switch (lay) {
-    case 0:case 1: // SPD
-      gMC->CurrentVolOffID(2,cpn2);
-      gMC->CurrentVolOffID(3,cpn1);
-      gMC->CurrentVolOffID(4,cpn0);
-      break;
-    case 2:case 3: // SDD
-      cpn2 = 1;
-      if (AliITSInitGeometry::SDDIsTGeoNative()) {
-	gMC->CurrentVolOffID(2,cpn1);
-	gMC->CurrentVolOffID(3,cpn0);
-      } else {
-	gMC->CurrentVolOffID(1,cpn1);
-	gMC->CurrentVolOffID(2,cpn0);
-      };
-      break;
-    case 4:case 5: // SSD
-      cpn2 = 1;
-      gMC->CurrentVolOffID(1,cpn1);
-      gMC->CurrentVolOffID(2,cpn0);
-      break;
-    default:
-      Error("StepManager","Unknown volume lay=%d",lay+1);
-      return; // not an ITS sensitive volume.
-    } //
-    fInitGeom.DecodeDetector(mod,lay+1,cpn0,cpn1,cpn2);
+    vol[3] = 0;
+    vol[4] = 0;
+    if(gMC->IsTrackInside())      vol[3] +=  1;
+    if(gMC->IsTrackEntering())    vol[3] +=  2;
+    if(gMC->IsTrackExiting())     vol[3] +=  4;
+    if(gMC->IsTrackOut())         vol[3] +=  8;
+    if(gMC->IsTrackDisappeared()) vol[3] += 16;
+    if(gMC->IsTrackStop())        vol[3] += 32;
+    if(gMC->IsTrackAlive())       vol[3] += 64;
 
-    //
     // Fill hit structure.
-    //
-    hit.SetModule(mod);
-    hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
+    vol[0] = kk+1;
+    Int_t sddModPos = 1, sddLaddPos = 2, sddIndShift = 0;
+    if (AliITSInitGeometry::SDDIsTGeoNative()) {
+      sddModPos     = 2;
+      sddLaddPos    = 3;
+      sddIndShift   = 1;
+    };
+
+    switch (kk) {
+
+    case 0: { // SPD
+
+      gMC->CurrentVolOffID(2,copy);  // det 1<->4
+      vol[1] = copy;
+      gMC->CurrentVolOffID(3,copy1); // lad 1<->2
+      gMC->CurrentVolOffID(4,copy2); // mod 1<->10
+      vol[2] = copy1+(copy2-1)*2; //# of ladders in one module  = 2
+    } break;
+
+    case 1: {
+
+      gMC->CurrentVolOffID(2,copy);  // 1<->4
+      vol[1] = copy;
+      gMC->CurrentVolOffID(3,copy1); // 1<->4
+      gMC->CurrentVolOffID(4,copy2); // 1<->10
+      vol[2] = copy1+(copy2-1)*4; //# of ladders in one module  = 4
+    } break;
+
+    case 2: // SDD
+    case 3: {
+
+      gMC->CurrentVolOffID(sddModPos, copy); // 1<->6  and 1<->8
+      vol[1] = copy + sddIndShift;
+      gMC->CurrentVolOffID(sddLaddPos, copy);// 1<->14 and 1<->22
+      vol[2] = copy + sddIndShift;
+    } break;
+
+    case 5: // SSD
+    case 4: {
+
+      gMC->CurrentVolOffID(1,copy); // 1<->22 and 1<->25
+      vol[1] = copy;
+      gMC->CurrentVolOffID(2,copy); // 1<->34 and 1<->38
+      vol[2] = copy;
+    } break;
+
+    default: return; // not an ITS volume?
+    }
+
+    TLorentzVector position, momentum;
     gMC->TrackPosition(position);
     gMC->TrackMomentum(momentum);
-    hit.SetPosition(position);
-    hit.SetTime(gMC->TrackTime());
-    hit.SetMomentum(momentum);
-    hit.SetStatus(status);
-    hit.SetEdep(gMC->Edep());
-    hit.SetShunt(GetIshunt());
-    if(gMC->IsTrackEntering()){
-        hit.SetStartPosition(position);
-        hit.SetStartTime(gMC->TrackTime());
-        hit.SetStartStatus(status);
-        return; // don't save entering hit.
+    vol[4] = stat0;
+    if(gMC->IsTrackEntering()) {
+	position0 = position;
+	stat0 = vol[3];
+	return;
     } // end if IsEntering
     // Fill hit structure with this new hit.
-    //Info("StepManager","Calling Copy Constructor");
-    new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
-    // Save old position... for next hit.
-    hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
-    hit.SetStartStatus(status);
+    
+    new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
+				   gMC->Edep(),gMC->TrackTime(),position,
+				   position0,momentum);
+
+    position0 = position;
+    stat0 = vol[3];
 
     return;
 }
diff --git a/ITS/AliITSv11Hybrid.h b/ITS/AliITSv11Hybrid.h
index 574ffb0174e..bef9dc611a9 100644
--- a/ITS/AliITSv11Hybrid.h
+++ b/ITS/AliITSv11Hybrid.h
@@ -3,10 +3,6 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-// $Id$
-
-// $Log$
-
 //========================================================================
 //
 //            Geometry of the Inner Tracking System
@@ -19,7 +15,6 @@
 //========================================================================
  
 #include "AliITS.h"
-#include "AliITSInitGeometry.h"
 
 class  AliITSv11GeometrySDD;
 
@@ -118,6 +113,7 @@ class AliITSv11Hybrid : public AliITS {
     AliITSv11Hybrid& operator=(const AliITSv11Hybrid &source); // assignment operator
     void InitAliITSgeom();
 
+    // TString fEuclidGeomtery,fEuclidMaterial defined in AliModule.
     Bool_t fGeomDetOut;       // Flag to write .det file out
     Bool_t fGeomDetIn;        // Flag to read .det file or directly from Geat.
     Bool_t fByThick;          // Flag to use services materials by thickness
@@ -135,10 +131,9 @@ class AliITSv11Hybrid : public AliITS {
     Int_t    fFluid;          // flag to switch between water (=1) and freon (=0)
     Int_t fIDMother;          //! ITS Mother Volume id.
 
-    AliITSInitGeometry fInitGeom;   //! Get access to decoding and AliITSgeom init functins
-    AliITSv11GeometrySDD *fSDDgeom; //! SDD Geometry
+    AliITSv11GeometrySDD *fSDDgeom;    //! SDD Geometry
 
-    ClassDef(AliITSv11Hybrid,2)                          
+    ClassDef(AliITSv11Hybrid,1)                          
 };
  
 #endif
diff --git a/ITS/AliITSvBeamTestITS04.cxx b/ITS/AliITSvBeamTestITS04.cxx
index 17f7958492b..a5db650d04d 100644
--- a/ITS/AliITSvBeamTestITS04.cxx
+++ b/ITS/AliITSvBeamTestITS04.cxx
@@ -90,24 +90,21 @@ const Double_t AliITSvBeamTestITS04::fgkSSD1y = 80.6;
 ClassImp(AliITSvBeamTestITS04)
     
 //_____________________________________________________________
-  AliITSvBeamTestITS04::AliITSvBeamTestITS04() : 
-AliITS(),              // Base class
-fITSmotherVolume(0),   // Pointer to ITS mother volume.
-fNspd(fgkNumberOfSPD), //Number of SPD modules
-fNsdd(fgkNumberOfSDD), //Number of SDD modules
-fNssd(fgkNumberOfSSD), //Number of SSD modules
-fGeomDetOut(kFALSE),   // Flag to write .det file out
-fGeomDetIn(kFALSE),    // Flag to read geometry file (JC)
-fWrite(),              //! file name to write .det file 
-fRead(),               // file name to read .det file (JC)
-fMajorVersion(kvITS04),// Major Version
-fMinorVersion(1),      // Minor Version
-fIgm(kvITS04)          //! Init geometry object
-{
+  AliITSvBeamTestITS04::AliITSvBeamTestITS04() : AliITS(),
+fITSmotherVolume(0),
+fNspd(fgkNumberOfSPD),
+fNsdd(fgkNumberOfSDD),
+fNssd(fgkNumberOfSSD),
+fGeomDetOut(kFALSE),
+fGeomDetIn(kFALSE){
     //
     // Constructor
     //
-
+    
+  // SetNumberOfSPD(fgkNumberOfSPD);
+  //  SetNumberOfSDD(fgkNumberOfSDD);
+  //  SetNumberOfSSD(fgkNumberOfSSD);
+    
     fIdN = 3;         
     fIdName    = new TString[fIdN];
     fIdName[0] = fgSPDsensitiveVolName;
@@ -116,27 +113,33 @@ fIgm(kvITS04)          //! Init geometry object
     fIdSens    = new Int_t[fIdN];
     for(Int_t i=0; iField()->Integ();
     Float_t fieldm = gAlice->Field()->Max();
@@ -195,12 +210,9 @@ void AliITSvBeamTestITS04::CreateMaterials(){
 }
 
 //______________________________________________________________________
-void AliITSvBeamTestITS04::CreateGeometry(){    
-    //Creates geometry
-    // These constant character strings are set by cvs during commit
-    // do not change them unless you know what you are doing!
-    const Char_t *cvsDate="$Date$";
-    const Char_t *cvsRevision="$Revision$";
+void AliITSvBeamTestITS04::CreateGeometry()
+{    
+  //Creates geometry
     TGeoManager *geoManager = gGeoManager;
     TGeoVolume *vALIC = geoManager->GetTopVolume();
     
@@ -212,19 +224,8 @@ void AliITSvBeamTestITS04::CreateGeometry(){
     sITS->DefineSection(0,-100.0,0.01,100.0); // Units in cms
     sITS->DefineSection(1,+100.0,0.01,100.0);
     
-    TGeoMedium *air = geoManager->GetMedium("ITSair");
-    fITSmotherVolume = new TGeoVolume("ITSV",sITS,air);
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-        fITSmotherVolume->SetTitle(vstrng);
-    else Error("CreateGeometry","Error writing/setting version string");
-    //printf("Title set to %s\n",vstrng);
-    if(vALIC==0) {
-        Error("CreateGeometry","alic=0");
-        return;
-    } // end if
+    TGeoMedium *air = gGeoManager->GetMedium("ITSair");
+    fITSmotherVolume = new TGeoVolume("vITS",sITS,air);
     fITSmotherVolume->SetVisibility(kFALSE);
     vALIC->AddNode(fITSmotherVolume,1,0);
     
@@ -250,23 +251,20 @@ void AliITSvBeamTestITS04::CreateGeometry(){
 void AliITSvBeamTestITS04::Init()
 {
     // Initialize the ITS after it has been created.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-
-    AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
-                 fMinorVersion));
-    //
-    UpdateInternalGeometry();
+    Int_t i;
+    for(i=0;i<20;i++) printf("*");
+    printf( " ITSbeamtest_Init " );
+    for(i=0;i<20;i++) printf("*"); printf("\n");
+
+//    // Create geometry
+//    if(!fGeomDetIn) this->InitAliITSgeom();
+
+    // Initialize AliITS
     AliITS::Init();
-    if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
+    for(i=0;i<40+16;i++) printf("*"); printf("\n");
 
-    //
 }
-/*
+
 //______________________________________________________________________
 void AliITSvBeamTestITS04::InitAliITSgeom()
 {    
@@ -285,7 +283,7 @@ void AliITSvBeamTestITS04::InitAliITSgeom()
     if (GetITSgeom()) SetITSgeom(0x0);
     AliITSgeom* geom = new AliITSgeom(0,knlayers,nlad,ndet,nModTot);
     SetITSgeom(geom);
-    // *** Set default shapes 
+    //*** Set default shapes 
     const Float_t kDxyzSPD[] = {fgkSPDwidthSens/2, fgkSPDthickSens/2,fgkSPDlengthSens/2};  
     if(!(GetITSgeom()->IsShapeDefined(kSPD)))
 	GetITSgeom()->ReSetShape(kSPD,new AliITSgeomSPD425Short(3,(Float_t *)kDxyzSPD));
@@ -368,6 +366,7 @@ void AliITSvBeamTestITS04::InitAliITSgeom()
     
     return;
 }
+
 //______________________________________________________________________
 void AliITSvBeamTestITS04::SetDefaults()
 {
@@ -470,7 +469,7 @@ void AliITSvBeamTestITS04::SetDefaults()
   if(fgkNTYPES>3){Warning("SetDefaults","Only the four basic detector types are initialised!");}
   return;
 }
-*/
+
 //______________________________________________________________________
 void AliITSvBeamTestITS04::AddSPDGeometry(TGeoVolume *moth) const
 {
@@ -574,62 +573,78 @@ void AliITSvBeamTestITS04::StepManager()
     // creator with the information to be recoreded about that hit.
 
     // "Standard" StepManager. (Similar to AliITSv11) mln
-    Int_t cpy0,mod,status,id,kk;
+    Int_t copy, id;
     TLorentzVector position, momentum;
-    static AliITShit hit;// Saves on calls to construtors
+    static TLorentzVector position0;
+    static Int_t stat0=0;
+    
+    if(!(this->IsActive())){
+	return;
+    } // end if !Active volume.
     
-    if(!(this->IsActive())) return;
     if(!(gMC->TrackCharge())) return;
-    //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
-    TClonesArray &lhits = *(Hits());
-    //
-    // Track status
-    // Track status
-    status = 0;
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
     
-    id=gMC->CurrentVolID(cpy0);
+    id=gMC->CurrentVolID(copy);
     
     Bool_t sensvol = kFALSE;
-    for(kk=0;kkGetMother(1)->GetNumber(),1,1,1);
+    for(Int_t kk = 0; kk < fIdN; kk++)
+	if(id == fIdSens[kk]) sensvol = kTRUE;
+    
+    if (sensvol && (gMC->IsTrackExiting())) {
+	copy = fTrackReferences->GetEntriesFast();
+	TClonesArray &lTR = *fTrackReferences;
+	// Fill TrackReference structure with this new TrackReference.
+	new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
+    } // if Outer ITS mother Volume
+    
+    Int_t   vol[5];
+    TClonesArray &lhits = *fHits;
     //
+    // Track status
+    vol[3] = 0;
+    vol[4] = 0;
     // Fill hit structure.
-    //
-    hit.SetModule(mod);
-    hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
+    if(gMC->IsTrackInside())      vol[3] +=  1;
+    if(gMC->IsTrackEntering())    vol[3] +=  2;
+    if(gMC->IsTrackExiting())     vol[3] +=  4;
+    if(gMC->IsTrackOut())         vol[3] +=  8;
+    if(gMC->IsTrackDisappeared()) vol[3] += 16;
+    if(gMC->IsTrackStop())        vol[3] += 32;
+    if(gMC->IsTrackAlive())       vol[3] += 64;
+    
+    // Only entering charged tracks
+    if(!(gMC->TrackCharge())) return;
+    
+    if( ((id = gMC->CurrentVolID(copy)) == fIdSens[0]) ||
+	((id = gMC->CurrentVolID(copy)) == fIdSens[1]) ||
+	((id = gMC->CurrentVolID(copy)) == fIdSens[2]) )
+    {
+	GetCurrentLayLaddDet(vol[0], vol[2], vol[1]);
+	// vol[2], vol[1]) : in this order because the ladder
+	// index and the det. index are exchanged in the constructor
+	// of AliITShit...
+    } else {
+	return; // not an ITS volume?
+    };
+    
     gMC->TrackPosition(position);
     gMC->TrackMomentum(momentum);
-    hit.SetPosition(position);
-    hit.SetTime(gMC->TrackTime());
-    hit.SetMomentum(momentum);
-    hit.SetStatus(status);
-    hit.SetEdep(gMC->Edep());
-    hit.SetShunt(GetIshunt());
+    vol[4] = stat0;
     if(gMC->IsTrackEntering()){
-        hit.SetStartPosition(position);
-        hit.SetStartTime(gMC->TrackTime());
-        hit.SetStartStatus(status);
-        return; // don't save entering hit.
+	position0 = position;
+	stat0 = vol[3];
+	return;
     } // end if IsEntering
     // Fill hit structure with this new hit.
-    //Info("StepManager","Calling Copy Constructor");
-    new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
-    // Save old position... for next hit.
-    hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
-    hit.SetStartStatus(status);
+    new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),
+				   vol, gMC->Edep(),gMC->TrackTime(),position,
+				   position0,momentum);
+    //
+    position0 = position;
+    stat0 = vol[3];
     return;
 }
-/*
+
 //______________________________________________________________________
 Int_t AliITSvBeamTestITS04::GetCurrentLayLaddDet(Int_t &lay,Int_t &ladd, Int_t &det) const
 { 
@@ -663,7 +678,7 @@ Int_t AliITSvBeamTestITS04::GetCurrentLayLaddDet(Int_t &lay,Int_t &ladd, Int_t &
     
     return kTRUE;
 }
-*/
+
 //_____________________________________________________________
 
  Int_t AliITSvBeamTestITS04::GetNumberOfSubDet(const TString& det) const{
diff --git a/ITS/AliITSvBeamTestITS04.h b/ITS/AliITSvBeamTestITS04.h
index c60e28e6483..7944ebf6e83 100644
--- a/ITS/AliITSvBeamTestITS04.h
+++ b/ITS/AliITSvBeamTestITS04.h
@@ -5,7 +5,7 @@
 // ITS geometry class and step manager for the//
 //   integrated ITS test beam of Nov. 04      //
 ////////////////////////////////////////////////
-#include "AliITSInitGeometry.h"
+
 #include "AliITS.h"
 
 class TGeoVolume;
@@ -13,92 +13,98 @@ class TGeoVolume;
 class AliITSvBeamTestITS04 : public AliITS {
  
  public:
-    AliITSvBeamTestITS04();
-    AliITSvBeamTestITS04(const char* name,const char *title);
-    virtual ~AliITSvBeamTestITS04();
-    virtual void SetNumberOfSPD(Int_t nSPD) {fNspd=nSPD;}
-    virtual void SetNumberOfSDD(Int_t nSDD) {fNsdd=nSDD;}
-    virtual void SetNumberOfSSD(Int_t nSSD) {fNssd=nSSD;}
-    Int_t GetNSPD() const {return fNspd;}
-    Int_t GetNSDD() const {return fNsdd;}
-    Int_t GetNSSD() const {return fNssd;}
-    Int_t GetNumberOfSubDet(const TString& det) const;
-    virtual void CreateGeometry();
-    virtual void CreateMaterials();
-    virtual Int_t IsVersion()const{return (Int_t)kvITS04;}//Return Major Version
-    virtual Int_t MinorVersion()const{return fMinorVersion;}//Return Minor Version
-    //virtual void InitAliITSgeom();
-    virtual void Init();
-    //virtual void SetDefaults();
-    virtual void StepManager();
-    //for writing out geometry set .det write 
-    virtual void   SetWriteDet(Bool_t det=kTRUE){fGeomDetOut = det;}
-    virtual void   SetWriteDet(const char *f){strncpy(fWrite,f,60);
-                             fGeomDetOut = kTRUE;}// set write file 
-    //for reading geometry (JC) set .det read
-    virtual void   SetReadDet(Bool_t det=kTRUE){fGeomDetIn = det;}
-    virtual void   SetReadDet(const char *f){strncpy(fRead,f,60);
-                         fGeomDetIn = kTRUE;} // set read file
- public:
-    void AddSPDGeometry(TGeoVolume *moth) const;
-    void AddSDDGeometry(TGeoVolume *moth) const;
-    void AddSSDGeometry(TGeoVolume *moth) const;
-           //! ITS mother volume
-    static const Int_t fgkNumberOfSPD;       //number of SPD
-    static const Int_t fgkNumberOfSDD;       //number of SDD
-    static const Int_t fgkNumberOfSSD;       //number of SSD
-    // SPD specific
-    static const char*    fgSPDsensitiveVolName;  //SPD volume name
-    static const Double_t fgkSPDthickness;        //SPD thickness
-    static const Double_t fgkSPDwidth;            //SPD width
-    static const Double_t fgkSPDlength;           //SPD length
-    static const Double_t fgkSPDthickSens;        //SPD sensitive thickness
-    static const Double_t fgkSPDwidthSens;        //SPD sensitive width
-    static const Double_t fgkSPDlengthSens;       //SPD sensitive length
-    static const Double_t fgkSPD0y;               //SPD position
-    static const Double_t fgkSPD1y;               //SPD position
-    // SDD specific
-    static const char*    fgSDDsensitiveVolName;  //SDD volume name
-    static const Double_t fgkSDDthickness;        //SDD thickness
-    static const Double_t fgkSDDwidth;            //SDD width
-    static const Double_t fgkSDDlength;           //SDD length
-    static const Double_t fgkSDDthickSens;        //SDD sensitive thickness
-    static const Double_t fgkSDDwidthSens;        //SDD sensitive width
-    static const Double_t fgkSDDlengthSens;       //SDD sensitive length
-    static const Double_t fgkSDD0y;               //SDD position
-    static const Double_t fgkSDD1y;               //SDD position
-    // SDD specific
-    static const char*    fgSSDsensitiveVolName;   //SSD volume name
-    static const Double_t fgkSSDthickness;         //SSD thickness
-    static const Double_t fgkSSDwidth;             //SSD width
-    static const Double_t fgkSSDlength;            //SSD length
-    static const Double_t fgkSSDthickSens;         //SSD sensitive thickness
-    static const Double_t fgkSSDwidthSens;         //SSD sensitive width
-    static const Double_t fgkSSDlengthSens;        //SSD sensitive length
-    static const Double_t fgkSSD0y;                //SSD position
-    static const Double_t fgkSSD1y;                //SSD position
-    //
+
+
+  AliITSvBeamTestITS04();
+  AliITSvBeamTestITS04(const char* name,const char *title);
+  virtual ~AliITSvBeamTestITS04();
+
+  virtual void SetNumberOfSPD(Int_t nSPD) {fNspd=nSPD;}
+  virtual void SetNumberOfSDD(Int_t nSDD) {fNsdd=nSDD;}
+  virtual void SetNumberOfSSD(Int_t nSSD) {fNssd=nSSD;}
+
+  Int_t GetNSPD() const {return fNspd;}
+  Int_t GetNSDD() const {return fNsdd;}
+  Int_t GetNSSD() const {return fNssd;}
+
+  Int_t GetNumberOfSubDet(const TString& det) const;
+
+  virtual void CreateGeometry();
+  virtual void CreateMaterials();
+  virtual void InitAliITSgeom();
+  virtual void Init();
+  virtual void SetDefaults();
+  virtual void StepManager();
+  
+  //for writing out geometry
+   virtual void   SetWriteDet(Bool_t det=kTRUE){fGeomDetOut = det;}// set .det write 
+   virtual void   SetWriteDet(const char *f){strncpy(fWrite,f,60);fGeomDetOut = kTRUE;}// set write file 
+
+
+   //for reading geometry (JC)
+    
+  virtual void   SetReadDet(Bool_t det=kTRUE){fGeomDetIn = det;}//set .det read
+  virtual void   SetReadDet(const char *f){strncpy(fRead,f,60);fGeomDetIn = kTRUE;} // set read file
+                                    
+  
+ protected:
+  void AddSPDGeometry(TGeoVolume *moth) const;
+  void AddSDDGeometry(TGeoVolume *moth) const;
+  void AddSSDGeometry(TGeoVolume *moth) const;
+  Int_t GetCurrentLayLaddDet(Int_t &lay,Int_t &ladd, Int_t &det) const;
+
+  TGeoVolume *fITSmotherVolume;            //! ITS mother volume
+  static const Int_t fgkNumberOfSPD;       //number of SPD
+  static const Int_t fgkNumberOfSDD;       //number of SDD
+  static const Int_t fgkNumberOfSSD;       //number of SSD
+
+  static const char*    fgSPDsensitiveVolName;  //SPD volume name
+  static const Double_t fgkSPDthickness;        //SPD thickness
+  static const Double_t fgkSPDwidth;            //SPD width
+  static const Double_t fgkSPDlength;           //SPD length
+  static const Double_t fgkSPDthickSens;        //SPD sensitive thickness
+  static const Double_t fgkSPDwidthSens;        //SPD sensitive width
+  static const Double_t fgkSPDlengthSens;       //SPD sensitive length
+  static const Double_t fgkSPD0y;               //SPD position
+  static const Double_t fgkSPD1y;               //SPD position
+
+  static const char*    fgSDDsensitiveVolName;  //SDD volume name
+  static const Double_t fgkSDDthickness;        //SDD thickness
+  static const Double_t fgkSDDwidth;            //SDD width
+  static const Double_t fgkSDDlength;           //SDD length
+  static const Double_t fgkSDDthickSens;        //SDD sensitive thickness
+  static const Double_t fgkSDDwidthSens;        //SDD sensitive width
+  static const Double_t fgkSDDlengthSens;       //SDD sensitive length
+  static const Double_t fgkSDD0y;               //SDD position
+  static const Double_t fgkSDD1y;               //SDD position
+  
+  static const char*    fgSSDsensitiveVolName;   //SSD volume name
+  static const Double_t fgkSSDthickness;         //SSD thickness
+  static const Double_t fgkSSDwidth;             //SSD width
+  static const Double_t fgkSSDlength;            //SSD length
+  static const Double_t fgkSSDthickSens;         //SSD sensitive thickness
+  static const Double_t fgkSSDwidthSens;         //SSD sensitive width
+  static const Double_t fgkSSDlengthSens;        //SSD sensitive length
+  static const Double_t fgkSSD0y;                //SSD position
+  static const Double_t fgkSSD1y;                //SSD position
+
+  Int_t     fNspd;                    //Number of SPD modules
+  Int_t     fNsdd;                    //Number of SDD modules
+  Int_t     fNssd;                    //Number of SSD modules
+
+  //for writing out geometry
+   Bool_t fGeomDetOut;       // Flag to write .det file out 
+   Bool_t fGeomDetIn;        // Flag to read geometry file (JC)
+   char   fWrite[60];        //! file name to write .det file 
+   char   fRead[60];         // file name to read .det file (JC)
+   
  private:
-    //Int_t GetCurrentLayLaddDet(Int_t &lay,Int_t &ladd, Int_t &det) const;:
-    AliITSvBeamTestITS04(const AliITSvBeamTestITS04 &source);//Copy constructor
-    //=operator
-    AliITSvBeamTestITS04& operator=(const AliITSvBeamTestITS04 &source);
-    //
-    TGeoVolume *fITSmotherVolume; 
-    Int_t     fNspd;                    //Number of SPD modules
-    Int_t     fNsdd;                    //Number of SDD modules
-    Int_t     fNssd;                    //Number of SSD modules
-    //for writing out geometry
-    Bool_t fGeomDetOut;       // Flag to write .det file out 
-    Bool_t fGeomDetIn;        // Flag to read geometry file (JC)
-    char   fWrite[60];        //! file name to write .det file 
-    char   fRead[60];         // file name to read .det file (JC)
-    AliITSVersion_t fMajorVersion; // Major Version
-    Int_t           fMinorVersion; // Minor Version
-    AliITSInitGeometry fIgm; //! Init geometry object
-
-    ClassDef(AliITSvBeamTestITS04,3) // Full ITS test beam geometry 2004
-};
+   AliITSvBeamTestITS04(const AliITSvBeamTestITS04 &source); // Copy constructor
+   AliITSvBeamTestITS04& operator=(const AliITSvBeamTestITS04 &source); // = operator
+
+   ClassDef(AliITSvBeamTestITS04,2) 
+
+ };
 
 #endif
 
diff --git a/ITS/AliITSvPPRasymmFMD.cxx b/ITS/AliITSvPPRasymmFMD.cxx
index 040308a8355..3e9e762879a 100644
--- a/ITS/AliITSvPPRasymmFMD.cxx
+++ b/ITS/AliITSvPPRasymmFMD.cxx
@@ -70,26 +70,19 @@
 ClassImp(AliITSvPPRasymmFMD)
  
 //______________________________________________________________________
-AliITSvPPRasymmFMD::AliITSvPPRasymmFMD():
-AliITS(),                    // Default AliITS Constructor
-fGeomDetOut(kFALSE),         // Flag to write .det file out
-fGeomDetIn(kFALSE),          // Flag to read .det file or directly from Geat.
-fByThick(kTRUE),             // Flag to use services materials by thickness
-                             // ture, or mass false.
-fMajorVersion(IsVersion()),  // Major version number == IsVersion
-fMinorVersion(2),           // Minor version number
-fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),// file where detector transormation are define.
-fRead("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm.det"),//! file name to read .det file
-fWrite("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),//! file name to write .det file
-fDet1(200.0),	   // thickness of detector in SPD layer 1 [microns]
-fDet2(200.0),	   // thickness of detector in SPD layer 2 [microns]
-fChip1(150.0),	   // thickness of chip in SPD layer 1 [microns]
-fChip2(150.0),	   // thickness of chip in SPD layer 2 [microns]
-fRails(0),         // flag to switch rails on (=1) and off (=0)
-fFluid(1),         // flag to switch between water (=1)& freon (=0)
-fIDMother(0),      //! ITS Mother Volume id.
-fIgm((AliITSVersion_t)fMajorVersion,fMinorVersion)//! Get access to decoding 
-                                               // and AliITSgeom init functions
+AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(): AliITS(),
+fGeomDetOut(kFALSE),
+fGeomDetIn(kFALSE),
+fByThick(kTRUE),
+fMajorVersion(IsVersion()),
+fMinorVersion(-1),
+fDet1(0),
+fDet2(0),
+fChip1(0),
+fChip2(0),
+fRails(0),
+fFluid(0),
+fIDMother(0)
  {
     //    Standard default constructor for the ITS version 10.
     // Inputs:
@@ -98,79 +91,27 @@ fIgm((AliITSVersion_t)fMajorVersion,fMinorVersion)//! Get access to decoding
     //   none.
     // Return:
     //   none.
-    fIgm.SetGeometryName("");
-}
-//______________________________________________________________________
-AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(const Char_t *title):
-AliITS(title),               // Standard AliITS Constructor
-fGeomDetOut(kFALSE),         // Flag to write .det file out
-fGeomDetIn(kFALSE),          // Flag to read .det file or directly from Geat.
-fByThick(kTRUE),             // Flag to use services materials by thickness
-                             // ture, or mass false.
-fMajorVersion(IsVersion()),  // Major version number == IsVersion
-fMinorVersion(2),            // Minor version number
-fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),// file where detector transormation are define.
-fRead("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm.det"),//! file name to read .det file
-fWrite("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),//! file name to write .det file
-fDet1(200.0),	   // thickness of detector in SPD layer 1 [microns]
-fDet2(200.0),	   // thickness of detector in SPD layer 2 [microns]
-fChip1(150.0),	   // thickness of chip in SPD layer 1 [microns]
-fChip2(150.0),	   // thickness of chip in SPD layer 2 [microns]
-fRails(0),         // flag to switch rails on (=1) and off (=0)
-fFluid(1),         // flag to switch between water (=1)& freon (=0)
-fIDMother(0),      //! ITS Mother Volume id.
-fIgm((AliITSVersion_t)fMajorVersion,fMinorVersion)//! Get access to decoding 
-                                               // and AliITSgeom init functions
-{
-    //    Standard constructor for the ITS version 10.
-    // Inputs:
-    //   const Char_t * title  Arbitrary title
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
     Int_t i;
-
-    fIgm.SetDecoding(kFALSE);// Use Alice compliant naming/numbering system
-    fIgm.SetTiming(kFALSE);// default no timing
-    fIgm.SetSegGeom(kFALSE);// use AliITSgeomS?D classes instead 
-                            // of segmentation AliITSsegmentationS?D class
-    fIgm.SetGeometryName("ITS PPR aymmetric services with course"
-                         " cables on cones");
-    // Set some AliITS class veriables.
-    fIdN = 6;
-    fIdName = new TString[fIdN];
-    fIdName[0] = "ITS1";
-    fIdName[1] = "ITS2";
-    fIdName[2] = "ITS3";
-    fIdName[3] = "ITS4";
-    fIdName[4] = "ITS5";
-    fIdName[5] = "ITS6";
-    fIdSens    = new Int_t[fIdN];
-    for(i=0;iGsvolu("ITSV", "PCON", idtmed[205], dgh, 51);
 
-//     dgh[0] = 0.;
-//     dgh[1] = 360.;
-//     dgh[2] = 16.;
-//     dgh[3] = -ztpc-5.-0.1;
-//     dgh[4] = 46;   
-//     dgh[5] = 85.;
-//     dgh[6] = -ztpc;
-//     dgh[7] = 46;   
-//     dgh[8] = 85.;
-//     dgh[9] = -ztpc;
-//     dgh[10] = 46;  
-//     dgh[11] = rlim+7.5;
-//     dgh[12] = -97.5;
-//     dgh[13] = 46;  
-//     dgh[14] = rlim+7.5;
-//     dgh[15] = -zmax;
-//     dgh[16] = 46;  
-//     dgh[17] = rlim+7.5;
-//     dgh[18] = -48;   
-//     dgh[19] = 6;
-//     dgh[20] = rlim+7.5;
-//     dgh[21] = -28.6;   
-//     dgh[22] = 6;
-//     dgh[23] = rlim+7.5;    
-//     dgh[24] = -27.6;  
-//     dgh[25] = 3.295;
-//     dgh[26] = rlim+7.5; 
-//     dgh[27] = 27.6;   
-//     dgh[28] = 3.295;
-//     dgh[29] = rlim+7.5;
-//     dgh[30] = 28.6;   
-//     dgh[31] = 6;
-//     dgh[32] = rlim+7.5;
-//     dgh[33] = 48;   
-//     dgh[34] = 6;
-//     dgh[35] = rlim+7.5;  
-//     dgh[36] = zmax;
-//     dgh[37] = 46;
-//     dgh[38] = rlim+7.5;
-//     dgh[39] = 97.5;
-//     dgh[40] = 46;  
-//     dgh[41] = rlim+7.5;
-//     dgh[42] = ztpc;
-//     dgh[43] = 62;     
-//     dgh[44] = 62+4.;  
-//     dgh[45] = ztpc;
-//     dgh[46] = 62;     
-//     dgh[47] = 85.;
-//     dgh[48] = ztpc+4.+0.1;
-//     dgh[49] = 62.0;//62.4;
-//     dgh[50] = 85.;
-//     gMC->Gsvolu("ITSV", "PCON", idtmed[205], dgh, 51);
-    TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-      itsV->SetTitle(vstrng);
-    
     // --- Place the ghost volume in its mother volume (ALIC) and make it 
     //     invisible
-    //    gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., idrotm[199], "MANY");
-    TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
-    if(alic==0) {
-        Error("CreateGeometry","alic=0");
-        return;
-    } // end if
-    // See idrotm[199] for angle definitions.
-    alic->AddNode(itsV,1,new TGeoRotation("", 90.,180., 90.,90., 180.,0.));
+    //    gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., 0, "ONLY");
+    gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., idrotm[199], "MANY");
+    //gMC->Gsatt("ITSV", "SEEN", 0);
 
     // --- Define ghost volume containing the six layers and fill it with air 
   
@@ -6064,7 +5930,6 @@ void AliITSvPPRasymmFMD::DrawModule() const{
     gMC->Gdhead(1111, "Inner Tracking System Version 1");
     gMC->Gdman(17, 6, "MAN");
 }
-/*
 //______________________________________________________________________
 void AliITSvPPRasymmFMD::StepManager(){
     //    Called for every step in the ITS, then calles the AliITShit class
@@ -6198,258 +6063,3 @@ void AliITSvPPRasymmFMD::StepManager(){
 
     return;
 }
-
-*/
-//______________________________________________________________________
-void AliITSvPPRasymmFMD::StepManager(){
-    //    Called for every step in the ITS, then calles the AliITShit class
-    // creator with the information to be recoreded about that hit.
-    //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
-    // printing of information to a file which can be used to create a .det
-    // file read in by the routine CreateGeometry(). If set to 0 or any other
-    // value except 1, the default behavior, then no such file is created nor
-    // it the extra variables and the like used in the printing allocated.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-
-    if(!(this->IsActive())) return;
-    if(!(gMC->TrackCharge())) return;
-
-    Int_t  copy, id,kk;
-    Bool_t sensvol = kFALSE;
-
-    id = gMC->CurrentVolID(copy);
-    for(kk=0;kkIsTrackExiting())){
-        copy = fTrackReferences->GetEntriesFast();
-        TClonesArray &lTR = *fTrackReferences;
-        // Fill TrackReference structure with this new TrackReference.
-        new(lTR[copy]) AliTrackReference(
-            gAlice->GetMCApp()->GetCurrentTrackNumber());
-    } // if Outer ITS mother Volume
-    //if(!sensvol) return; // not an ITS tracking volume;
-
-    static TLorentzVector position, momentum; // Saves on calls to construtors
-    static AliITShit hit;// Saves on calls to construtors
-    Int_t   cpn0,cpn1,cpn2,status,mod;
-    //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
-    TClonesArray &lhits = *(Hits());
-    //
-    // Track status
-    status = 0;
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
-    //
-    switch (kk){
-    case 0:case 1: // SPD
-        gMC->CurrentVolOffID(2,cpn2);
-        gMC->CurrentVolOffID(3,cpn1);
-        gMC->CurrentVolOffID(4,cpn0);
-        break;
-    case 2:case 3: // SDD
-        cpn2 = 1;
-        gMC->CurrentVolOffID(1,cpn1);
-        gMC->CurrentVolOffID(2,cpn0);
-        break;
-    case 4:case 5: // SSD
-        cpn2 = 1;
-        gMC->CurrentVolOffID(1,cpn1);
-        gMC->CurrentVolOffID(2,cpn0);
-        break;
-    default:
-        Error("StepManager","Unknown volume kk=%d",kk);
-        return; // not an ITS sensitive volume.
-    } //
-    fIgm.DecodeDetector(mod,kk+1,cpn0,cpn1,cpn2);
-    //Info("StepManager","lay=%d mod=%d cpn0=%d cpn1=%d cpn2=%d",kk+1,mod,cpn0,cpn1,cpn2);
-    Int_t lay,lad,det,cpy0,cpy1,cpy2;
-    fIgm.DecodeDetectorLayers(mod,lay,lad,det);
-    fIgm.RecodeDetector(mod,cpy0,cpy1,cpy2);
-//     printf("gMC: kk=%d cpn0=%d cpn1=%d cpn2=%d -> mod=%d -> "
-//            "lay=%d lad=%d det=%d -> cpn0=%d cpn1=%d cpn2=%d\n",
-//            kk,cpn0,cpn1,cpn2,mod,lay,lad,det,cpy0,cpy1,cpy2);
-    //
-    // Fill hit structure.
-    //
-    hit.SetModule(mod);
-    hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
-    gMC->TrackPosition(position);
-    gMC->TrackMomentum(momentum);
-    hit.SetPosition(position);
-    hit.SetTime(gMC->TrackTime());
-    hit.SetMomentum(momentum);
-    hit.SetStatus(status);
-    hit.SetEdep(gMC->Edep());
-    hit.SetShunt(GetIshunt());
-    if(gMC->IsTrackEntering()){
-        hit.SetStartPosition(position);
-        hit.SetStartTime(gMC->TrackTime());
-        hit.SetStartStatus(status);
-        return; // don't save entering hit.
-    } // end if IsEntering
-    // Fill hit structure with this new hit.
-    //Info("StepManager","Calling Copy Constructor");
-    new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
-    // Save old position... for next hit.
-    hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
-    hit.SetStartStatus(status);
-    //
-    /*
-    Int_t idettype,ix,iz;
-    Float_t lx,lz;
-    Double_t g0[4],l0[4],g1[4];
-    position.GetXYZT(g0);
-    gMC->Gmtod(g0,l0,1); // flag=1 convert coordiantes
-    gMC->Gdtom(l0,g1,1); // flag=1 convert coordinates
-    switch(idettype=(Int_t)GetITSgeom()->GetModuleType(mod)){
-    case kSPD:
-        AliITSsegmentationSPD *segspd = (AliITSsegmentationSPD *)GetSegmentationModelByModule(mod);
-        segspd->LocalToDet((Float_t)l0[0],(Float_t)l0[2],ix,iz);
-        segspd->DetToLocal(ix,iz,lx,lz);
-        break;
-    case kSDD:
-        AliITSsegmentationSDD *segsdd = (AliITSsegmentationSDD *)GetSegmentationModelByModule(mod);
-        segsdd->LocalToDet((Float_t)l0[0],(Float_t)l0[2],ix,iz);
-        segsdd->DetToLocal(ix,iz,lx,lz);
-        break;
-    case kSSD:
-        AliITSsegmentationSSD *segssd = (AliITSsegmentationSSD *)GetSegmentationModelByModule(mod);
-        segssd->LocalToDet((Float_t)l0[0],(Float_t)l0[2],ix,iz);
-        segssd->DetToLocal(ix,iz,lx,lz);
-        break;
-    default:
-        ix = iz = -1;
-        lx = lz = 0.0;
-        Warning("StepManager","Unknown module type id=%d mod=%d",
-                (Int_t)(GetITSgeom()->GetModuleType(mod)),mod);
-    } // end if
-    printf("    gMC: mod=%d g=%g %g %g %g -> "
-                           "l=%g %g %g %g -> "
-                           "g=%g %g %g %g -> "
-                           "ix=%d iz=%d -> lx=%g lz=%g\n",
-           mod,g0[0],g0[1],g0[2],g0[3],
-               l0[0],l0[1],l0[2],l0[3],
-               g1[0],g1[1],g1[2],g1[3],ix,iz,lx,lz);
-    GetITSgeom()->GtoL(mod,g0,l0);
-    GetITSgeom()->LtoG(mod,l0,g1);
-    printf("ITSgeom: mod=%d g=%g %g %g %g -> "
-                           "l=%g %g %g %g -> "
-                           "g=%g %g %g %g -> "
-                           "ix=%d iz=%d -> lx=%g lz=%g\n",
-           mod,g0[0],g0[1],g0[2],g0[3],
-               l0[0],l0[1],l0[2],l0[3],
-               g1[0],g1[1],g1[2],g1[3],ix,iz,lx,lz);
-    TGeoNode *cur = gGeoManager->GetCurrentNode();
-    cur->MasterToLocal(g0,l0);
-    cur->LocalToMaster(l0,g1);
-    printf("   TGeo: mod=%d g=%g %g %g %g -> "
-                           "l=%g %g %g %g -> "
-                           "g=%g %g %g %g\n",
-           mod,g0[0],g0[1],g0[2],g0[3],
-               l0[0],l0[1],l0[2],l0[3],
-               g1[0],g1[1],g1[2],g1[3]);
-    printf("=====================\n");
-    //
-    */
-    return;
-}
-//______________________________________________________________________
-void AliITSvPPRasymmFMD::PrintAscii(ostream *os)const{
-    // Print out class data values in Ascii Form to output stream
-    // Inputs:
-    //   ostream *os   Output stream where Ascii data is to be writen
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-#if defined __GNUC__
-#if __GNUC__ > 2
-    ios::fmtflags fmt;
-#else
-    Int_t fmt;
-#endif
-#else
-#if defined __ICC || defined __ECC || defined __xlC__
-    ios::fmtflags fmt;
-#else
-    Int_t fmt;
-#endif
-#endif
-
-    *os << fGeomDetOut << " " << fGeomDetIn << " " << fByThick << " ";
-    *os << fMajorVersion << " " << fMinorVersion << " ";
-    *os << "\"" << fEuclidGeomDet.Data() << "\"" << " ";
-    *os << "\"" << fRead.Data() << "\"" << " ";
-    *os << "\"" << fWrite.Data() << "\"" << " ";
-    fmt = os->setf(ios::scientific); // set scientific floating point output
-    *os << fDet1 << " "  << fDet2 << " " << fChip1 << " " << fChip2 << " ";
-    *os << fRails << " " << fFluid << " " << fIDMother;
-    os->flags(fmt); // reset back to old Formating.
-    return;
-}
-//______________________________________________________________________
-void AliITSvPPRasymmFMD::ReadAscii(istream *is){
-    // Read in class data values in Ascii Form to output stream
-    // Inputs:
-    //   istream *is   Input stream where Ascii data is to be read in from
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-    Char_t name[120];
-
-    *is >> fGeomDetOut >> fGeomDetIn >> fByThick;
-    *is >> fMajorVersion >> fMinorVersion;
-    *is >> name;
-    fEuclidGeomDet = name;
-    *is >> name;
-    fRead = name;
-    *is >> name;
-    fWrite = name;
-    *is >> fDet1 >> fDet2 >> fChip1 >> fChip2;
-    *is >> fRails >> fFluid >> fIDMother;
-    fIgm.SetVersion((AliITSVersion_t)fMajorVersion,fMinorVersion);
-    fIgm.SetGeometryName("ITS PPR aymmetric services with course"
-                         " cables on cones");
-}
-//______________________________________________________________________
-ostream &operator<<(ostream &os,const AliITSvPPRasymmFMD &s){
-    // Standard output streaming function
-    // Inputs:
-    //   ostream            &os  output steam
-    //   AliITSvPPRasymmFMD &s class to be streamed.
-    // Output:
-    //   none.
-    // Return:
-    //   ostream &os  The stream pointer
-
-    s.PrintAscii(&os);
-    return os;
-}
-//______________________________________________________________________
-istream &operator>>(istream &is,AliITSvPPRasymmFMD &s){
-    // Standard inputput streaming function
-    // Inputs:
-    //   istream            &is  input steam
-    //   AliITSvPPRasymmFMD &s class to be streamed.
-    // Output:
-    //   none.
-    // Return:
-    //   ostream &os  The stream pointer
-
-    s.ReadAscii(&is);
-    return is;
-}
diff --git a/ITS/AliITSvPPRasymmFMD.h b/ITS/AliITSvPPRasymmFMD.h
index 3c4d4ac59b4..ad95bb68b56 100644
--- a/ITS/AliITSvPPRasymmFMD.h
+++ b/ITS/AliITSvPPRasymmFMD.h
@@ -10,14 +10,11 @@
 /////////////////////////////////////////////////////////
  
 #include "AliITS.h"
-#include "AliITSInitGeometry.h"
-
+ 
 class AliITSvPPRasymmFMD : public AliITS {
 
  public:
     AliITSvPPRasymmFMD();
-    AliITSvPPRasymmFMD(const Char_t *title); // Standard Constructor
-    // Extended Standard constructor
     AliITSvPPRasymmFMD(const char *name, const char *title);
     virtual       ~AliITSvPPRasymmFMD() ;
     virtual void   BuildGeometry();
@@ -30,17 +27,16 @@ class AliITSvPPRasymmFMD : public AliITS {
     virtual void   DrawModule() const;
     virtual void   StepManager();
     virtual void   AddAlignableVolumes() const;
-    //set .det write
-    virtual void  SetWriteDet(Bool_t det=kFALSE){fGeomDetOut=det;}
-    // set write file
-    virtual void   SetWriteDet(const Char_t *f){fWrite=f;fGeomDetOut=kTRUE;}
-    //set .det read
-    virtual void   SetReadDet(Bool_t det=kFALSE){fGeomDetIn = det;}
-    // set read file
-    virtual void   SetReadDet(const Char_t *f){fRead=f;fGeomDetIn=kTRUE;}
-    // set write file
-    virtual void   SetEUCLIDFileName(const Char_t *f){fEuclidGeometry=f;
-                                                          SetEUCLID();}
+    virtual void   SetWriteDet(Bool_t det=kFALSE){ // set .det write
+	                                         fGeomDetOut = det;}
+    virtual void   SetWriteDet(const char *f){ // set write file
+	                             strncpy(fWrite,f,60);fGeomDetOut = kTRUE;}
+    virtual void   SetReadDet(Bool_t det=kFALSE){ //set .det read
+	                                        fGeomDetIn = det;}
+    virtual void   SetReadDet(const char *f){ // set read file
+	                               strncpy(fRead,f,60);fGeomDetIn = kTRUE;}
+    virtual void   SetEUCLIDFileName(const char *f){ // set write file
+	                     fEuclidGeometry=f; SetEUCLID();}
     virtual void   SetMinorVersion(Int_t v=2){ // Choose between existing minor versions
 	fMinorVersion = v;}
     virtual void   SetThicknessDet1(Float_t v=200.){ 
@@ -67,18 +63,16 @@ class AliITSvPPRasymmFMD : public AliITS {
     virtual void SetDensityServicesByMass(){// uses services density
 	// calculation based on the Mass of the services.
 	fByThick = kFALSE;}
-    virtual const Char_t *GetEULIIDFileName() const{ // return .euc file name
-        return fEuclidGeometry.Data();}
-    // returns value GeomDetOut flag.
-    virtual Bool_t GetWriteDet() const {return fGeomDetOut;}
-    // returns value GeomDetIn flag.
-    virtual Bool_t GetReadDet() const{return fGeomDetIn;} 
-    virtual const Char_t *GetReadDetFileName()const{//return .det read file name
-        if(fRead.IsNull()) return fRead.Data();
-        else return GetEULIIDFileName();}
-    virtual const Char_t *GetWriteDetFileName()const{//return .det write file name
-        if(fWrite.IsNull()) return fWrite.Data();
-        else return GetEULIIDFileName();}
+    virtual const char  *GetEULIIDFileName() const{ // return .euc file name
+	                               return fEuclidGeometry.Data();}
+    virtual Bool_t GetWriteDet() const { // returns value GeomDetOut flag.
+	                          return fGeomDetOut;}
+    virtual Bool_t GetReadDet() const { // returns value GeomDetIn flag.
+	                         return fGeomDetIn;}
+    virtual char  *GetReadDetFileName(){ // return .det read file name
+	          if(fRead[0]!='\0') return fRead; else return fEuclidGeomDet;}
+    virtual char  *GetWriteDetFileName(){ // return .det write file name
+	        if(fWrite[0]!='\0') return fWrite; else return fEuclidGeomDet;}
     virtual Int_t GetMajorVersion() const {// return Major Version Number
 	return fMajorVersion;}
     virtual Int_t GetMinorVersion() const {// return Major Version Number
@@ -101,50 +95,32 @@ class AliITSvPPRasymmFMD : public AliITS {
     virtual Int_t GetCoolingFluid() const{ 
 	 // Get flag for cooling fluid
 	 return fFluid;}
-    //
-    // Print class in ascii form to stream
-    virtual void PrintAscii(ostream *os)const;
-    // Read in class in ascii form from stream
-    virtual void ReadAscii(istream *is);
 
  private:
-    // copy constructor. Will not copy class, just gives warning.
-    AliITSvPPRasymmFMD(const AliITSvPPRasymmFMD &source);
-    // assignment operator. Will not copy class, just gives warning.
-    AliITSvPPRasymmFMD& operator=(const AliITSvPPRasymmFMD &source);
+    AliITSvPPRasymmFMD(const AliITSvPPRasymmFMD &source); // copy constructor
+    AliITSvPPRasymmFMD& operator=(const AliITSvPPRasymmFMD &source); // assignment operator
     void InitAliITSgeom();
-    Bool_t IsDensityServicesByThickness()const {return fByThick;}
-    // returns Euclid file name with where Euclid geometry is kept.
-    const TString & GetEuclidFile()const{return fEuclidGeomDet;}
-    // Return Mother volume ID
-    Int_t GetMotherID()const {return fIDMother;}
-    // Return AliITSInitGeometry object
-    const AliITSInitGeometry & GetGeomInit()const{return fIgm;}
 
     // TString fEuclidGeomtery,fEuclidMaterial defined in AliModule.
-    Bool_t  fGeomDetOut;    // Flag to write .det file out
-    Bool_t  fGeomDetIn;     // Flag to read .det file or directly from Geat.
-    Bool_t  fByThick;       // Flag to use services materials by thickness
-                            // ture, or mass false.
-    Int_t   fMajorVersion;  // Major version number == IsVersion
-    Int_t   fMinorVersion;  // Minor version number
-    TString fEuclidGeomDet; // file where detector transormation are define.
-    TString fRead;          //! file name to read .det file
-    TString fWrite;         //! file name to write .det file
-    Float_t fDet1;	    // thickness of detector in SPD layer 1
-    Float_t fDet2;          // thickness of detector in SPD layer 2
-    Float_t fChip1;         // thickness of chip in SPD layer 1   
-    Float_t fChip2;         // thickness of chip in SPD layer 2   
-    Int_t   fRails;         // flag to switch rails on (=1) and off (=0)
-    Int_t   fFluid;         // flag to switch between water (=1) and freon (=0)
-    Int_t   fIDMother;      //! ITS Mother Volume id.
-    AliITSInitGeometry fIgm;//! Get access to decoding and AliITSgeom init functins
+    Bool_t fGeomDetOut;       // Flag to write .det file out
+    Bool_t fGeomDetIn;        // Flag to read .det file or directly from Geat.
+    Bool_t fByThick;          // Flag to use services materials by thickness
+                              // ture, or mass false.
+    Int_t  fMajorVersion;     // Major version number == IsVersion
+    Int_t  fMinorVersion;     // Minor version number
+    char   fEuclidGeomDet[60];// file where detector transormation are define.
+    char   fRead[60];         //! file name to read .det file
+    char   fWrite[60];        //! file name to write .det file
+    Float_t  fDet1;	      // thickness of detector in SPD layer 1
+    Float_t  fDet2;	      // thickness of detector in SPD layer 2
+    Float_t  fChip1;	      // thickness of chip in SPD layer 1   
+    Float_t  fChip2;	      // thickness of chip in SPD layer 2   
+    Int_t    fRails;          // flag to switch rails on (=1) and off (=0)
+    Int_t    fFluid;          // flag to switch between water (=1) and freon (=0)
+    Int_t fIDMother;          //! ITS Mother Volume id.
 
-    ClassDef(AliITSvPPRasymmFMD,4) //Hits manager for set:ITS version 10
-                                   // PPR detailed Geometry asymmetric
+    ClassDef(AliITSvPPRasymmFMD,3)  //Hits manager for set:ITS version 8 
+                                 // PPR detailed Geometry asymmetric
 };
-// Input and output function for standard C++ input/output.
-ostream &operator<<(ostream &os,const AliITSvPPRasymmFMD &s);
-istream &operator>>(istream &is,AliITSvPPRasymmFMD &s);
-
+ 
 #endif
diff --git a/ITS/AliITSvPPRcoarseasymm.cxx b/ITS/AliITSvPPRcoarseasymm.cxx
index 8befa6e4c7e..b67f38f371a 100644
--- a/ITS/AliITSvPPRcoarseasymm.cxx
+++ b/ITS/AliITSvPPRcoarseasymm.cxx
@@ -39,7 +39,7 @@
 #include 
 #include 
 #include 
-#include 
+
 
 #include "AliMagF.h"
 #include "AliConst.h"
@@ -52,12 +52,10 @@ ClassImp(AliITSvPPRcoarseasymm)
  
 //_____________________________________________________________________________
 AliITSvPPRcoarseasymm::AliITSvPPRcoarseasymm():
-AliITS(),
-fMajorVersion(IsVersion()),
+fMajorVersion(9),
 fMinorVersion(0),
 fRails(0),
-fSuppMat(0),
-fIgm(kvPPRcourseasymm) {
+fSuppMat(0) {
 ////////////////////////////////////////////////////////////////////////
 //    Standard default constructor for the ITS version 6.
 ////////////////////////////////////////////////////////////////////////
@@ -67,13 +65,11 @@ fIgm(kvPPRcourseasymm) {
     fIdSens    = 0;
 }
 //_____________________________________________________________________________
-AliITSvPPRcoarseasymm::AliITSvPPRcoarseasymm(const char *name, const char *title) : 
-AliITS(name, title),
-fMajorVersion(IsVersion()),
+AliITSvPPRcoarseasymm::AliITSvPPRcoarseasymm(const char *name, const char *title) : AliITS(name, title),
+fMajorVersion(9),
 fMinorVersion(0),
 fRails(0),
-fSuppMat(0),
-fIgm(kvPPRcourseasymm) {
+fSuppMat(0) {
 ////////////////////////////////////////////////////////////////////////
 //    Standard constructor for the ITS version 6.
 ////////////////////////////////////////////////////////////////////////
@@ -144,161 +140,137 @@ void AliITSvPPRcoarseasymm::BuildGeometry(){
 }
 //_____________________________________________________________________________
 void AliITSvPPRcoarseasymm::CreateGeometry(){
-    ////////////////////////////////////////////////////////////////////////
-    // This routine defines and Creates the geometry for version 6 of the ITS.
-    ////////////////////////////////////////////////////////////////////////
-  
-    //INNER RADII OF THE SILICON LAYERS 
-    Float_t rl[6]    = { 3.8095,7.,15.,24.,38.5,43.5765 };   
-    //THICKNESSES OF LAYERS (in % radiation length)
-    Float_t drl[6]   = { 1.03,1.03,0.94,0.95,0.91,0.87 };   
-    //HALF LENGTHS OF LAYERS  
-    Float_t dzl[6]   = { 14.35,14.35,25.1,32.1,49.405,55.27 };
-    //LENGTHS OF END-LADDER BOXES (ALL INCLUDED)
-    Float_t dzb[6]   = { 12.4,12.4,13.5,15.,7.5,7.5 };   
-    //THICKNESSES OF END-LADDER BOXES (ALL INCLUDED)
-    Float_t drb[6]   = { rl[1]-rl[0],0.2,5.,5.,4.,4. };        
+////////////////////////////////////////////////////////////////////////
+//    This routine defines and Creates the geometry for version 6 of the ITS.
+////////////////////////////////////////////////////////////////////////
+  
+  //INNER RADII OF THE SILICON LAYERS 
+  Float_t rl[6]    = { 3.8095,7.,15.,24.,38.5,43.5765 };   
+  //THICKNESSES OF LAYERS (in % radiation length)
+  Float_t drl[6]   = { 1.03,1.03,0.94,0.95,0.91,0.87 };   
+  //HALF LENGTHS OF LAYERS  
+  Float_t dzl[6]   = { 14.35,14.35,25.1,32.1,49.405,55.27 };
+  //LENGTHS OF END-LADDER BOXES (ALL INCLUDED)
+  Float_t dzb[6]   = { 12.4,12.4,13.5,15.,7.5,7.5 };   
+  //THICKNESSES OF END-LADDER BOXES (ALL INCLUDED)
+  Float_t drb[6]   = { rl[1]-rl[0],0.2,5.,5.,4.,4. };        
 
  
-    Float_t dits[3], rlim, zmax;
-    Float_t zpos;
-    Float_t pcits[100], ztpc;
-    Int_t idrotm[1999], i;
-    Float_t dgh[100];
-  
-    Int_t rails = 1;       // flag for rails (1 --> rails in; 0 --> rails out)
-    Int_t suppmat = 0;     // flag to change the material of the services
-                           // supports (=0 copper, =1 aluminum, =2 carbon)
-    // These constant character strings are set by cvs during commit
-    // do not change them unless you know what you are doing!
-    const Char_t *cvsDate="$Date$";
-    const Char_t *cvsRevision="$Revision$";
-    rails = GetRails();
-  
-    if(rails != 0 && rails != 1) {
-        cout << "ITS - WARNING: the switch for rails is not set "
-            "neither to 0 (rails out) nor to 1 (rails in)." 
-            " The default value of 1 (rails in) will be used." << endl;
-    }  // end if
-  
-    if (rails == 0 ) {
-        cout << "ITS: Rails are out." << endl; 
-    } else {
-        cout << "ITS: Rails are in." << endl;
-    } // end if 
-    suppmat = GetSupportMaterial();   
-  
-    if (suppmat != 0 && suppmat != 1 && suppmat != 2) {
-        cout << "ITS - WARNING: the flag for the material of "
-            "services supports is not set neither to 0 (copper) "
-            "nor to 1 (aluminum) nor to 2 (carbon)." 
-            " The default value of 0 (copper) will be used." << endl;
-    }   // end if
-  
-    if (suppmat == 0) {
-        cout << "ITS: The material of the services supports is copper." 
-             << endl; 
-    } else if (suppmat == 1){
-        cout << "ITS: The material of the services supports is aluminum." 
-             << endl;
-    } else {
-        cout << "ITS: The material of the services supports is carbon." 
-             << endl;
-    } // end if
+  Float_t dits[3], rlim, zmax;
+  Float_t zpos;
+  Float_t pcits[100], ztpc;
+  Int_t idrotm[1999], i;
+  Float_t dgh[100];
+  
+  Int_t rails = 1;       // flag for rails (1 --> rails in; 0 --> rails out)
+  Int_t suppmat = 0;     // flag to change the material of the services
+                         // supports (=0 copper, =1 aluminum, =2 carbon)  
+  rails = GetRails();
+  
+  if(rails != 0 && rails != 1) {
+     cout << "ITS - WARNING: the switch for rails is not set neither to 0 (rails out) nor to 1 (rails in)." 
+     " The default value of 1 (rails in) will be used." << endl;
+  }  
+  
+  if (rails == 0 ) {
+     cout << "ITS: Rails are out." << endl; 
+  } else {
+     cout << "ITS: Rails are in." << endl;
+  }      
+  
+  suppmat = GetSupportMaterial();   
+  
+  if (suppmat != 0 && suppmat != 1 && suppmat != 2) {
+     cout << "ITS - WARNING: the flag for the material of services supports is not set neither to 0 (copper) nor to 1 (aluminum) nor to 2 (carbon)." 
+     " The default value of 0 (copper) will be used." << endl;
+  }  
+  
+  if (suppmat == 0) {
+     cout << "ITS: The material of the services supports is copper." << endl; 
+  } else if (suppmat == 1){
+     cout << "ITS: The material of the services supports is aluminum." << endl;
+  } else {
+     cout << "ITS: The material of the services supports is carbon." << endl;
+  }      
       
 
-    Int_t *idtmed = fIdtmed->GetArray()-199;
+  Int_t *idtmed = fIdtmed->GetArray()-199;
   
-    //     CONVERT INTO CM (RL(SI)=9.36 CM) 
-    for (i = 0; i < 6; ++i) {
-        drl[i] = drl[i] / 100. * 9.36;
-    } // end if
+  //     CONVERT INTO CM (RL(SI)=9.36 CM) 
+  for (i = 0; i < 6; ++i) {
+    drl[i] = drl[i] / 100. * 9.36;
+  }
     
-    //     FIELD CAGE HALF LENGTH 
-  
-    rlim  = 50.;
-    zmax  = 74.;
-    ztpc = 284.;
-  
-    // --- Define ghost volume containing the whole ITS (including services) 
-    //     and fill it with air 
-    /*
-    dgh[0] = 0.;
-    dgh[1] = 360.;
-    dgh[2] = 16.;
-    dgh[3] = -ztpc-5.-0.1;
-    dgh[4] = 46;   
-    dgh[5] = 85.;
-    dgh[6] = -ztpc;
-    dgh[7] = 46;   
-    dgh[8] = 85.;
-    dgh[9] = -ztpc;
-    dgh[10] = 46;  
-    dgh[11] = rlim+6;
-    dgh[12] = -97.5;
-    dgh[13] = 46;  
-    dgh[14] = rlim+6;
-    dgh[15] = -zmax;
-    dgh[16] = 46;  
-    dgh[17] = rlim+6;
-    dgh[18] = -48;   
-    dgh[19] = 6;
-    dgh[20] = rlim+6;
-    dgh[21] = -28.6;   
-    dgh[22] = 6;
-    dgh[23] = rlim+6;    
-    dgh[24] = -27.6;  
-    dgh[25] = 3.295;
-    dgh[26] = rlim+6; 
-    dgh[27] = 27.6;   
-    dgh[28] = 3.295;
-    dgh[29] = rlim+6;
-    dgh[30] = 28.6;   
-    dgh[31] = 6;
-    dgh[32] = rlim+6;
-    dgh[33] = 48;   
-    dgh[34] = 6;
-    dgh[35] = rlim+6;  
-    dgh[36] = zmax;
-    dgh[37] = 46;
-    dgh[38] = rlim+6;
-    dgh[39] = 97.5;
-    dgh[40] = 46;  
-    dgh[41] = rlim+6;
-    dgh[42] = ztpc;
-    dgh[43] = 62;     
-    dgh[44] = 62+4.;  
-    dgh[45] = ztpc;
-    dgh[46] = 62;     
-    dgh[47] = 85.;
-    dgh[48] = ztpc+4.+0.1;
-    dgh[49] = 62.4;
-    dgh[50] = 85.;
-    gMC->Gsvolu("ITSV", "PCON", idtmed[275], dgh, 51);
-  
-    // --- Place the ghost volume in its mother volume (ALIC) and make it 
-    //     invisible 
-  
-    gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., 0, "ONLY");
-    //gMC->Gsatt("ITSV", "SEEN", 0);
-    */
-    TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-        itsV->SetTitle(vstrng);
+  //     FIELD CAGE HALF LENGTH 
+  
+  rlim  = 50.;
+  zmax  = 74.;
+  ztpc = 284.;
+  
+  // --- Define ghost volume containing the whole ITS (including services) 
+  //     and fill it with air 
+  
+  dgh[0] = 0.;
+  dgh[1] = 360.;
+  dgh[2] = 16.;
+  dgh[3] = -ztpc-5.-0.1;
+  dgh[4] = 46;   
+  dgh[5] = 85.;
+  dgh[6] = -ztpc;
+  dgh[7] = 46;   
+  dgh[8] = 85.;
+  dgh[9] = -ztpc;
+  dgh[10] = 46;  
+  dgh[11] = rlim+6;
+  dgh[12] = -97.5;
+  dgh[13] = 46;  
+  dgh[14] = rlim+6;
+  dgh[15] = -zmax;
+  dgh[16] = 46;  
+  dgh[17] = rlim+6;
+  dgh[18] = -48;   
+  dgh[19] = 6;
+  dgh[20] = rlim+6;
+  dgh[21] = -28.6;   
+  dgh[22] = 6;
+  dgh[23] = rlim+6;    
+  dgh[24] = -27.6;  
+  dgh[25] = 3.295;
+  dgh[26] = rlim+6; 
+  dgh[27] = 27.6;   
+  dgh[28] = 3.295;
+  dgh[29] = rlim+6;
+  dgh[30] = 28.6;   
+  dgh[31] = 6;
+  dgh[32] = rlim+6;
+  dgh[33] = 48;   
+  dgh[34] = 6;
+  dgh[35] = rlim+6;  
+  dgh[36] = zmax;
+  dgh[37] = 46;
+  dgh[38] = rlim+6;
+  dgh[39] = 97.5;
+  dgh[40] = 46;  
+  dgh[41] = rlim+6;
+  dgh[42] = ztpc;
+  dgh[43] = 62;     
+  dgh[44] = 62+4.;  
+  dgh[45] = ztpc;
+  dgh[46] = 62;     
+  dgh[47] = 85.;
+  dgh[48] = ztpc+4.+0.1;
+  dgh[49] = 62.4;
+  dgh[50] = 85.;
+  gMC->Gsvolu("ITSV", "PCON", idtmed[275], dgh, 51);
+  
+  // --- Place the ghost volume in its mother volume (ALIC) and make it 
+  //     invisible 
+  
+  gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., 0, "ONLY");
+  //gMC->Gsatt("ITSV", "SEEN", 0); 
 
-    TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
-    if(alic==0) {
-        Error("CreateGeometry","alic=0");
-        return;
-    } // end if
-    // See idrotm[199] for angle definitions.
-    //alic->AddNode(itsV,1,new TGeoRotation("", 90.,180., 90.,90., 180.,0.));
-    alic->AddNode(itsV,1,0);
 
-    // --- Define ghost volume containing the six layers and fill it with air 
+  // --- Define ghost volume containing the six layers and fill it with air 
   
   dgh[0] = 0.;
   dgh[1] = 360.;
diff --git a/ITS/AliITSvPPRcoarseasymm.h b/ITS/AliITSvPPRcoarseasymm.h
index f6b17eec0c7..6bff0fc72f1 100644
--- a/ITS/AliITSvPPRcoarseasymm.h
+++ b/ITS/AliITSvPPRcoarseasymm.h
@@ -8,7 +8,7 @@
 /////////////////////////////////////////////////////////
 //  Manager and hits classes for set: ITS version 6    //
 /////////////////////////////////////////////////////////
-#include "AliITSInitGeometry.h" 
+ 
 #include "AliITS.h"
  
 class AliITSvPPRcoarseasymm : public AliITS {
@@ -22,7 +22,7 @@ class AliITSvPPRcoarseasymm : public AliITS {
     virtual void   CreateMaterials();
     virtual void   Init(); 
     virtual Int_t  IsVersion() const {// returns the ITS version number 
-	return (Int_t)kvPPRcourseasymm;}
+	return 6;}
     virtual void   DrawModule() const;
     virtual void   StepManager();
     virtual void   SetRails(Int_t v=1){ 
@@ -52,9 +52,8 @@ class AliITSvPPRcoarseasymm : public AliITS {
     Int_t  fRails;            // flag to switch rails on (=1) and off (=0)
     Int_t  fSuppMat;          // flag to change the material of the services
                               // supports (=0 copper, =1 aluminum, =2 carbon)
-    AliITSInitGeometry fIgm;  //! Geometry initlization object
 			          
-    ClassDef(AliITSvPPRcoarseasymm,2)  //Hits manager for set:ITS version 6 
+    ClassDef(AliITSvPPRcoarseasymm,1)  //Hits manager for set:ITS version 6 
                                        // PPR coarse Geometry asymmetric
 };
  
diff --git a/ITS/AliITSvSDD03.cxx b/ITS/AliITSvSDD03.cxx
index 20c01556295..550f00e687a 100644
--- a/ITS/AliITSvSDD03.cxx
+++ b/ITS/AliITSvSDD03.cxx
@@ -23,7 +23,6 @@
 /////////////////////////////////////////////////////////////////
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -35,6 +34,8 @@
 #include "AliMagF.h"
 #include "AliTrackReference.h"
 #include "AliITShit.h"
+#include "AliITS.h"
+#include "AliITSvSDD03.h"
 #include "AliITSgeom.h"
 #include "AliITSgeomSDD.h"
 #include "AliITSgeomSSD.h"
@@ -49,7 +50,6 @@
 #include "AliITSsimulationSDD.h"
 #include "AliITSsimulationSSD.h"
 
-#include "AliITSvSDD03.h"
 
 ClassImp(AliITSvSDD03)
 
@@ -58,16 +58,17 @@ AliITSvSDD03::AliITSvSDD03() :
 AliITS(),
 fGeomDetOut(kFALSE),
 fGeomDetIn(kFALSE),
-fMajorVersion(IsVersion()),
+fMajorVersion(1),
 fMinorVersion(2),
 fEuclidGeomDet(),
 fRead(),
 fWrite(),
+fDet1(300.0),
+fDet2(300.0),
+fChip1(300.0),
+fChip2(300.0),
 fIDMother(0),
-fYear(2003),
-fTarg(kNoTarg),
-fTargThick(0.0),
-fIgm(kvSDD03){
+fYear(2003){
     ////////////////////////////////////////////////////////////////////////
     // Standard default constructor for the ITS SDD test beam 2002 version 1.
     // Inputs:
@@ -86,22 +87,25 @@ fIgm(kvSDD03){
     for(i=0;i<60;i++) fRead[i] = '\0';
     for(i=0;i<60;i++) fWrite[i] = '\0';
     for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
+    fTarg=kNoTarg;
+    fTargThick=0;
 }
 //______________________________________________________________________
 AliITSvSDD03::AliITSvSDD03(const char *title,Int_t year):
 AliITS("ITS", title),
 fGeomDetOut(kFALSE),
 fGeomDetIn(kFALSE),
-fMajorVersion(IsVersion()),
+fMajorVersion(1),
 fMinorVersion(2),
 fEuclidGeomDet(),
 fRead(),
 fWrite(),
+fDet1(300.0),
+fDet2(300.0),
+fChip1(300.0),
+fChip2(300.0),
 fIDMother(0),
-fYear(year),
-fTarg(kNoTarg),
-fTargThick(0.0),
-fIgm(kvSDD03){
+fYear(2003){
     ////////////////////////////////////////////////////////////////////////
     //    Standard constructor for the ITS SDD testbeam 2002 version 1.
     // Inputs:
@@ -121,6 +125,13 @@ fIgm(kvSDD03){
     fIdSens    = new Int_t[fIdN];
     for(i=0;icd();
     sITSV->Draw();
 }
-/*
 //______________________________________________________________________
 Int_t AliITSvSDD03::DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,
                                    Int_t &det,Int_t &lad) const{
@@ -294,14 +304,13 @@ Int_t AliITSvSDD03::DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,
     }// end if
     return mod;
 }
-*/
 //______________________________________________________________________
 void AliITSvSDD03::CreateGeometry(){
     ////////////////////////////////////////////////////////////////////////
     //  This routine defines and Creates the geometry for version 1 of the ITS.
     //    ALIC    ALICE Mother Volume
     //     |- ITSV     ITS Mother Volume
-    //         |- IDET *2    Detector under Test (boxcontaining SDD)
+    //         |- IDET       Detector under Test (boxcontaining SDD)
     //         |   |-IDAI        Air inside box
     //         |       |- ITS0       SDD Si Chip
     //         |          |- ITST      SDD Sensitivve Volume
@@ -310,12 +319,6 @@ void AliITSvSDD03::CreateGeometry(){
     //         |       |- IMB0       SDD Si Chip
     //         |           |- IMBS     SDD Sensitive volume
     //         |-ISNT*4    Sintilator triggers
-    //
-    //      ITEL ITEL ITEL ITEL IDET IDET ITEL ITEL ITEL ITEL ITEL ITEL
-    // Z->  -584 -574 -504 -494  000 +052 +601 +610 +684 +694 +877 +887
-    //        |    |    |    |    |    |    |    |    |    |    |    |
-    // cpn1   1    2    3    4    1    2    5    6    7    8    9   10
-    //
     // Inputs:
     //    none.
     // Outputs:
@@ -331,36 +334,18 @@ void AliITSvSDD03::CreateGeometry(){
     //Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
     //Float_t yposition= 0.0;
     const Float_t kmm=0.1,kcm=1.0,kmicm=kmm/1000.;
-    // These constant character strings are set by cvs during commit
-    // do not change them unless you know what you are doing!
-    const Char_t *cvsDate="$Date$";
-    const Char_t *cvsRevision="$Revision$";
     // Define Rotation-reflextion Matrixes needed
     // 0 is the unit matrix
     AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0); // SDD and SSD X
     AliMatrix(idrotm[1], 90.0,90.0, 0.0,180.0, 90.0,270.0); // SSD Y
     AliMatrix(idrotm[2],90.0,90.0,90.0,180.0,0.0,0.0);  //Rotate about Z 90 degree
-    /*
+
     data[0] = 150.0*kmm;
     data[1] = 150.0*kmm;
     data[2] = 1100.0*kmm;
     gMC->Gsvolu("ITSV","BOX ",idtmed[0],data,3);
     gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
-    */
-    TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-        itsV->SetTitle(vstrng);
-    else Error("CreateGeometry","Error writing/setting version string");
-    //printf("Title set to %s\n",vstrng);
-    TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
-    if(alic==0) {
-        Error("CreateGeometry","alic=0");
-        return;
-    } // end if
-    alic->AddNode(itsV,1,0);
+
 
     // Crossed sintilator triggers (2 in front 2 in back)
     data[0] = 10.0*kcm;
@@ -679,7 +664,7 @@ void AliITSvSDD03::CreateMaterials(){
    AliMedium(96,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
 	      epsilSi,stminSi);
 
-}/*
+}	     
 //______________________________________________________________________
 void AliITSvSDD03::InitAliITSgeom(){
     //     Based on the geometry tree defined in Geant 3.21, this
@@ -700,7 +685,7 @@ void AliITSvSDD03::InitAliITSgeom(){
         "/ALIC_1/ITSV_1/IDET_%d/IDAI_1/ITS0_1/ITST_1"};
     const Int_t kitsGeomTreeCopys[kltypess]={10,2};
     const Int_t knp=384;
-    const Float_t kpitch=50.E-4;//cm
+    const Float_t kpitch=50.E-4;/*cm*/
     Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1];
     Int_t nlad[knlayers]={knlayers*1};
     Int_t ndet[knlayers]={knlayers*1};
@@ -750,7 +735,7 @@ void AliITSvSDD03::InitAliITSgeom(){
         } // end switch
     } // end for i,cp0
     return;
-}*/
+}
 //______________________________________________________________________
 void AliITSvSDD03::Init(){
     ////////////////////////////////////////////////////////////////////////
@@ -766,17 +751,18 @@ void AliITSvSDD03::Init(){
 
     Info("Init","**********AliITSvSDD03 %d _Init *************",fMinorVersion);
 
-    AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
-                 fMinorVersion));
-    //
-    UpdateInternalGeometry();
-    AliITS::Init();
+    if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
+    if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
+    if(GetITSgeom()!=0) SetITSgeom(0x0);
+    AliITSgeom* geom = new AliITSgeom();
+    SetITSgeom(geom);
+    if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
+    if(!fGeomDetIn) this->InitAliITSgeom();
     if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
-
-    //
+    AliITS::Init();
     fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
 
-}/*
+}
 //______________________________________________________________________
 void AliITSvSDD03::SetDefaults(){
     // sets the default segmentation, response, digit and raw cluster classes
@@ -903,7 +889,7 @@ void AliITSvSDD03::SetDefaultSimulation(){
       sim->Init();
     } // end if
   } // end if iDetType
-  }*/
+}
 //______________________________________________________________________
 void AliITSvSDD03::DrawModule() const{
     ////////////////////////////////////////////////////////////////////////
@@ -956,60 +942,71 @@ void AliITSvSDD03::StepManager(){
     // Return:
     //    none.
     ////////////////////////////////////////////////////////////////////////
-    if(!(this->IsActive())) return;
+    Int_t  copy, id;
+    static TLorentzVector position0;
+    static Int_t stat0=0;
+    if((id=gMC->CurrentVolID(copy) == fIDMother)&&
+       (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
+        copy = fTrackReferences->GetEntriesFast();
+        TClonesArray &lTR = *fTrackReferences;
+        // Fill TrackReference structure with this new TrackReference.
+        new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
+                                         GetCurrentTrackNumber());
+    } // if Outer ITS mother Volume
+    //if(!(this->IsActive())) return;
     if(!(gMC->TrackCharge())) return;
-
-    Int_t  cpy0,cpy1,ncpys=0,status,id,mod;
+    Int_t   vol[5],copy3;
     TLorentzVector position, momentum;
-    static AliITShit hit;// Saves on calls to construtors
-    //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
-    TClonesArray &lhits = *(Hits());
-    //
-    // Track status
-    // Track status
-    status = 0;
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
+    TClonesArray &lhits = *fHits;
     //
     // Fill hit structure.
     gMC->TrackPosition(position);
     gMC->TrackMomentum(momentum);
-    id   = gMC->CurrentVolID(cpy0);
-    gMC->CurrentVolOffID(3,cpy1);
-    if(id==fIdSens[0])ncpys=10;
-    if(id==fIdSens[1])ncpys=2;
-    fIgm.DecodeDetector(mod,ncpys,cpy0,cpy1,1);
+    id   = gMC->CurrentVolID(copy);
+    if(id==fIdSens[0] || id==fIdSens[1]){ // Volumes "ITST" or "IMBS"
+        copy = gMC->CurrentVolOffID(3,copy3);
+        copy = DecodeDetector(id,copy3,vol[0],vol[1],vol[2]);
+	//    cout << "0: mod,lay,lad,det="<TrackTime());
-    hit.SetStartStatus(status);
+        position0 = position;
+        stat0 = vol[3];
+        return;
+    }else{
+        new(lhits[fNhits++]) AliITShit(fIshunt,
+                                   gAlice->GetMCApp()->GetCurrentTrackNumber(),
+                                       vol,gMC->Edep(),gMC->TrackTime(),
+                                       position,position0,momentum);
+    }// end if gMC->IsTrackEntering()
+    position0 = position;
+    stat0 = vol[3];
+
     return;
 }
 
diff --git a/ITS/AliITSvSDD03.h b/ITS/AliITSvSDD03.h
index 5b2a9c74abf..e545e842265 100644
--- a/ITS/AliITSvSDD03.h
+++ b/ITS/AliITSvSDD03.h
@@ -11,7 +11,7 @@
 // proper geometry of the 2003 test beam. In addition, because the SSD
 // used in the test beam are single sided, the second side needs be ignored.
 // This can cause some problems with the SSD reconstruction code.
-#include "AliITSInitGeometry.h"
+
 #include "AliITS.h"
 
 typedef enum {
@@ -28,9 +28,9 @@ class AliITSvSDD03 : public AliITS{
     virtual void   CreateGeometry();
     virtual void   CreateMaterials();
     virtual Int_t  IsVersion() const {// returns the ITS version number 
-                                      return (Int_t)kvSDD03;} 
+                                      return 1;} 
     virtual void   Init(); 
-    //virtual void   SetDefaults();
+    virtual void   SetDefaults();
     virtual void   DrawModule() const;
     virtual void   StepManager(); 
     virtual void   SetTargMat(TargTyp_t tt=kNoTarg){ // set target material 
@@ -48,31 +48,47 @@ class AliITSvSDD03 : public AliITS{
     virtual void   SetEUCLIDFileName(const char *f){ // set write file
                              fEuclidGeometry=f;fEuclidOut = kTRUE;}
     virtual void   SetMinorVersion(Int_t v=22){ // Choose between existing minor versions
-        fMinorVersion = v;}
+        fMinorVersion = v;} 
+    virtual void   SetThicknessDet1(Float_t v=300.){
+         // Set detector thickness in layer 1
+         fDet1 = v;}
+    virtual void   SetThicknessDet2(Float_t v=300.){
+         // Set detector thickness in layer 2
+         fDet2 = v;}
+    virtual void   SetThicknessChip1(Float_t v=300.){
+         // Set chip thickness in layer 1
+         fChip1 = v;}
+    virtual void   SetThicknessChip2(Float_t v=300.){
+         // Set chip thickness in layer 2
+         fChip2 = v;}
     // Replacement default simulation initilization.
-    //virtual void SetDefaultSimulation();
+    virtual void SetDefaultSimulation();
     TargTyp_t GetTargMat() const {return fTarg;}
     // Decodes the id and copy nuber to give the layer, ladder, and detector 
     // numbers . Returns the module number.
-    //virtual Int_t DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,
-    //                             Int_t &lad,Int_t &det) const;
+    virtual Int_t DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,
+                                 Int_t &lad,Int_t &det) const;
          //
  private:  
     AliITSvSDD03(const AliITSvSDD03 &source); // Copy constructor
     AliITSvSDD03& operator=(const AliITSvSDD03 &source); // = operator
+    void InitAliITSgeom();
     Bool_t fGeomDetOut;       // Flag to write .det file out
     Bool_t fGeomDetIn;        // Flag to read .det file or directly from Geat.
     Int_t  fMajorVersion;     // Major version number == IsVersion
     Int_t  fMinorVersion;     // Minor version number 
     char   fEuclidGeomDet[60];// file where detector transormation are define.
     char   fRead[60];         //! file name to read .det file
-    char   fWrite[60];        //! file name to write .det file
+    char   fWrite[60];        //! file name to write .det file 
+    Float_t  fDet1;           // thickness of detector in SDD layer 1
+    Float_t  fDet2;           // thickness of detector in SDD layer 2
+    Float_t  fChip1;          // thickness of chip in SDD layer 1
+    Float_t  fChip2;          // thickness of chip in SDD layer 2 
     Int_t fIDMother;          //! ITS Mother Volume id.
     Int_t fYear;              // Year flag to select different geometries.
     TargTyp_t fTarg;          // Target material
     Float_t fTargThick;       // TargetThickness in mm
-    AliITSInitGeometry fIgm;  //! Get Access to decoding an dAliITSgeom init functions
 
-    ClassDef(AliITSvSDD03,3) // Hits manager and geometry for SDD testbeam
+    ClassDef(AliITSvSDD03,2) // Hits manager and geometry for SDD testbeam
 };
 #endif
diff --git a/ITS/AliITSvSPD02.cxx b/ITS/AliITSvSPD02.cxx
index 1455fe60f19..7945dd5c43c 100644
--- a/ITS/AliITSvSPD02.cxx
+++ b/ITS/AliITSvSPD02.cxx
@@ -16,7 +16,6 @@
 /* $Id$ */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -55,7 +54,7 @@ AliITSvSPD02::AliITSvSPD02():
 AliITS(),
 fGeomDetOut(kFALSE),
 fGeomDetIn(kFALSE),
-fMajorVersion((Int_t)kvSPD02),
+fMajorVersion(1),
 fMinorVersion(2),
 fGeomNumber(2002),
 fEuclidGeomDet(),
@@ -64,9 +63,7 @@ fWrite(),
 fDet1(300.0),
 fDet2(300.0),
 fChip1(300.0),
-fChip2(300.0),
-fIDMother(0),
-fIgm(kvSPD02){
+fChip2(300.0){
     ////////////////////////////////////////////////////////////////////////
     // Standard default constructor for the ITS SPD test beam 2002 version 1.
     // Inputs:
@@ -95,9 +92,7 @@ fWrite(),
 fDet1(300.0),
 fDet2(300.0),
 fChip1(300.0),
-fChip2(300.0),
-fIDMother(0),
-fIgm(kvSPD02){
+fChip2(300.0){
     ////////////////////////////////////////////////////////////////////////
     //    Standard constructor for the ITS SPD testbeam 2002 version 1.
     // Inputs:
@@ -352,11 +347,6 @@ void AliITSvSPD02::CreateGeometry2002(){
     //             |- IMB0       SPD Si Chip
     //             |   |- IMBS     SPD Sensitive volume
     //             |- ICMB       Chip MiniBus.
-    //
-    //      ITEL ITEL IDET ITEL ITEL
-    // Z->  -38  -36   02  36.5 38.5
-    //       |    |     |    |    |
-    // cpn1  1    2     1    3    4
     // Inputs:
     //    none.
     // Outputs:
@@ -371,36 +361,16 @@ void AliITSvSPD02::CreateGeometry2002(){
     Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
     Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
     Float_t yposition= 0.0;
-    // These constant character strings are set by cvs during commit
-    // do not change them unless you know what you are doing!
-    const Char_t *cvsDate="$Date$";
-    const Char_t *cvsRevision="$Revision$";
 
     if(gMC==0) return;
     // Define Rotation-reflextion Matrixes needed
     // 0 is the unit matrix
     AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
-    /*
     data[0] = 10.0;
     data[1] = 50.0;
     data[2] = 100.0;
     gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
     gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
-    */
-    TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-        itsV->SetTitle(vstrng);
-    else Error("CreateGeometry","Error writing/setting version string");
-    TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
-    if(alic==0) {
-        Error("CreateGeometry","alic=0");
-        return;
-    } // end if
-    // See idrotm[199] for angle definitions.
-    alic->AddNode(itsV,1,0);
 
     //cout << "idtmed[0]=" << idtmed[0]<GetTransformation(path.Data(),matrix);
+        gMC->GetShape(path.Data(),shapeName,shapePar);
+        shapeParF.Set(shapePar.GetSize());
+        for(j=0;jCreateMatrix(mod,lay,lad,det,kSPD,trans,rot);
+        geom->SetTrans(mod,matrix.GetTranslation());
+        geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
+        geom->GetGeomMatrix(mod)->SetPath(path.Data());
+        if(!(geom->IsShapeDefined((Int_t)kSPD)))
+            geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
+    } // end for i,cpy/
+    return;
+}
+//______________________________________________________________________
 void AliITSvSPD02::Init(){
+    ////////////////////////////////////////////////////////////////////////
     //     Initialise the ITS after it has been created.
     // Inputs:
-    //   none.
+    //    none.
     // Outputs:
-    //   none.
+    //    none.
     // Return:
-    //   none.
+    //    none.
+    ////////////////////////////////////////////////////////////////////////
+    Int_t i;
 
-    AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
-                 fMinorVersion));
-    //
-    UpdateInternalGeometry();
-    AliITS::Init();
+    cout << endl;
+    for(i=0;i<26;i++) cout << "*";
+    cout << " ITSvSPD02" << fMinorVersion << "_Init ";
+    for(i=0;i<25;i++) cout << "*";cout << endl;
+
+    if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
+    if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
+    if(GetITSgeom()!=0) SetITSgeom(0x0);
+    AliITSgeom* geom = new AliITSgeom();
+    SetITSgeom(geom);
+    if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
+    if(!fGeomDetIn) this->InitAliITSgeom();
     if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
+    AliITS::Init();
 
-    //
-    fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
-
+    for(i=0;i<72;i++) cout << "*";
+    cout << endl;
+    if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
+    else fIDMother = 0;
 }
-/*
 //______________________________________________________________________
 void AliITSvSPD02::SetDefaults(){
     // sets the default segmentation, response, digit and raw cluster classes
@@ -625,15 +676,15 @@ void AliITSvSPD02::SetDefaults(){
 //    SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
 //    iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
    
+/*
+    SetResponseModel(kSDD,new AliITSCalibrationSDD());
+    SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
+    DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
 
-//    SetResponseModel(kSDD,new AliITSCalibrationSDD());
-//    SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
-//    DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
-
-//    SetResponseModel(kSSD,new AliITSCalibrationSSD());
-//    SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
-//    DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
-
+    SetResponseModel(kSSD,new AliITSCalibrationSSD());
+    SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
+    DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
+*/
     if(fgkNTYPES>3){
 	Warning("SetDefaults",
 		"Only the four basic detector types are initialised!");
@@ -672,35 +723,36 @@ void AliITSvSPD02::SetDefaultSimulation(){
       sim->Init();
     } // end if
   } // end if iDetType
-
-//      if(fDetTypeSim){
-//        sim = fDetTypeSim->GetSimulationModel(kSDD);
-//        if (!sim) {
-//            seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
-//            res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
-//            sim = new AliITSsimulationSDD(seg,res);
-//           SetSimulationModel(kSDD,sim);
-//        }else{ // simulation exists, make sure it is set up properly.
-//	  sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
-//	  sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
-//	  sim->Init();
-//        } //end if
-//    } // end if iDetType
-//    if(fDetTypeSim){
-//        sim = fDetTypeSim->GetSimulationModel(kSSD);
-//        if (!sim) {
-//            seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
-//            res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
-//            sim = new AliITSsimulationSSD(seg,res);
-//            SetSimulationModel(kSSD,sim);
-//        }else{ // simulation exists, make sure it is set up properly.
-//	  sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
-//	  sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
-//	  sim->Init();
-//        } // end if
-//    } //
+  
+    /*
+      if(fDetTypeSim){
+        sim = fDetTypeSim->GetSimulationModel(kSDD);
+        if (!sim) {
+            seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
+            res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
+            sim = new AliITSsimulationSDD(seg,res);
+            SetSimulationModel(kSDD,sim);
+        }else{ // simulation exists, make sure it is set up properly.
+	  sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
+	  sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
+	  sim->Init();
+        } //end if
+    } // end if iDetType
+    if(fDetTypeSim){
+        sim = fDetTypeSim->GetSimulationModel(kSSD);
+        if (!sim) {
+            seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
+            res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
+            sim = new AliITSsimulationSSD(seg,res);
+            SetSimulationModel(kSSD,sim);
+        }else{ // simulation exists, make sure it is set up properly.
+	  sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
+	  sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
+	  sim->Init();
+        } // end if
+    } //
+    */ 
 }
-*/
 //______________________________________________________________________
 void AliITSvSPD02::DrawModule() const {
     ////////////////////////////////////////////////////////////////////////
@@ -749,64 +801,69 @@ void AliITSvSPD02::StepManager(){
     // Return:
     //    none.
     ////////////////////////////////////////////////////////////////////////
-
+    Int_t         copy=0, id;
+    TLorentzVector position, momentum;
+    static TLorentzVector position0;
+    static Int_t stat0=0;
+    if((id=gMC->CurrentVolID(copy) == fIDMother)&&
+       (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
+        copy = fTrackReferences->GetEntriesFast();
+        TClonesArray &lTR = *fTrackReferences;
+        // Fill TrackReference structure with this new TrackReference.
+        new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
+                                         GetCurrentTrackNumber());
+    } // if Outer ITS mother Volume
     if(!(this->IsActive())){
         return;
     } // end if !Active volume.
-    if(!(gMC->TrackCharge())) return;
-
-    Int_t cpy0=0,cpy1=0,id,mod,ncpys,status;
-    TLorentzVector position, momentum;
-    static AliITShit hit;// Saves on calls to construtors
-    //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
-    TClonesArray &lhits = *(Hits());
+    Int_t   vol[5];
+    TClonesArray &lhits = *fHits;
     //
     // Track status
-    // Track status
-    status = 0;
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
+    vol[3] = 0;
+    vol[4] = 0;
+    if(gMC->IsTrackInside())      vol[3] +=  1;
+    if(gMC->IsTrackEntering())    vol[3] +=  2;
+    if(gMC->IsTrackExiting())     vol[3] +=  4;
+    if(gMC->IsTrackOut())         vol[3] +=  8;
+    if(gMC->IsTrackDisappeared()) vol[3] += 16;
+    if(gMC->IsTrackStop())        vol[3] += 32;
+    if(gMC->IsTrackAlive())       vol[3] += 64;
     //
     // Fill hit structure.
-    id = gMC->CurrentVolID(cpy0);
-    if(id==fIdSens[0]){  // Volume name "IMBS". Det=1, ladder=1
-        ncpys = 4;
+    if(!(gMC->TrackCharge())) return;
+    id = gMC->CurrentVolID(copy);
+    if(id==fIdSens[0]){  // Volume name "IMBS"
+        vol[2] = vol[1] = 1; // Det, ladder
+        id = gMC->CurrentVolOffID(2,copy);
+        //detector copy in the ladder = 1<->4  (ITS1 < I101 < I103 < I10A)
+        vol[0] = copy; // Lay
+        if(copy>2) vol[0]++;
     } else if(id == fIdSens[1]){ // Volume name "ITST"
-        ncpys = 1;
+        vol[0] = 3; // layer
+        vol[1] = 1; // ladder
+        id = gMC->CurrentVolOffID(2,copy);
+        //detector copy in the ladder = 1<->4  (ITS2 < I1D1 < I1D3 < I20A)
+        vol[2] = 1;  // detector
     } else return; // end if
-    id = gMC->CurrentVolOffID(2,cpy1);
-    fIgm.DecodeDetector(mod,ncpys,cpy0,cpy1,0);
-    //
-    // Fill hit structure.
     //
-    hit.SetModule(mod);
-    hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
     gMC->TrackPosition(position);
     gMC->TrackMomentum(momentum);
-    hit.SetPosition(position);
-    hit.SetTime(gMC->TrackTime());
-    hit.SetMomentum(momentum);
-    hit.SetStatus(status);
-    hit.SetEdep(gMC->Edep());
-    hit.SetShunt(GetIshunt());
+    vol[4] = stat0;
     if(gMC->IsTrackEntering()){
-        hit.SetStartPosition(position);
-        hit.SetStartTime(gMC->TrackTime());
-        hit.SetStartStatus(status);
-        return; // don't save entering hit.
+        position0 = position;
+        stat0 = vol[3];
+        return;
     } // end if IsEntering
-    // Fill hit structure with this new hit.
-    //Info("StepManager","Calling Copy Constructor");
-    new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
-    // Save old position... for next hit.
-    hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
-    hit.SetStartStatus(status);
+    // Fill hit structure with this new hit only for non-entrerance hits.
+    else new(lhits[fNhits++]) AliITShit(fIshunt,
+                                  gAlice->GetMCApp()->GetCurrentTrackNumber(),
+                                        vol,gMC->Edep(),gMC->TrackTime(),
+                                        position,position0,momentum);
+    //
+    position0 = position;
+    stat0 = vol[3];
+
     return;
 }
 
diff --git a/ITS/AliITSvSPD02.h b/ITS/AliITSvSPD02.h
index 5fe55f17203..3a451091d1d 100644
--- a/ITS/AliITSvSPD02.h
+++ b/ITS/AliITSvSPD02.h
@@ -15,7 +15,7 @@
 // geometry of summer 2002
 // 
 ///////////////////////////////////////////////////////////////////////
-#include "AliITSInitGeometry.h"
+
 #include "AliITS.h"
 
 class AliITSvSPD02 : public AliITS{
@@ -26,10 +26,12 @@ class AliITSvSPD02 : public AliITS{
     virtual void   BuildGeometry();
     virtual void   CreateGeometry();
     virtual void   CreateMaterials();
+    virtual Int_t  DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,Int_t &lad,
+				  Int_t &det)const;
     virtual Int_t  IsVersion() const {// returns the ITS version number 
-                                      return (Int_t)kvSPD02;} 
+                                      return 1;} 
     virtual void   Init();
-    //virtual void   SetDefaults();
+    virtual void   SetDefaults();
     virtual void   DrawModule() const;
     virtual void   StepManager(); 
     virtual void   SetWriteDet(Bool_t det=kTRUE){ // set .det write
@@ -57,7 +59,7 @@ class AliITSvSPD02 : public AliITS{
          // Set chip thickness in layer 2
          fChip2 = v;}
     // Replacement default simulation initilization.
-    //virtual void SetDefaultSimulation();
+    virtual void SetDefaultSimulation();
     //
   private:
     void BuildGeometry2002();
@@ -67,6 +69,7 @@ class AliITSvSPD02 : public AliITS{
  private:  
     AliITSvSPD02(const AliITSvSPD02 &source); // Copy constructor
     AliITSvSPD02& operator=(const AliITSvSPD02 &source); // = operator
+    void InitAliITSgeom();
     Bool_t fGeomDetOut;       // Flag to write .det file out
     Bool_t fGeomDetIn;        // Flag to read .det file or directly from Geat.
     Int_t  fMajorVersion;     // Major version number == IsVersion
@@ -80,8 +83,7 @@ class AliITSvSPD02 : public AliITS{
     Float_t  fChip1;          // thickness of chip in SPD layer 1
     Float_t  fChip2;          // thickness of chip in SPD layer 2 
     Int_t fIDMother;          //! ITS Mother Volume id.
-    AliITSInitGeometry fIgm;//! Get access to decoding and AliITSgeom init functins
 
-    ClassDef(AliITSvSPD02,3) // Hits manager and geometry for SPD testbeam
+    ClassDef(AliITSvSPD02,2) // Hits manager and geometry for SPD testbeam
 };
 #endif
diff --git a/ITS/AliITSvSSD03.cxx b/ITS/AliITSvSSD03.cxx
index a8bad6d4854..7646707380f 100644
--- a/ITS/AliITSvSSD03.cxx
+++ b/ITS/AliITSvSSD03.cxx
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "AliRun.h"
 #include "AliMagF.h"
@@ -51,18 +50,7 @@
 ClassImp(AliITSvSSD03)
 
 //______________________________________________________________________
-AliITSvSSD03::AliITSvSSD03():
-AliITS(),                  // Base Class
-fGeomDetOut(kFALSE),       // Flag to write .det file out
-fGeomDetIn(kFALSE),        // Flag to read .det file or directly from Geat.
-fMajorVersion(IsVersion()),// Major version number == IsVersion
-fMinorVersion(-1),         // Minor version number 
-fGeomNumber(2003),         // Geometry version number (year)
-fEuclidGeomDet(),          // file where detector transormation are define.
-fRead(),                   //! file name to read .det file
-fWrite(),                  //! file name to write .det file 
-fIDMother(0),              //! ITS Mother Volume id.
-fIgm(kvSSD03){             //! AliITSInitGeometry object {
+AliITSvSSD03::AliITSvSSD03() {
     ////////////////////////////////////////////////////////////////////////
     // Standard default constructor for the ITS SSD test beam 2003 version 1.
     // Inputs:
@@ -77,23 +65,18 @@ fIgm(kvSSD03){             //! AliITSInitGeometry object {
     fIdN          = 0;
     fIdName       = 0;
     fIdSens       = 0;
+    fEuclidOut    = kFALSE; // Don't write Euclide file
+    fGeomDetOut   = kFALSE; // Don't write .det file
+    fGeomDetIn    = kFALSE; // Don't Read .det file
+    fMajorVersion = IsVersion();
+    fMinorVersion = -1;
+    fGeomNumber   = 2003; // default value
     for(i=0;i<60;i++) fRead[i] = '\0';
     for(i=0;i<60;i++) fWrite[i] = '\0';
     for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
 }
 //______________________________________________________________________
-AliITSvSSD03::AliITSvSSD03(const char *title,Int_t gn) :
-AliITS("ITS",title),       // Base Class
-fGeomDetOut(kFALSE),       // Flag to write .det file out
-fGeomDetIn(kFALSE),        // Flag to read .det file or directly from Geat.
-fMajorVersion(IsVersion()),// Major version number == IsVersion
-fMinorVersion(2),         // Minor version number 
-fGeomNumber(gn),         // Geometry version number (year)
-fEuclidGeomDet(),          // file where detector transormation are define.
-fRead(),                   //! file name to read .det file
-fWrite(),                  //! file name to write .det file 
-fIDMother(0),              //! ITS Mother Volume id.
-fIgm(kvSSD03){             //! AliITSInitGeometry object {
+AliITSvSSD03::AliITSvSSD03(const char *title,Int_t gn) : AliITS("ITS", title){
     ////////////////////////////////////////////////////////////////////////
     //    Standard constructor for the ITS SSD testbeam 2003 version 1.
     // Inputs:
@@ -106,12 +89,24 @@ fIgm(kvSSD03){             //! AliITSInitGeometry object {
     ////////////////////////////////////////////////////////////////////////
     Int_t i;
 
+    fGeomNumber = gn;
 
     fIdN = 1; 
     fIdName = new TString[fIdN];
     fIdName[0] = "ITST";
     fIdSens    = new Int_t[fIdN];
-    for(i=0;i  -282 -280   0   16   270
-    //        |    |    |    |    |
-    // cpn0   1    2    1    1    3
-    //
-    // Inputs:
-    //    none.
-    // Outputs:
-    //    none.
-    // Return:
-    //    none.
-    ////////////////////////////////////////////////////////////////////////
-    Float_t data[49];
-    // Define media off-set
-    Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
-    Int_t idrotm[4]; // Array of rotation matrix indexes
-    // These constant character strings are set by cvs during commit
-    // do not change them unless you know what you are doing!
-    const Char_t *cvsDate="$Date$";
-    const Char_t *cvsRevision="$Revision$";
-    //Float_t yposition= 0.0;
+  ////////////////////////////////////////////////////////////////////////
+  //
+  //    ALIC    ALICE Mother Volume
+  //     |- ITSV     Beamtest Mother Volume
+  //         |
+  //         |- ITSA       Aluminum cover for scintillator
+  //         |    |-ITSS    first Trieste trigger plastic scintillator 
+  //         |- ITSA       Aluminum cover for scintillator
+  //         |    |-ITSS    second Trieste's trigger plastic scintillator
+  //         |
+  //         |- IGAR       Black box around ITST       
+  //         |    |-IAIR    Air inside the black box
+  //         |        |-ITST    Detector under Test 
+  //         |
+  //         |- IFRA       Aluminum cover for scintillator
+  //         |    |-IFRS    French plastic scintillator 
+  //         |
+  //         |- ITSA       Aluminum cover for scintillator
+  //         |    |-ITSS    third Trieste's plastic scintillator
+  // Inputs:
+  //    none.
+  // Outputs:
+  //    none.
+  // Return:
+  //    none.
+  ////////////////////////////////////////////////////////////////////////
+  
+  Float_t data[49];
+  // Define media off-set
+  Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
+  Int_t idrotm[4]; // Array of rotation matrix indexes
+   //Float_t yposition= 0.0;
   
   if(gMC==0) return;
   // Define Rotation-reflextion Matrixes needed
   // 0 is the unit matrix
 
-  /*
   // Beamtest mother volume (air) positioned in ALIC mother volume
   data[0] = 500.0;
   data[1] = 500.0;
   data[2] = 1000.0;
   gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
   gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
-  */
-    TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-        itsV->SetTitle(vstrng);
-    else Error("CreateGeometry","Error writing/setting version string");
-    //printf("Title set to %s\n",vstrng);
-    TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
-    if(alic==0) {
-        Error("CreateGeometry","alic=0");
-        return;
-    } // end if
-    // See idrotm[199] for angle definitions.
-    alic->AddNode(itsV,1,0);
   
   // Trieste's plastic scintillators for the trigger (2 at beam enter)
   // ...define them (aluminum cover + scintillator inside)
@@ -477,7 +446,7 @@ void AliITSvSSD03::CreateMaterials2003(){
     // Kapton
     AliMaterial(5, "Kapton$", 12.011, 6., 1.3, 31.27, 999.);
     AliMedium(5, "Kapton$",    5, 0,ifield,fieldm, 10., .01, .1, .003, .003);
-}/*
+}
 //______________________________________________________________________
 void AliITSvSSD03::InitAliITSgeom(){
   // sturture.
@@ -505,7 +474,7 @@ void AliITSvSSD03::InitAliITSgeom(){
     geom->SetRotMatrix(0,materix.GetRotationMatrix());
     geom->GetGeomMatrix(0)->SetPath(kname.Data());
     return;
-}*/
+}
 //______________________________________________________________________
 void AliITSvSSD03::Init(){
     ////////////////////////////////////////////////////////////////////////
@@ -517,21 +486,28 @@ void AliITSvSSD03::Init(){
     // Return:
     //    none.
     ////////////////////////////////////////////////////////////////////////
+    Int_t i;
 
-
-    Info("Init","**********AliITSvSSD03 %d _Init *************",fMinorVersion);
-
-    AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
-                 fMinorVersion));
-    //
-    UpdateInternalGeometry();
-    AliITS::Init();
+    cout << endl;
+    for(i=0;i<26;i++) cout << "*";
+    cout << " ITSvSSD03" << fMinorVersion << "_Init ";
+    for(i=0;i<25;i++) cout << "*";cout << endl;
+//
+    if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
+    if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
+    if(GetITSgeom()!=0) SetITSgeom(0x0);
+    AliITSgeom* geom = new AliITSgeom();
+    SetITSgeom(geom);
+    if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
+    if(!fGeomDetIn) this->InitAliITSgeom();
     if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
-
-    //
-    fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
-
-}/*
+    AliITS::Init();
+//
+    for(i=0;i<72;i++) cout << "*";
+    cout << endl;
+    if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
+    else fIDMother = 0;
+}
 //______________________________________________________________________
 void AliITSvSSD03::SetDefaults(){
     // sets the default segmentation, rerponse, digit and raw cluster classes
@@ -573,15 +549,15 @@ void AliITSvSSD03::SetDefaults(){
 //    SetSimulationModel(kSSD,new AliITSsimulationSSD(seg0,resp0));
 //    iDetType->ReconstructionModel(new AliITSClusterFinderSSD());
 
+/*
+    SetResponseModel(kSPD,new AliITSCalibrationSPD());
+    SetSegmentationModel(kSPD,new AliITSsegmentationSPD());
+    fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
 
-    //SetResponseModel(kSPD,new AliITSCalibrationSPD());
-    //SetSegmentationModel(kSPD,new AliITSsegmentationSPD());
-    //fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
-
-    //SetResponseModel(kSDD,new AliITSCalibrationSDD());
-    //SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
-    //fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
-
+    SetResponseModel(kSDD,new AliITSCalibrationSDD());
+    SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
+    fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
+*/
 
 
     if(fgkNTYPES>3){
@@ -605,45 +581,46 @@ void AliITSvSSD03::SetDefaultSimulation(){
   AliITSsimulation *sim;
   //  AliITSsegmentation *seg;
   // AliITSCalibration *res;
-
+  /*
   //SPD
-  //if(fDetTypeSim){
-    //sim = fDetTypeSim->GetSimulationModel(kSPD);
-    //if (!sim) {
-      //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
-      //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd);
-      //sim = new AliITSsimulationSPDdubna(seg,res,1);
-      //SetSimulationModel(kSPD,sim);
-    //}else{ // simulation exists, make sure it is set up properly.
-      //sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
-      //sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd));
-      //((AliITSsimulation*)sim)->Init();
+  if(fDetTypeSim){
+    sim = fDetTypeSim->GetSimulationModel(kSPD);
+    if (!sim) {
+      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
+      res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd);
+      sim = new AliITSsimulationSPDdubna(seg,res,1);
+      SetSimulationModel(kSPD,sim);
+    }else{ // simulation exists, make sure it is set up properly.
+      sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
+      sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd));
+      ((AliITSsimulation*)sim)->Init();
       //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
       //            (AliITSCalibration*)iDetType->GetResponseModel());
       //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
       //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
-    //} // end if
-  //} // end if !fDetTypeSim
+    } // end if
+  } // end if !fDetTypeSim
 
   //SDD
-  //if(fDetTypeSim){
-    //sim = fDetTypeSim->GetSimulationModel(kSDD);
-    //if (!sim) {
-      //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
-      //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd);
-      //sim = new AliITSsimulationSDD(seg,res);
-      //SetSimulationModel(kSDD,sim);
-    //}else{ // simulation exists, make sure it is set up properly.
-      //sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
-      //sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd));
-
-      //((AliITSsimulation*)sim)->Init();
+  if(fDetTypeSim){
+    sim = fDetTypeSim->GetSimulationModel(kSDD);
+    if (!sim) {
+      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
+      res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd);
+      sim = new AliITSsimulationSDD(seg,res);
+      SetSimulationModel(kSDD,sim);
+    }else{ // simulation exists, make sure it is set up properly.
+      sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
+      sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd));
+
+      ((AliITSsimulation*)sim)->Init();
       //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
       //            (AliITSCalibration*)iDetType->GetResponseModel());
       //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
       //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
-    //} //end if
-  //} // end if !iDetType
+    } //end if
+  } // end if !iDetType
+  */
   //SSD
   if(fDetTypeSim){
     sim = fDetTypeSim->GetSimulationModel(kSSD);
@@ -663,7 +640,7 @@ void AliITSvSSD03::SetDefaultSimulation(){
     } // end if
   } // end if !iDetType
 }
-*/
+
 //______________________________________________________________________
 void AliITSvSSD03::DrawModule() const {
     ////////////////////////////////////////////////////////////////////////
@@ -705,60 +682,63 @@ void AliITSvSSD03::StepManager(){
     // Return:
     //    none.
     ////////////////////////////////////////////////////////////////////////
+    Int_t         copy=0, id;
+    TLorentzVector position, momentum;
+    static TLorentzVector position0;
+    static Int_t stat0=0;
+
+    if((id=gMC->CurrentVolID(copy) == fIDMother)&&
+       (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
+	copy = fTrackReferences->GetEntriesFast();
+	TClonesArray &lTR = *fTrackReferences;
+	// Fill TrackReference structure with this new TrackReference.
+	new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
+    } // if Outer ITS mother Volume
+
     if(!(this->IsActive())){
-        return;
+	return;
     } // end if !Active volume.
-    if(!(gMC->TrackCharge())) return;
 
-    Int_t cpy0,mod,id,status;
-    TLorentzVector position, momentum;
-    static AliITShit hit;// Saves on calls to construtors
-    //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
-    TClonesArray &lhits = *(Hits());
+
+    Int_t   vol[5];
+    TClonesArray &lhits = *fHits;
     //
     // Track status
-    // Track status
-    status = 0;
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
+    vol[3] = 0;
+    vol[4] = 0;
+    if(gMC->IsTrackInside())      vol[3] +=  1;
+    if(gMC->IsTrackEntering())    vol[3] +=  2;
+    if(gMC->IsTrackExiting())     vol[3] +=  4;
+    if(gMC->IsTrackOut())         vol[3] +=  8;
+    if(gMC->IsTrackDisappeared()) vol[3] += 16;
+    if(gMC->IsTrackStop())        vol[3] += 32;
+    if(gMC->IsTrackAlive())       vol[3] += 64;
     //
     // Fill hit structure.
-    id = gMC->CurrentVolID(cpy0);
+    if(!(gMC->TrackCharge())) return;
+    id = gMC->CurrentVolID(copy);
     if(id==fIdSens[0]){  // Volume name "ITST"
-	mod=2; // Det, ladder
+	vol[2] = vol[1] = vol[0] = 1; // Det, ladder
     } else return; // end if
     //
-    //
-    // Fill hit structure.
-    //
-    hit.SetModule(mod);
-    hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
     gMC->TrackPosition(position);
     gMC->TrackMomentum(momentum);
-    hit.SetPosition(position);
-    hit.SetTime(gMC->TrackTime());
-    hit.SetMomentum(momentum);
-    hit.SetStatus(status);
-    hit.SetEdep(gMC->Edep());
-    hit.SetShunt(GetIshunt());
+    vol[4] = stat0;
     if(gMC->IsTrackEntering()){
-        hit.SetStartPosition(position);
-        hit.SetStartTime(gMC->TrackTime());
-        hit.SetStartStatus(status);
-        return; // don't save entering hit.
+	position0 = position;
+	stat0 = vol[3];
+	return;
     } // end if IsEntering
-    // Fill hit structure with this new hit.
-    //Info("StepManager","Calling Copy Constructor");
-    new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
-    // Save old position... for next hit.
-    hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
-    hit.SetStartStatus(status);
+
+    // Fill hit structure with this new hit only for non-entrerance hits.
+    else new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
+					gMC->Edep(),gMC->TrackTime(),position,
+					position0,momentum);
+    //cout<Edep()<
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include "AliRun.h"
-#include "AliMC.h"
-#include "AliMagF.h"
 #include "AliITSgeom.h"
 #include "AliITSgeomSDD.h"
 #include "AliITSgeomSPD.h"
 #include "AliITSgeomSSD.h"
 #include "AliITShit.h"
 #include "AliITSvtest.h"
+#include "AliRun.h"
+#include "AliMC.h"
 
 ClassImp(AliITSvtest)
-
-const Double_t AliITSvtest::fgkmicron = 1.0E-4;
-const Double_t AliITSvtest::fgkmm = 0.10;
-const Double_t AliITSvtest::fgkcm = 1.00;
-const Double_t AliITSvtest::fgkDegree = 1.0;
-const Double_t AliITSvtest::fgkRadian = 180./3.14159265358979323846;
-const Double_t AliITSvtest::fgkgcm3 = 1.0; // assume default is g/cm^3
-const Double_t AliITSvtest::fgkCelsius = 1.0; // Assume default is C
-const Double_t AliITSvtest::fgkPascal  = 1.0E-3; // Assume kPascal
-const Double_t AliITSvtest::fgkKPascal = 1.0;    // Asume kPascal
-const Double_t AliITSvtest::fgkeV      = 1.0E-9; // GeV default
-const Double_t AliITSvtest::fgkKeV     = 1.0e-6; // GeV default
-const Double_t AliITSvtest::fgkMeV     = 1.0e-3; // GeV default
-const Double_t AliITSvtest::fgkGeV     = 1.0;    // GeV default
-
  
 //_____________________________________________________________________________
-AliITSvtest::AliITSvtest() :
-AliITS(),                   // Base Class
-fGeomDetOut(kFALSE),       // Flag to write .det file out
-fGeomDetIn(kFALSE),         // Flag to read .det file or directly from Geat.
-fMajorVersion(IsVersion()), // Major version number == IsVersion
-fMinorVersion(-1),          // Minor version number
-fEuclidGeomDet(),           // file where detector transormation are define.
-fRead(),                    //! file name to read .det file
-fWrite(),                   //! file name to write .det file
-fIgm()                      //! Geometry initilization object
-{
-    // Default constructor for the ITS
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-} 
-//_____________________________________________________________________________
-AliITSvtest::AliITSvtest(const Char_t *title,Int_t version) :
-AliITS("ITS",title),        // Base Class
-fGeomDetOut(kFALSE),       // Flag to write .det file out
-fGeomDetIn(kFALSE),         // Flag to read .det file or directly from Geat.
-fMajorVersion(IsVersion()), // Major version number == IsVersion
-fMinorVersion(version),     // Minor version number
-fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_test.det"),// file where detector transormation are define.
-fRead("$ALICE_ROOT/ITS/ITSgeometry_test.det"),//! file name to read .det file
-fWrite("$ALICE_ROOT/ITS/ITSgeometry_test.det"),//! file name to write .det file
-fIgm()                      //! Geometry initilization object
-{
-    // Default constructor for the ITS. version=1 reads Euclide file for
-    // geometry. version=2 use's internal geometry
-    // Inputs:
-    //   Char_t *title   Geomety title
-    //   Int_t   version Minor version number to use.
-    //                       =-1 Not defined
-    //                       = 1 read Euclid geometry
-    //                       = 2 use internal geometry minor verion 2.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
+AliITSvtest::AliITSvtest() {
+    // Standard constructor for the ITS
     Int_t i;
 
-    fIdN    = 6;
-    fIdName    = new TString[fIdN];
-    fIdName[0] = "ITS1";
-    fIdName[1] = "ITS2";
-    fIdName[2] = "ITS3";
-    fIdName[3] = "ITS4";
-    fIdName[4] = "ITS5";
-    fIdName[5] = "ITS6";
-    fIdSens    = new Int_t[fIdN];
-    for(i=0;iExpandPathName(fEuclidMaterial.Data());
-    //  FILE *file = fopen(fEuclidMaterial.Data(),"r");
-    FILE *file = fopen(filtmp,"r");
-    if(file) {
-        fclose(file);
-        //    ReadEuclidMedia(fEuclidMaterial.Data(),this);
-        ReadEuclidMedia(filtmp);
-    } else {
-        Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
-              //	  fEuclidMaterial.Data());
-              filtmp);
-        exit(1);
-    } // end if(file)
+//
+  filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
+//  FILE *file = fopen(fEuclidMaterial.Data(),"r");
+  FILE *file = fopen(filtmp,"r");
+  if(file) {
+    fclose(file);
+//    ReadEuclidMedia(fEuclidMaterial.Data(),this);
+    ReadEuclidMedia(filtmp);
+  } else {
+    Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
+//	  fEuclidMaterial.Data());
+	  filtmp);
+    exit(1);
+  } // end if(file)
 }
-//_____________________________________________________________________________
-void AliITSvtest::CreateMaterials2(){
-    // Read materials for the ITS
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-    //TGeoManager *mgr = gGeoManager;
-    TGeoMaterial *si,*n2;
-    TGeoMedium *sims,*simn,*simN2;
-    Double_t params[8];
-    Int_t   ifield = gAlice->Field()->Integ();
-    Double_t fieldm = gAlice->Field()->Max(); // [kilogauss]
 
-    params[0] = 1.0; // sensitive volume flag
-    params[1] = (Double_t)ifield; // magnetic field type
-    params[2] = fieldm; // magnetic field stregth
-    params[3] = 0.1*fgkDegree; // tmaxfd  Theta max deviation over step
-    params[4] = 0.0075*fgkcm; // maximum step size
-    params[5] = 0.1; // Maximum fractional energy loss over a step
-    params[6] = 1.0E-4*fgkcm; // tracking precision
-    params[7] = 0.0*fgkcm; // Minimum step (=0 compute automatically)
-                           // must always be =0!
-
-    si = new TGeoMaterial("SI",28.86,14.0,2.33*fgkgcm3,
-                          TGeoMaterial::kMatStateSolid,25.0*fgkCelsius,
-                          0.0*fgkPascal);
-    sims = new TGeoMedium("ITSsensitiveSi",4,si,params);
-    params[0] = 0.0; // non sesitive.
-    simn = new TGeoMedium("ITSnonsensitiveSi",5,si,params);
-    //
-    n2 = new TGeoMaterial("Nitrogen Gas",14.00674,7.0,1.250E-3*fgkgcm3,
-                          TGeoMaterial::kMatStateGas,25.0*fgkCelsius,
-                          101325.0*fgkPascal);
-    simN2 = new TGeoMedium("ITSN2",6,n2,params);
-    //
-    if(sims==0 || simn==0 || simN2==0)
-        Error("CreateMaterial","Error getting medium ITSsensitiveSi=%p"
-              " ITSnonsensitiveSi=%p ITSN2=%p",sims,simn,simN2);
-}
 //_____________________________________________________________________________
 void AliITSvtest::CreateGeometry(){
-    // Read geometry for the ITS
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-
-    switch(GetMinorVersion()){
-    case 1:
-        CreateGeometryEuclid();
-        break;
-    case 2:
-        CreateGeometry2();
-        break;
-    default:
-        Warning("CreateGeometry","No CreateMaterials for minor version=%d",
-                 GetMinorVersion());
-        break;
-    } // end switch
-    return;
-}
-//_____________________________________________________________________________
-void AliITSvtest::CreateGeometryEuclid(){
-    // Read geometry for the ITS
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
+//////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+// Read geometry for the ITS
+//
     char topvol[5];
     char *filtmp;
-
-    filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
-    FILE *file = fopen(filtmp,"r");
-    delete [] filtmp;
-    if(file) {
-        fclose(file);
-        printf("Ready to read Euclid geometry file\n");
-        ReadEuclid(fEuclidGeometry.Data(),topvol);
-        printf("Read in euclid geometries\n");
-    } else {
-        Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
-              fEuclidGeometry.Data());
-        exit(1);
-    } // end if(file)
-    //
-    //---Place the ITS logical volume ITSV in its mother volume (ALIC) 
-    //   and make it invisible
-    //
-    gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
-    //
-    //---Outputs the geometry tree in the EUCLID/CAD format
-    
+//
+  filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
+  FILE *file = fopen(filtmp,"r");
+  delete [] filtmp;
+  if(file) {
+    fclose(file);
+    printf("Ready to read Euclid geometry file\n");
+    ReadEuclid(fEuclidGeometry.Data(),topvol);
+    printf("Read in euclid geometries\n");
+  } else {
+    Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
+	  fEuclidGeometry.Data());
+    exit(1);
+  } // end if(file)
+  //
+  //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
+  //     invisible
+  //
+  gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
+  //
+  //---Outputs the geometry tree in the EUCLID/CAD format
+  
     if (fEuclidOut) {
-        gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
+      gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
     } // end if (fEuclidOut)
     cout <<"finished with euclid geometrys"<< endl;
 }
-//_____________________________________________________________________________
-void AliITSvtest::CreateGeometry2(){
-    // Test geometry verion 2.
-    //  /ALIC_1/ITSV_1/ITSspd1_1/ITS1_1/   lay=1
-    //  /ALIC_1/ITSV_1/ITSspd2_1/ITS2_1/   lay=2
-    //  /ALIC_1/ITSV_1/ITSsdd1_1/ITS3_1/   lay=3
-    //  /ALIC_1/ITSV_1/ITSsdd2_1/ITS4_1/   lay=4
-    //  /ALIC_1/ITSV_1/ITSssd1_1/ITS5_1/   lay=5
-    //  /ALIC_1/ITSV_1/ITSssd2_1/ITS6_1/   Lay=6
+//______________________________________________________________________
+void AliITSvtest::InitAliITSgeom(){
+    //     Based on the geometry tree defined in Geant 3.21, this
+    // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
+    // sturture.
     // Inputs:
     //   none.
     // Outputs:
     //   none.
     // Return:
     //   none.
-    // These constant character strings are set by cvs during commit
-    // do not change them unless you know what you are doing!
-    const Char_t *cvsDate="$Date$";
-    const Char_t *cvsRevision="$Revision$";
-    const Double_t ksensitiveSPD[3]={0.6*fgkcm,0.01*fgkcm,3.5*fgkcm};
-    const Double_t ksensitiveSDD[3]={3.5085*fgkcm,0.01499*fgkcm,3.7485*fgkcm};
-    const Double_t ksensitiveSSD[3]={3.75*fgkcm,0.0150*fgkcm,2.1*fgkcm};
-    const Double_t kwaferSPD[3]={0.7*fgkcm,0.01*fgkcm,3.6*fgkcm};
-    const Double_t kwaferSDD[3]={3.61*fgkcm,0.0150*fgkcm,4.38*fgkcm};
-    const Double_t kwaferSSD[3]={3.85*fgkcm,0.0150*fgkcm,2.2*fgkcm};
-    TGeoManager *mgr = gGeoManager;
-    TGeoVolume *vALIC=0;
-    TGeoMedium *sensitiveSi=0,*bulckSi=0,*n2=0;
-    TGeoBBox *sITS,*sSPD,*sSDD,*sSSD;
-    TGeoBBox *sITS1,*sITS2,*sITS3,*sITS4,*sITS5,*sITS6;
-    TGeoVolume *vITS,*vSPD1,*vSPD2,*vSDD1,*vSDD2,*vSSD1,*vSSD2;
-    TGeoVolume *vITS1,*vITS2,*vITS3,*vITS4,*vITS5,*vITS6;
+    const Int_t knlayers = 6;
+    const Int_t kndeep = 3;
+    const AliITSDetector idet[knlayers]={kSPD,kSPD,kSDD,kSDD,kSSD,kSSDp};
+    const TString names[2][knlayers] = {
+     {"/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12A_%d/I10A_%d/I103_%d/I101_1/ITS1_1", // lay=1
+      "/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12A_%d/I20A_%d/I1D3_%d/I1D1_1/ITS2_1", // lay=2
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I005_%d/I402_%d/ITS4_%d", // lay=4
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I569_%d/I566_%d/ITS6_%d"},// lay=6
+     {"/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12B_%d/I10B_%d/I107_%d/I101_1/ITS1_1", // lay=1
+      "/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12B_%d/I20B_%d/I1D7_%d/I1D1_1/ITS2_1", // lay=2
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3
+      "/ALIC_1/ITSV_1/ITSD_1/IT34_1/I005_%d/I402_%d/ITS4_%d", // lay=4
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5
+      "/ALIC_1/ITSV_1/ITSD_1/IT56_1/I569_%d/I566_%d/ITS6_%d"}
+    };
+    const Int_t itsGeomTreeCopys[knlayers][kndeep]= {{10, 2, 4},// lay=1
+                                                     {10, 4, 4},// lay=2
+                                                     {14, 6, 1},// lay=3
+                                                     {22, 8, 1},// lay=4
+                                                     {34,22, 1},// lay=5
+                                                     {38,25, 1}};//lay=6
+    Int_t       nlad[knlayers],ndet[knlayers];
+    Int_t       mod,lay,lad=0,det=0,i,j,k,cp0,cp1,cp2;
+    TString path,shapeName;
+    TGeoHMatrix matrix;
+    Double_t trans[3]={3*0.0},rot[10]={9*0.0,1.0};
+    TArrayD shapePar;
+    TArrayF shapeParF;
+    Bool_t shapeDefined[4]={kFALSE,kFALSE,kFALSE,kFALSE};
 
-    vALIC = mgr->GetTopVolume();
-    if(vALIC==0) {
-        vALIC = mgr->GetVolume("ALIC");
-        if(vALIC==0) {
-            Error("CreateGeometry2","vALIC=0");
-            return;
-        }// end if
-    } // end if
-    //sensitiveSi = mgr->GetMedium("ITSsensitiveSi");
-    sensitiveSi = mgr->GetMedium(4);
-    //bulckSi     = mgr->GetMedium("ITSnonesensitiveSi");
-    bulckSi     = mgr->GetMedium(5);
-    //n2          = mgr->GetMedium("ITSN2");
-    n2          = mgr->GetMedium(6);
-    if(sensitiveSi==0 || bulckSi==0 || n2==0){
-        Error("CreateGeometry2","Error getting medium sensitiveSi=%p"
-              " bulckSi=%p n2=%p",sensitiveSi,bulckSi,n2);
-        TList *lmed = mgr->GetListOfMedia();
-        TIter next(lmed);
-        while(TGeoMedium *med = (TGeoMedium*) next())
-            med->Inspect();
-    } //
-    sITS1 = new TGeoBBox((Double_t*)ksensitiveSPD);
-    vITS1 = new TGeoVolume("ITS1",sITS1,sensitiveSi);
-    sITS2 = new TGeoBBox((Double_t*)ksensitiveSPD);
-    vITS2 = new TGeoVolume("ITS2",sITS2,sensitiveSi);
-    sSPD  = new TGeoBBox((Double_t*)kwaferSPD);
-    vSPD1 = new TGeoVolume("ITSspd1",sSPD,bulckSi);
-    vSPD2 = new TGeoVolume("ITSspd2",sSPD,bulckSi);
-    vSPD1->AddNode(vITS1,1,0); // one copy no translation/rotation
-    vSPD2->AddNode(vITS2,1,0); // one copy no translation/rotation
-    //
-    sITS3 = new TGeoBBox((Double_t*)ksensitiveSDD);
-    vITS3 = new TGeoVolume("ITS3",sITS3,sensitiveSi);
-    sITS4 = new TGeoBBox((Double_t*)ksensitiveSDD);
-    vITS4 = new TGeoVolume("ITS4",sITS4,sensitiveSi);
-    sSDD  = new TGeoBBox((Double_t*)kwaferSDD);
-    vSDD1 = new TGeoVolume("ITSsdd1",sSDD,bulckSi);
-    vSDD2 = new TGeoVolume("ITSsdd2",sSDD,bulckSi);
-    vSDD1->AddNode(vITS3,1,0); // one copy no translation/rotation
-    vSDD2->AddNode(vITS4,1,0); // one copy no translation/rotation
-    //
-    sITS5 = new TGeoBBox((Double_t*)ksensitiveSSD);
-    vITS5 = new TGeoVolume("ITS5",sITS5,sensitiveSi);
-    sITS6 = new TGeoBBox((Double_t*)ksensitiveSSD);
-    vITS6 = new TGeoVolume("ITS6",sITS6,sensitiveSi);
-    sSSD  = new TGeoBBox((Double_t*)kwaferSSD);
-    vSSD1 = new TGeoVolume("ITSssd1",sSSD,bulckSi);
-    vSSD2 = new TGeoVolume("ITSssd2",sSSD,bulckSi);
-    vSSD1->AddNode(vITS5,1,0); // one copy no translation/rotation
-    vSSD2->AddNode(vITS6,1,0); // one copy no translation/rotation
-    //
-    sITS = new TGeoBBox(100.0,100.,100.0);
-    vITS = new TGeoVolume("ITSV",sITS,n2); // one copy of vacume ITSV
-    const Int_t length=100;
-    Char_t vstrng[length];
-    if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
-                               fMinorVersion,cvsDate,cvsRevision))
-        vITS->SetTitle(vstrng);
-    else Error("CreateGeometry2","Error writing/setting version string");
+    AliDebug(1,"Reading Geometry transformation directly from Modler.");
+    mod = 0;
+    for(i=0;iAddNode(vITS,1,0);// one copy no translation/rotation
-    //
-    TGeoTranslation *t1,*t2,*t3,*t4,*t5,*t6;
-    TGeoRotation    *r1,*r2,*r3,*r4,*r5,*r6;
-    TGeoCombiTrans  *tr1,*tr2,*tr3,*tr4,*tr5,*tr6;
-    t1 = new TGeoTranslation( +4.0,+0.0,+0.0); // "perfect" location
-    r1 = new TGeoRotation("",90.0,0.0,0.0);    // "perfect" location
-    tr1= new TGeoCombiTrans(*t1,*r1);// "perfect" location
-    t2 = new TGeoTranslation( +7.0,+0.2,-0.5);
-    r2 = new TGeoRotation("",-91.0,10.0,-5.0);
-    tr2= new TGeoCombiTrans(*t2,*r2);
-    t3 = new TGeoTranslation(+14.9,-0.6,+0.1);
-    r3 = new TGeoRotation("",93.0,-7.0,5.0);
-    tr3= new TGeoCombiTrans(*t3,*r3);
-    t4 = new TGeoTranslation(+23.8,+0.3,-0.2);
-    r4 = new TGeoRotation("",91.0,10.0,-5.0);
-    tr4= new TGeoCombiTrans(*t4,*r4);
-    t5 = new TGeoTranslation(+39.1,+0.1,+0.4);
-    r5 = new TGeoRotation("",88.0,1.0,5.0);
-    tr5= new TGeoCombiTrans(*t5,*r5);
-    t6 = new TGeoTranslation(+43.6,-0.5,+0.2);
-    r6 = new TGeoRotation("",92.0,0.0,-5.0);
-    tr6= new TGeoCombiTrans(*t6,*r6);
-    //
-    vITS->AddNode(vSPD1,1,tr1);
-    vITS->AddNode(vSPD2,1,tr2);
-    vITS->AddNode(vSDD1,1,tr3);
-    vITS->AddNode(vSDD2,1,tr4);
-    vITS->AddNode(vSSD1,1,tr5);
-    vITS->AddNode(vSSD2,1,tr6);
-    //
+    SetITSgeom(0);
+    nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
+    ndet[0]= 4;ndet[1]= 4;ndet[2]= 6;ndet[3]= 8;ndet[4]=22;ndet[5]=25;
+    AliITSgeom* geom = new AliITSgeom(0,6,nlad,ndet,mod);
+    SetITSgeom(geom);
+    mod = 0;
+    for(lay=1;lay<=knlayers;lay++){
+        for(cp0=1;cp0<=itsGeomTreeCopys[lay-1][0];cp0++){
+            for(cp1=1;cp1<=itsGeomTreeCopys[lay-1][1];cp1++){
+                for(cp2=1;cp2<=itsGeomTreeCopys[lay-1][2];cp2++){
+                    path.Form(names[fMinorVersion-1][lay-1].Data(),
+                              cp0,cp1,cp2);
+                    switch (lay){
+                    case 1:{
+                        det = cp2;
+                        lad = cp1+2*(cp0-1);
+                    }break;
+                    case 2:{
+                        det = cp2;
+                        lad = cp1+4*(cp0-1);
+                    } break;
+                    case 3: case 4: case 5: case 6:{
+                        det = cp1;
+                        lad = cp0;
+                    } break;
+                    } // end switch
+                         //AliInfo(Form("path=%s lay=%d lad=%d det=%d",
+                         //             path.Data(),lay,lad,det));
+                    gMC->GetTransformation(path.Data(),matrix);
+                    gMC->GetShape(path.Data(),shapeName,shapePar);
+                    shapeParF.Set(shapePar.GetSize());
+                    for(i=0;iCreateMatrix(mod,lay,lad,det,idet[lay-1],trans,rot);
+                    geom->SetTrans(mod,matrix.GetTranslation());
+                    geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
+		    geom->GetGeomMatrix(mod)->SetPath(path.Data());
+                    switch (lay){
+                    case 1: case 2:
+			if(!shapeDefined[kSPD]){
+                        geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+			shapeDefined[kSPD] = kTRUE;
+                    }break;
+                    case 3: case 4:
+			if(!shapeDefined[kSDD]){
+                        geom->ReSetShape(kSDD,new AliITSgeomSDD256(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+			shapeDefined[kSDD] = kTRUE;
+                    }break;
+                    case 5:
+			if(!shapeDefined[kSSD]){
+                        geom->ReSetShape(kSSD,new AliITSgeomSSD75and275(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+			shapeDefined[kSSD] = kTRUE;
+                    }break;
+                    case 6:
+			if(!shapeDefined[kSSDp]){
+                        geom->ReSetShape(kSSDp,new AliITSgeomSSD275and75(
+                                shapeParF.GetSize(),shapeParF.GetArray()));
+			shapeDefined[kSSDp] = kTRUE;
+                    }break;
+                    default:{
+                    }break;
+                    } // end switch
+                    mod++;
+                } /// end for cp2
+            } // end for cp1
+        } // end for cp0
+    } // end for lay
     return;
 }
 //_____________________________________________________________________________
 void AliITSvtest::Init(){
-    // Initialise the ITS after it has been created.
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
+////////////////////////////////////////////////////////////////////////
+//     Initialise the ITS after it has been created.
+////////////////////////////////////////////////////////////////////////
     Int_t i;
 
     cout << endl;
     for(i=0;i<29;i++) cout << "*";cout << " ITSvtest_Init ";
     for(i=0;i<28;i++) cout << "*";cout << endl;
-
-    switch(GetMinorVersion()){
-    case 1:
-        InitEuclid();
-        break;
-    case 2:
-        Init2();
-        break;
-    default:
-        break;
-    } // end switch
-    UpdateInternalGeometry();
+//
+    if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
+    if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
+    if(GetITSgeom()!=0) SetITSgeom(0x0);
+    SetITSgeom(new AliITSgeom());
+    if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
+    if(!fGeomDetIn) this->InitAliITSgeom();
+    if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
     AliITS::Init();
-    if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite.Data());
-
+//
     for(i=0;i<72;i++) cout << "*";
     cout << endl;
 }
 //_____________________________________________________________________________
-void AliITSvtest::InitEuclid(){
-    // Initialise the ITS after it has been created. Euclid version
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-}
-//_____________________________________________________________________________
-void AliITSvtest::Init2(){
-    // Initialise the ITS after it has been created. Geometry 2 verion
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-    Int_t i,n=3,imed[3];
-    TGeoManager *mgr = gGeoManager;
-    if(mgr==0) Error("Init2","mgr=0");
-    TGeoMedium *sensitiveSi = mgr->GetMedium("ITSsensitiveSi");
-    TGeoMedium *bulckSi = mgr->GetMedium("ITSnonsensitiveSi");
-    TGeoMedium *n2 = mgr->GetMedium("ITSN2");
-
-    if(sensitiveSi==0) Error("Init2","sensitiveSi=0");
-    if(bulckSi==0) Error("Init2","bulckSi=0");
-    if(n2==0) Error("Init2","n2=0");
-    imed[0] = sensitiveSi->GetId();
-    imed[1] = bulckSi->GetId();
-    imed[2] = n2->GetId();
-    for(i=0;iGstpar(imed[i],"CUTGAM",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"CUTELE",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"CUTNEU",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"CUTHAD",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"CUTMUO",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"BCUTE",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"BCUTM",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"DCUTE",30.0*fgkKeV);
-        gMC->Gstpar(imed[i],"DCUTM",30.0*fgkKeV);
-        //gMC->Gstpar(imed[i],"PPCUTM",);
-        //gMC->Gstpar(imed[i],"PAIR",);
-        //gMC->Gstpar(imed[i],"COMPT",);
-        //gMC->Gstpar(imed[i],"PHOT",);
-        //gMC->Gstpar(imed[i],"PFIS",);
-        gMC->Gstpar(imed[i],"DRAY",1);
-        //gMC->Gstpar(imed[i],"ANNI",);
-        //gMC->Gstpar(imed[i],"BREM",);
-        //gMC->Gstpar(imed[i],"HADR",);
-        //gMC->Gstpar(imed[i],"MUNU",);
-        //gMC->Gstpar(imed[i],"DCAY",);
-        gMC->Gstpar(imed[i],"LOSS",1);
-        //gMC->Gstpar(imed[i],"MULS",);
-        //gMC->Gstpar(imed[i],"GHCOR1",);
-        //gMC->Gstpar(imed[i],"BIRK1",);
-        //gMC->Gstpar(imed[i],"BRIK2",);
-        //gMC->Gstpar(imed[i],"BRIK3",);
-        //gMC->Gstpar(imed[i],"LABS",);
-        //gMC->Gstpar(imed[i],"SYNC",);
-        //gMC->Gstpar(imed[i],"STRA",);
-    } // end for i
-    return;
-}
-//_____________________________________________________________________________
 void AliITSvtest::StepManager(){
-    // Called for every step in the ITS
-    // Inputs:
-    //   none.
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-    //
-    // Fill hit structure.
-    static TLorentzVector position, momentum; // Saves on calls to construtors
-    static AliITShit hit;                     // Saves on calls to construtors
-    Int_t cpn0,cpn1,cpn2,status,lay,mod,id;
-
-    if(!(gMC->TrackCharge())) return;
-    if(!(this->IsActive())) return;
-    TClonesArray &lhits = *(Hits());
-    // Track status
-    status = 0;
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
-    // Only entering charged tracks
-    id = gMC->CurrentVolID(cpn0);
-    for(lay=0;lay<6;lay++) if(id == fIdSens[lay]) break;
-    lay++;
-    if(lay>6) return; // not in detector
-    cpn0=cpn1=cpn2=1;
-    fIgm.DecodeDetector(mod,lay,cpn0,cpn1,cpn2);
-    // Fill hit structure.
-    hit.SetModule(mod);
-    hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
-    gMC->TrackPosition(position);
-    gMC->TrackMomentum(momentum);
-    hit.SetPosition(position);
-    hit.SetTime(gMC->TrackTime());
-    hit.SetMomentum(momentum);
-    hit.SetStatus(status);
-    hit.SetEdep(gMC->Edep());
-    hit.SetShunt(GetIshunt());
-    if(gMC->IsTrackEntering()){
-        hit.SetStartPosition(position);
-        hit.SetStartTime(gMC->TrackTime());
-        hit.SetStartStatus(status);
-        return; // don't save entering hit.
-    } // end if IsEntering
-    // Fill hit structure with this new hit.
-    new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
-    // Save old position... for next hit.
-    hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
-    hit.SetStartStatus(status);
-    //
-    Double_t g0[4],l0[4],g1[4];
-    position.GetXYZT(g0);
-    gMC->Gmtod(g0,l0,1); // flag=1 convert coordiantes
-    gMC->Gdtom(l0,g1,1); // flag=1 convert coordinates
-    printf("    gMC: mod=%d g=%g %g %g %g -> l= %g %g %g %g ->g=%g %g %g %g\n",
-           mod,g0[0],g0[1],g0[2],g0[3],l0[0],l0[1],l0[2],l0[3],g1[0],g1[2],g1[2],g1[3]);
-    GetITSgeom()->GtoL(mod,g0,l0);
-    GetITSgeom()->LtoG(mod,l0,g1);
-    printf("ITSgeom: mod=%d g=%g %g %g %g -> l= %g %g %g %g ->g=%g %g %g %g\n",
-           mod,g0[0],g0[1],g0[2],g0[3],l0[0],l0[1],l0[2],l0[3],g1[0],g1[2],g1[2],g1[3]);
-    TGeoNode *cur = gGeoManager->GetCurrentNode();
-    cur->MasterToLocal(g0,l0);
-    cur->LocalToMaster(l0,g1);
-    printf("   TGeo: mod=%d g=%g %g %g %g -> l= %g %g %g %g ->g=%g %g %g %g\n",
-           mod,g0[0],g0[1],g0[2],g0[3],l0[0],l0[1],l0[2],l0[3],g1[0],g1[2],g1[2],g1[3]);
-    printf("=====================\n");
-    //
-
+  //
+  // Called for every step in the ITS
+  //
+  Int_t          copy, id;
+  Int_t          copy1,copy2;
+  Float_t        hits[8];
+  Int_t          vol[4];
+  TLorentzVector position, momentum;
+  TClonesArray   &lhits = *fHits;
+  //
+  // Track status
+  vol[3] = 0;
+  if(gMC->IsTrackInside())      vol[3] +=  1;
+  if(gMC->IsTrackEntering())    vol[3] +=  2;
+  if(gMC->IsTrackExiting())     vol[3] +=  4;
+  if(gMC->IsTrackOut())         vol[3] +=  8;
+  if(gMC->IsTrackDisappeared()) vol[3] += 16;
+  if(gMC->IsTrackStop())        vol[3] += 32;
+  if(gMC->IsTrackAlive())       vol[3] += 64;
+  //
+  // Fill hit structure.
+  if(!(gMC->TrackCharge())) return;
+  //
+  // Only entering charged tracks
+  if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
+      vol[0] = 1;
+      id = gMC->CurrentVolOffID(0,copy);
+      //detector copy in the ladder = 1<->4  (ITS1)
+      vol[1] = copy;
+      gMC->CurrentVolOffID(1,copy1);
+      //ladder copy in the module   = 1<->2  (I186)
+      gMC->CurrentVolOffID(2,copy2);
+      //module copy in the layer    = 1<->10 (I132)
+      vol[2] = copy1+(copy2-1)*2;//# of ladders in one module  = 2
+  } else if(id == fIdSens[1]){
+      vol[0] = 2;
+      id = gMC->CurrentVolOffID(0,copy);
+      //detector copy in the ladder = 1<->4  (ITS2)
+      vol[1] = copy;
+      gMC->CurrentVolOffID(1,copy1);
+      //ladder copy in the module   = 1<->4  (I131)
+      gMC->CurrentVolOffID(2,copy2);
+      //module copy in the layer    = 1<->10 (I132)
+      vol[2] = copy1+(copy2-1)*4;//# of ladders in one module  = 4
+  } else if(id == fIdSens[2]){
+      vol[0] = 3;
+      id = gMC->CurrentVolOffID(1,copy);
+      //detector copy in the ladder = 1<->5  (ITS3 is inside I314)
+      vol[1] = copy;
+      id = gMC->CurrentVolOffID(2,copy);
+      //ladder copy in the layer    = 1<->12 (I316)
+      vol[2] = copy;
+  } else if(id == fIdSens[3]){
+      vol[0] = 4;
+      id = gMC->CurrentVolOffID(1,copy);
+      //detector copy in the ladder = 1<->8  (ITS4 is inside I414)
+      vol[1] = copy;
+      id = gMC->CurrentVolOffID(2,copy);
+      //ladder copy in the layer    = 1<->22 (I417)
+      vol[2] = copy;
+  }else if(id == fIdSens[4]){
+      vol[0] = 5;
+      id = gMC->CurrentVolOffID(1,copy);
+      //detector copy in the ladder = 1<->23  (ITS5 is inside I562)
+      vol[1] = copy;
+      id = gMC->CurrentVolOffID(2,copy);
+     //ladder copy in the layer    = 1<->34 (I565)
+      vol[2] = copy;
+  }else if(id == fIdSens[5]){
+      vol[0] = 6;
+      id = gMC->CurrentVolOffID(1,copy);
+      //detector copy in the ladder = 1<->26  (ITS6 is inside I566)
+      vol[1] = copy;
+      id = gMC->CurrentVolOffID(2,copy);
+      //ladder copy in the layer = 1<->38 (I569)
+      vol[2] = copy;
+  } else {
+      return; // not an ITS volume?
+  } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
+//
+  gMC->TrackPosition(position);
+  gMC->TrackMomentum(momentum);
+  hits[0]=position[0];
+  hits[1]=position[1];
+  hits[2]=position[2];
+  hits[3]=momentum[0];
+  hits[4]=momentum[1];
+  hits[5]=momentum[2];
+  hits[6]=gMC->Edep();
+  hits[7]=gMC->TrackTime();
+  // Fill hit structure with this new hit.
+  new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
   return;
 }
-//______________________________________________________________________
-void AliITSvtest::PrintAscii(ostream *os)const{
-    // Print out class data values in Ascii Form to output stream
-    // Inputs:
-    //   ostream *os   Output stream where Ascii data is to be writen
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-#if defined __GNUC__
-#if __GNUC__ > 2
-    ios::fmtflags fmt;
-#else
-    Int_t fmt;
-#endif
-#else
-#if defined __ICC || defined __ECC || defined __xlC__
-    ios::fmtflags fmt;
-#else
-    Int_t fmt;
-#endif
-#endif
-
-    *os << fGeomDetOut << " " << fGeomDetIn  << " ";
-    *os << fMajorVersion << " " << fMinorVersion << " ";
-    *os << "\"" << fEuclidGeomDet.Data() << "\"" << " ";
-    *os << "\"" << fRead.Data() << "\"" << " ";
-    *os << "\"" << fWrite.Data() << "\"" << " ";
-    fmt = os->setf(ios::scientific); // set scientific floating point output
-    os->flags(fmt); // reset back to old Formating.
-    return;
-}
-//______________________________________________________________________
-void AliITSvtest::ReadAscii(istream *is){
-    // Read in class data values in Ascii Form to output stream
-    // Inputs:
-    //   istream *is   Input stream where Ascii data is to be read in from
-    // Outputs:
-    //   none.
-    // Return:
-    //   none.
-    Char_t name[120];
 
-    *is >> fGeomDetOut >> fGeomDetIn ;
-    *is >> fMajorVersion >> fMinorVersion;
-    *is >> name;
-    fEuclidGeomDet = name;
-    *is >> name;
-    fRead = name;
-    *is >> name;
-    fWrite = name;
-    fIgm.SetVersion((AliITSVersion_t)fMajorVersion,fMinorVersion);
-    fIgm.SetGeometryName("ITS test geometry");
-}
-//______________________________________________________________________
-ostream &operator<<(ostream &os,const AliITSvtest &s){
-    // Standard output streaming function
-    // Inputs:
-    //   ostream            &os  output steam
-    //   AliITSvtest &s class to be streamed.
-    // Output:
-    //   none.
-    // Return:
-    //   ostream &os  The stream pointer
-
-    s.PrintAscii(&os);
-    return os;
-}
-//______________________________________________________________________
-istream &operator>>(istream &is,AliITSvtest &s){
-    // Standard inputput streaming function
-    // Inputs:
-    //   istream            &is  input steam
-    //   AliITSvtest &s class to be streamed.
-    // Output:
-    //   none.
-    // Return:
-    //   ostream &os  The stream pointer
-
-    s.ReadAscii(&is);
-    return is;
-}
diff --git a/ITS/AliITSvtest.h b/ITS/AliITSvtest.h
index eab5e165818..5f122c0a191 100644
--- a/ITS/AliITSvtest.h
+++ b/ITS/AliITSvtest.h
@@ -9,99 +9,69 @@
 //     Manager and hits classes for  ITS version 5
 ////////////////////////////////////////////////////////////////////////
 
-#include "AliITSInitGeometry.h"
+
 #include "AliITS.h"
 
 class TBRIK;
 class AliITSvtest : public AliITS {
- public:
-    AliITSvtest(); // Default constructor
-    AliITSvtest(const Char_t *title,Int_t version=0); // Standard Constructor
-    // Constructor for Euclid geometries
-    AliITSvtest(const char *fileeuc,const char *filetme,
-                const char *name, const char *title);
-    virtual ~AliITSvtest(); // Destructor
-    void CreateGeometry(); // Create test geometry 
-    void CreateMaterials(); // Create test geometry materials
-    void Init(); // Initlizie test geometry for transport
-    Int_t IsVersion() const {// returns the ITS version number 
-        return kvtest;}
-    void StepManager(); // Transport step manager
-    void SetWriteDet(Bool_t det=kTRUE){ // set .det write
-        fGeomDetOut = det;}
-    void SetWriteDet(const char *f){ // set write file
-        fWrite=f;fGeomDetOut = kTRUE;}
-    void SetReadDet(Bool_t det=kTRUE){ //set .det read
-        fGeomDetIn = det;}
-    void SetReadDet(const char *f){ // set read file
-        fRead=f;fGeomDetIn = kTRUE;}
-    void SetEUCLIDFileName(const char *f){ // set write file
-        fEuclidGeometry=f;fEuclidOut = kTRUE;}
-    void SetMinorVersion(Int_t v){ // Choose between existing minor versions
-	fMinorVersion = 1;if(v==1) fMinorVersion = 1;
+
+public:
+     AliITSvtest();
+     AliITSvtest(const char *fileeuc,const char *filetme,
+	         const char *name, const char *title);
+     virtual       ~AliITSvtest() ;
+     virtual void  CreateGeometry();
+     virtual void  CreateMaterials();
+     virtual void  Init();
+     virtual Int_t IsVersion() const {// returns the ITS version number 
+	 return -1;}
+     virtual void  StepManager();
+    virtual void   SetWriteDet(Bool_t det=kTRUE){ // set .det write
+	                                         fGeomDetOut = det;}
+    virtual void   SetWriteDet(const char *f){ // set write file
+	                             strncpy(fWrite,f,60);fGeomDetOut = kTRUE;}
+    virtual void   SetReadDet(Bool_t det=kTRUE){ //set .det read
+	                                        fGeomDetIn = det;}
+    virtual void   SetReadDet(const char *f){ // set read file
+	                               strncpy(fRead,f,60);fGeomDetIn = kTRUE;}
+    virtual void   SetEUCLIDFileName(const char *f){ // set write file
+	                     fEuclidGeometry=f;fEuclidOut = kTRUE;}
+    virtual void   SetMinorVersion(Int_t v){ // Choose between existing minor versions
+	fMinorVersion = 1;
+	if(v==1) fMinorVersion = 1;
 	else if(v==2) fMinorVersion = 2;
 	else Warning("SetMinorVersion","Undefined Minor Version setting =1");}
-    Bool_t GetWriteDet() const { // returns value GeomDetOut flag.
-        return fGeomDetOut;}
-    Bool_t GetReadDet() const { // returns value GeomDetIn flag.
-        return fGeomDetIn;}
-    Char_t *GetEULIIDFileName() const{ // return .euc file name
-        return (Char_t*)(fEuclidGeometry.Data());}
-    Char_t *GetReadDetFileName()const{ // return .det read file name
-        if(!fRead.IsNull()) return (Char_t*)(fRead.Data());
-        else return GetEULIIDFileName();}
-    Char_t *GetWriteDetFileName()const{ // return .det write file name
-        if(!fWrite.IsNull()) return (Char_t*)(fWrite.Data());
-        else return GetEULIIDFileName();}
-    Int_t GetMajorVersion() const {// return Major Version Number
+
+    virtual const char  *GetEULIIDFileName() const{ // return .euc file name
+	                               return fEuclidGeometry.Data();}
+    virtual Bool_t GetWriteDet() const { // returns value GeomDetOut flag.
+	                          return fGeomDetOut;}
+    virtual Bool_t GetReadDet() const { // returns value GeomDetIn flag.
+	                         return fGeomDetIn;}
+    virtual char  *GetReadDetFileName(){ // return .det read file name
+	          if(fRead[0]!='\0') return fRead; else return fEuclidGeomDet;}
+    virtual char  *GetWriteDetFileName(){ // return .det write file name
+	        if(fWrite[0]!='\0') return fWrite; else return fEuclidGeomDet;}
+    virtual Int_t GetMajorVersion() const {// return Major Version Number
 	return fMajorVersion;}
-    Int_t GetMinorVersion() const {// return Major Version Number
+    virtual Int_t GetMinorVersion() const {// return Major Version Number
 	return fMinorVersion;}
-    // Print class in ascii form to stream
-    void PrintAscii(ostream *os)const;
-    // Read in class in ascii form from stream
-    void ReadAscii(istream *is);
-
-  protected:
-    // Units, Convert from k?? to cm,degree,GeV,seconds,
-    static const Double_t fgkmicron; // Convert micron to TGeom's cm.
-    static const Double_t fgkmm; // Convert mm to TGeom's cm.
-    static const Double_t fgkcm; // Convert cm to TGeom's cm.
-    static const Double_t fgkDegree; //Convert degrees to TGeom's degrees
-    static const Double_t fgkRadian; //To Radians
-    static const Double_t fgkgcm3;   // Density in g/cm^3
-    static const Double_t fgkCelsius; // Temperature in degrees Celcius
-    static const Double_t fgkPascal;  // Preasure in Pascal
-    static const Double_t fgkKPascal;  // Preasure in KPascal
-    static const Double_t fgkeV;  // Energy in eV
-    static const Double_t fgkKeV;  // Energy in KeV
-    static const Double_t fgkMeV;  // Energy in MeV
-    static const Double_t fgkGeV;  // Energy in GeV
-
 
  private:
     AliITSvtest(const AliITSvtest &source); // copy constructor
     AliITSvtest& operator=(const AliITSvtest &source); // assignment operator
-    void CreateMaterialsEuclid(); // Create test geometry materials from Euclid
-    void CreateGeometryEuclid(); // Create test geometry Geometry from Euclid
-    void InitEuclid(); // Create test geometry Init for Euclid
-    void CreateMaterials2(); // Create test geometry materials from geometry2
-    void CreateGeometry2(); // Create test geometry Geometry from geometry2
-    void Init2(); // Create test geometry Init for geometry2
-    // TString fEuclidGeomtery,fEuclidMaterial defined in AliModule.
-    Bool_t  fGeomDetOut;       // Flag to write .det file out
-    Bool_t  fGeomDetIn;        // Flag to read .det file or directly from Geat.
-    Int_t   fMajorVersion;     // Major version number == IsVersion
-    Int_t   fMinorVersion;     // Minor version number
-    TString fEuclidGeomDet;// file where detector transormation are define.
-    TString fRead;         //! file name to read .det file
-    TString fWrite;        //! file name to write .det file
-    AliITSInitGeometry fIgm;//! Geometry initilization object
+    void InitAliITSgeom();
 
-    ClassDef(AliITSvtest,2)  //Hits manager for ITS test version, Private ITS class for different test geometries
+    // TString fEuclidGeomtery,fEuclidMaterial defined in AliModule.
+    Bool_t fGeomDetOut;       // Flag to write .det file out
+    Bool_t fGeomDetIn;        // Flag to read .det file or directly from Geat.
+    Int_t  fMajorVersion;     // Major version number == IsVersion
+    Int_t  fMinorVersion;     // Minor version number
+    char   fEuclidGeomDet[60];// file where detector transormation are define.
+    char   fRead[60];         //! file name to read .det file
+    char   fWrite[60];        //! file name to write .det file
+  
+    ClassDef(AliITSvtest,1)  //Hits manager for ITS test version, Private ITS class for different test geometries
 };
-// Input and output function for standard C++ input/output.
-ostream &operator<<(ostream &os,const AliITSvtest &s);
-istream &operator>>(istream &is,AliITSvtest &s);
  
 #endif
diff --git a/ITS/Displayv11.C b/ITS/Displayv11.C
index 57077b776bd..366979883de 100644
--- a/ITS/Displayv11.C
+++ b/ITS/Displayv11.C
@@ -19,8 +19,6 @@ void Displayv11(const char* filename=""){
     TGeoVolume *ALIC = mgr2->MakeBox("ALIC",vacmed,100.,100.,200.);
     mgr2->SetTopVolume(ALIC);
     TGeoVolume *ITS = mgr2->MakeBox("ITSV",vacmed,99.,99.,199.);
-    TGeoVolumeAssembly *ITSspd = new TGeoVolumeAssembly("ITSspd");
-    ITS->AddNode(ITSspd,1);
     ALIC->AddNode(ITS,1);
     //
     /*
@@ -31,21 +29,14 @@ void Displayv11(const char* filename=""){
     its->CreateMaterials();
     its->CreateGeometry();
     */
-    AliITSv11GeometrySPD *gspd = new AliITSv11GeometrySPD(0);
-    //AliITSv11GeometrySDD *gsdd = new AliITSv11GeometrySDD();
-    AliITSv11GeometrySupport *gsupp = new AliITSv11GeometrySupport(3);
-    //AliITSv11GeometrySSD *gssd = new AliITSv11GeometrySSD();
+    AliITSv11GeometrySPD *gspd = new AliITSv11GeometrySPD();
+    //AliITSv11GeometrySDD *gsdd = new AliITSgeometrySDD();
+    //AliITSv11GeometrySupport *gsupp = new AliITSGeometrySupport();
+    //AliITSv11GeometrySSD *gssd = new AliITSGeometrySSD();
     //
     Int_t imat=1,imed=1;
     gspd->CreateSPDCenteralMaterials(imed,imat);
-    gspd->SPDSector(ITSspd,mgr2);
-    gsupp->SPDCone(ITS,mgr2);
-    gsupp->SetDebug(1);
-    gsupp->SDDCone(ITS,mgr2);
-    //gsdd->Layer3(ITS);
-    //gsdd->Layer4(ITS);
-    gsupp->SSDCone(ITS,mgr2);
-    gsupp->ServicesCableSupport(ITS);
+    gspd->SPDSector(ITS,mgr2);
     //
     mgr2->CloseGeometry();
     //
@@ -60,10 +51,8 @@ void Displayv11(const char* filename=""){
     bar->AddButton("Set RayTrace off","ISetits(5,0)","Perspective off");
     bar->AddButton("Set circle/80","ISetits(1,80)","circles ~ by 80 lines");
     bar->AddButton("Display Geometry","Displayit()","Run Displayit");
-    bar->AddButton("Display SPD Sector Volume","EngineeringSPDSector()",
-                   "Run EngineeringSPDSector");
-    bar->AddButton("Display SPD Ceneral Volume","EngineeringSPDCenter()",
-                   "Run EngineeringSPDCenter");
+    bar->AddButton("Display SPD Ceneral Volume","EngineeringSPDLayer()",
+                   "Run EngineeringSPDLayer");
     bar->AddButton("Display SPD Thermal Sheald","EngineeringSPDThS()",
                    "Run EngineeringSPDThS");
     bar->AddButton("Display SDD Layer 3","EngineeringSDDLayer3()",
@@ -254,8 +243,8 @@ void Displayit(){
     //
 }
 //----------------------------------------------------------------------
-void EngineeringSPDSector(){
-    // Display SPD Sector Geometry
+void EngineeringSPDLayer(){
+    // Display SPD Layer Geometry
     // Inputs:
     //    none.
     // Outputs:
@@ -269,16 +258,14 @@ void EngineeringSPDSector(){
     TCanvas *c4;
     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
         c4 = new TCanvas("C4","ITS SPD Layer Geometry Side View",500,500);
-    TGeoVolume *ITS,*ITSspd,*SPDLay=0;
+    TGeoVolume *ITS,*SPDLay=0;
     TGeoNode *node;
     TArrow *arrow=new TArrow();
     //
     node = ALIC->FindNode("ITSV_1");
     ITS = node->GetVolume();
-    node = ITS->FindNode("ITSspd_1");
-    ITSspd = node->GetVolume();
-    node = ITSspd->FindNode("ITSSPDCarbonFiberSectorV_1");
-    //node = ITSspd->FindNode("ITSSPDTempSPDMotherVolume_1");
+    node = ITS->FindNode("ITSSPDCarbonFiberSectorV_1");
+    //node = ITS->FindNode("ITSSPDTempSPDMotherVolume_1");
     SPDLay = node->GetVolume();
     //
     mgr2->SetNsegments(ISetits(1,-1));
@@ -299,7 +286,7 @@ void EngineeringSPDSector(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -307,13 +294,13 @@ void EngineeringSPDSector(){
     if(ISetits(5,-1)==1) SPDLay->Raytrace();
     //
     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
-        c5 = new TCanvas("C5","ITS SPD Sector Geometry End View",500,500);
+        c5 = new TCanvas("C5","ITS SPD Layer Geometry End View",500,500);
     SPDLay->Draw();
     TView *view2 = c5->GetView();
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -322,71 +309,6 @@ void EngineeringSPDSector(){
     //
 }
 //----------------------------------------------------------------------
-void EngineeringSPDCenter(){
-    // Display SPD Centeral Geometry
-    // Inputs:
-    //    none.
-    // Outputs:
-    //    none.
-    // Retrurn:
-    //    none.
-    Int_t irr;
-    //
-    TGeoManager *mgr2 = gGeoManager;
-    TGeoVolume *ALIC = mgr2->GetTopVolume();
-    TCanvas *c4;
-    if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
-        c4 = new TCanvas("C4","ITS SPD Layer Geometry Side View",500,500);
-    TGeoVolume *ITS,*ITSspd,*SPDLay=0;
-    TGeoNode *node;
-    TArrow *arrow=new TArrow();
-    //
-    node = ALIC->FindNode("ITSV_1");
-    ITS = node->GetVolume();
-    node = ITS->FindNode("ITSspd_1");
-    ITSspd = node->GetVolume();
-    //
-    mgr2->SetNsegments(ISetits(1,-1));
-    //
-    mgr2->SetVisLevel(6);
-    mgr2->SetVisOption(0);
-    //mgr2->CheckOverlaps(0.01);
-    //mgr2->PrintOverlaps();
-    if(ISetits(2,-1)==1){
-        TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
-        mgr2->SetClippingShape(clip);
-    } // end if
-    mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
-    if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
-    //
-    ITSspd->Draw();
-    TView *view1 = c4->GetView();
-    if(view1){
-        view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
-        if(irr) cout <<"error="<SetParallel();
-        else  view1->SetPerspective();
-        view1->Front();
-        if(ISetits(3,-1)!=0) view1->ShowAxis();
-    } // end if view1
-    if(ISetits(5,-1)==1) SPDLay->Raytrace();
-    //
-    if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
-        c5 = new TCanvas("C5","ITS SPD Centeral Geometry End View",500,500);
-    ITSspd->Draw();
-    TView *view2 = c5->GetView();
-    if(view2){
-        view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
-        if(irr) cout <<"error="<SetParallel();
-        else  view2->SetPerspective();
-        view2->Top();
-        if(ISetits(3,-1)!=0) view2->ShowAxis();
-    } // end if view2
-    if(ISetits(5,-1)==1) ITSspd->Raytrace();
-    //
-}
-//----------------------------------------------------------------------
 void EngineeringSPDThS(){
     // Display SPD Thermal Sheald Geometry
     // Inputs:
@@ -409,7 +331,7 @@ void EngineeringSPDThS(){
     //
     node = ALIC->FindNode("ITSV_1");
     ITS = node->GetVolume();
-    node = ITS->FindNode("ITSspdThermalShealdMother_1");
+    node = ITS->FindNode("ITSspdThermalShealdMotherM_1");
     SPDThS = node->GetVolume();
     //
     mgr2->SetNsegments(ISetits(1,-1));
@@ -432,7 +354,7 @@ void EngineeringSPDThS(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -446,7 +368,7 @@ void EngineeringSPDThS(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -497,7 +419,7 @@ void EngineeringSDDLayer3(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -511,7 +433,7 @@ void EngineeringSDDLayer3(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -562,7 +484,7 @@ void EngineeringSDDLayer4(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -576,7 +498,7 @@ void EngineeringSDDLayer4(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -629,7 +551,7 @@ void EngineeringSDDCone(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -643,7 +565,7 @@ void EngineeringSDDCone(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -700,7 +622,7 @@ void EngineeringSDDCylinder(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -715,7 +637,7 @@ void EngineeringSDDCylinder(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -771,7 +693,7 @@ void EngineeringSSDCone(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Top();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -785,7 +707,7 @@ void EngineeringSSDCone(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Front();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -842,7 +764,7 @@ void EngineeringSSDCylinder(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -857,7 +779,7 @@ void EngineeringSSDCylinder(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -914,7 +836,7 @@ void EngineeringSupRB24(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -928,7 +850,7 @@ void EngineeringSupRB24(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -983,7 +905,7 @@ void EngineeringSupTrayRB24(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -1000,7 +922,7 @@ void EngineeringSupTrayRB24(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
@@ -1054,7 +976,7 @@ void EngineeringSupRB26(){
     if(view1){
         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view1->SetParralel();
         else  view1->SetPerspective();
         view1->Front();
         if(ISetits(3,-1)!=0) view1->ShowAxis();
@@ -1068,7 +990,7 @@ void EngineeringSupRB26(){
     if(view2){
         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
         if(irr) cout <<"error="<SetParallel();
+        if(ISetits(4,-1)==0) view2->SetParralel();
         else  view2->SetPerspective();
         view2->Top();
         if(ISetits(3,-1)!=0) view2->ShowAxis();
diff --git a/ITS/ITSrecLinkDef.h b/ITS/ITSrecLinkDef.h
index 6e06ec19877..98b589b96d8 100644
--- a/ITS/ITSrecLinkDef.h
+++ b/ITS/ITSrecLinkDef.h
@@ -41,7 +41,7 @@
 
 #pragma link C++ class  AliITSVertexer+;
 #pragma link C++ class  AliITSVertexerIons+;
-#pragma link C++ class  AliITSVertexerCosmics+;
+#pragma link C++ class  AliITSVertexerPPZ+;
 #pragma link C++ class  AliITSVertexerZ+;
 #pragma link C++ class  AliITSVertexer3D+;
 #pragma link C++ class  AliITSZPoint+;
diff --git a/ITS/libITSrec.pkg b/ITS/libITSrec.pkg
index 5ce912c9ec3..c8a87b022ec 100644
--- a/ITS/libITSrec.pkg
+++ b/ITS/libITSrec.pkg
@@ -19,7 +19,7 @@ SRCS = 	AliITSDetTypeRec.cxx \
 		AliITStrackerMI.cxx \
 		AliITSVertexer.cxx \
 		AliITSVertexerIons.cxx \
-		AliITSVertexerCosmics.cxx \
+		AliITSVertexerPPZ.cxx \
 		AliITSVertexer3D.cxx \
 		AliITSVertexerZ.cxx \
 		AliITSVertexerFast.cxx \
diff --git a/MUON/AliMUON.cxx b/MUON/AliMUON.cxx
index 464df0c95ce..e40232118ee 100644
--- a/MUON/AliMUON.cxx
+++ b/MUON/AliMUON.cxx
@@ -55,6 +55,7 @@
 #include "AliMUONChamberTrigger.h"
 #include "AliMUONConstants.h"
 #include "AliMUONHit.h"	
+#include "AliMUONRawCluster.h"
 #include "AliMUONGeometry.h"
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONGeometryBuilder.h"
@@ -484,13 +485,33 @@ AliLoader* AliMUON::MakeLoader(const char* topfoldername)
  AliDebug(1,Form("Creating standard getter for detector %s. Top folder is %s.",
          GetName(),topfoldername));
  fLoader   = new AliLoader(GetName(),topfoldername);
- fMUONData = new AliMUONSimData(fLoader,GetName(),GetName()); 
+ fMUONData = new AliMUONData(fLoader,GetName(),GetName()); 
  fMUONData->SetSplitLevel(fSplitLevel);
 
  fDigitMaker->SetMUONData(fMUONData);
 
  return fLoader;
 }
+//_______________________________________________________________________
+
+AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
+{
+/// Return rawcluster (icluster) for chamber ichamber and cathode icathod
+/// Obsolete ??
+
+    TClonesArray *muonRawCluster  = GetMUONData()->RawClusters(ichamber);
+    ResetRawClusters();
+    TTree *treeR = fLoader->TreeR();
+    Int_t nent=(Int_t)treeR->GetEntries();
+    treeR->GetEvent(nent-2+icathod-1);
+    //treeR->GetEvent(icathod);
+    //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
+
+    AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
+    //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
+    
+    return  mRaw;
+}
 
 //________________________________________________________________________
 void
diff --git a/MUON/AliMUON.h b/MUON/AliMUON.h
index 691805ad921..c3dfbe5a6e0 100644
--- a/MUON/AliMUON.h
+++ b/MUON/AliMUON.h
@@ -6,7 +6,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup sim
+/// \ingroup base
 /// \class AliMUON
 /// \brief AliDetector class for MUON subsystem providing
 /// simulation data management 
@@ -15,7 +15,7 @@
 #include 
 
 #include "AliDetector.h"
-#include "AliMUONSimData.h"
+#include "AliMUONData.h"
 #include "AliMUONChamber.h"
 #include "AliMUONTrigger.h"
 
@@ -25,10 +25,11 @@ class TFile;
 class TTree;
 
 class AliLoader;
-class AliMUONSimData;
+class AliMUONData;
 class AliMUONResponse;
 class AliMUONSegmentation;
 class AliMUONHit;
+class AliMUONRawCluster;
 class AliMUONGeometry;
 class AliMUONGeometryTransformer;
 class AliMUONGeometryBuilder;
@@ -57,7 +58,7 @@ class AliMUON : public  AliDetector
     AliMUONSegmentation*               GetSegmentation() const    { return fSegmentation; }
 
                    /// Return MUONData   
-    AliMUONSimData*   GetMUONData() {return fMUONData;}
+    AliMUONData*   GetMUONData() {return fMUONData;}
 
     // MUONLoader definition
     virtual AliLoader* MakeLoader(const char* topfoldername); //builds standard getter (AliLoader type)
@@ -72,6 +73,8 @@ class AliMUON : public  AliDetector
     virtual void   ResetDigits()                 {GetMUONData()->ResetDigits();}
                    /// Reset trigger
     virtual void   ResetTrigger()                {GetMUONData()->ResetTrigger();}
+                   /// Reset raw clusters
+    virtual void   ResetRawClusters()            {GetMUONData()->ResetRawClusters();}
                    /// Set split level
     virtual void   SetSplitLevel(Int_t SplitLevel)     {fSplitLevel=SplitLevel;}
 
@@ -140,6 +143,11 @@ class AliMUON : public  AliDetector
       {return *((AliMUONChamber *) (*fChambers)[id]);}
                   /// Return reference to New Circuit \a id 
 
+    // Return pointers to digit
+    AliMUONRawCluster    *RawCluster(Int_t ichamber, Int_t icathod,
+				     Int_t icluster);
+    // Inherited and overridden from AliModule:
+    //PH    virtual void RemapTrackHitIDs(Int_t * map);
     
   protected:
     /// Not implemented
@@ -151,7 +159,7 @@ class AliMUON : public  AliDetector
 
     Int_t                 fNCh;                ///< Number of chambers   
     Int_t                 fNTrackingCh;        ///< Number of tracking chambers*
-    AliMUONSimData*       fMUONData;           ///< Data container for MUON subsystem  
+    AliMUONData*          fMUONData;           ///< Data container for MUON subsystem  
     Int_t                 fSplitLevel;         ///< Splitlevel when making branches in outfiles.
     TObjArray*            fChambers;           ///< List of Tracking Chambers
     AliMUONGeometryBuilder*  fGeometryBuilder; ///< Geometry builder 
@@ -183,7 +191,7 @@ class AliMUON : public  AliDetector
     
     AliMUONDigitMaker* fDigitMaker; //!< pointer to the digit maker class
 
-    ClassDef(AliMUON,14)  // MUON Detector base class
+    ClassDef(AliMUON,13)  // MUON Detector base class
 };
 #endif
 
diff --git a/MUON/AliMUONChamber.h b/MUON/AliMUONChamber.h
index ff47eefda81..c09ffa45c89 100644
--- a/MUON/AliMUONChamber.h
+++ b/MUON/AliMUONChamber.h
@@ -6,7 +6,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 //
-/// \ingroup sim
+/// \ingroup base
 /// \class AliMUONChamber
 /// \brief MUON tracking chamber class
 ///
diff --git a/MUON/AliMUONChamberTrigger.h b/MUON/AliMUONChamberTrigger.h
index 48bdc7b1aea..9e235e3e4d0 100644
--- a/MUON/AliMUONChamberTrigger.h
+++ b/MUON/AliMUONChamberTrigger.h
@@ -7,7 +7,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 //
-/// \ingroup sim
+/// \ingroup base
 /// \class AliMUONChamberTrigger
 /// \brief Muon trigger chamber class
 
diff --git a/MUON/AliMUONCheck.cxx b/MUON/AliMUONCheck.cxx
index 422c723324f..d5ad904c5be 100644
--- a/MUON/AliMUONCheck.cxx
+++ b/MUON/AliMUONCheck.cxx
@@ -29,8 +29,7 @@
 /// \author Frederic Yermia, INFN Torino
 
 #include "AliMUONCheck.h"
-#include "AliMUONSimData.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONDigit.h"
 #include "AliMUONConstants.h"
 #include "AliMUONTrack.h"
@@ -61,7 +60,6 @@
 /// \cond CLASSIMP
 ClassImp(AliMUONCheck)
 /// \endcond
-
 AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* esdFile,Int_t firstEvent, Int_t lastEvent,const char* outDir) 
 : TObject(),
   fFileName(galiceFile),
@@ -72,8 +70,8 @@ AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* esdFile,Int_t fir
   fLastEvent(lastEvent),
   fRunLoader(0x0),
   fRunLoaderSim(0x0),
-  fRecData(0x0),
-  fSimData(0x0),
+  fData(0x0),
+  fDataSim(0x0),
   fTree(0)
 {
   /// ctor
@@ -88,7 +86,7 @@ AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* esdFile,Int_t fir
     fLoader = fRunLoader->GetLoader("MUONLoader");
     if ( fLoader )
     {
-      fRecData = new AliMUONRecData(fLoader,"MUON","MUON");
+      fData = new AliMUONData(fLoader,"MUON","MUON");
     }
     else
     {
@@ -106,7 +104,7 @@ AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* esdFile,Int_t fir
     fLoaderSim = fRunLoaderSim->GetLoader("MUONLoader");
     if ( fLoaderSim )
     {
-      fSimData = new AliMUONSimData(fLoaderSim,"MUON","MUON");
+      fDataSim = new AliMUONData(fLoaderSim,"MUON","MUON");
     }
     else
     {
@@ -131,8 +129,8 @@ AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* galiceFileSim, co
   fLastEvent(lastEvent),
   fRunLoader(0x0),
   fRunLoaderSim(0x0),
-  fRecData(0x0),
-  fSimData(0x0),
+  fData(0x0),
+  fDataSim(0x0),
   fTree(0)
 {
   /// ctor
@@ -147,7 +145,7 @@ AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* galiceFileSim, co
     fLoader = fRunLoader->GetLoader("MUONLoader");
     if ( fLoader )
     {
-      fRecData = new AliMUONRecData(fLoader,"MUON","MUON");
+      fData = new AliMUONData(fLoader,"MUON","MUON");
     }
     else
     {
@@ -165,7 +163,7 @@ AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* galiceFileSim, co
     fLoaderSim = fRunLoaderSim->GetLoader("MUONLoader");
     if ( fLoaderSim )
     {
-      fSimData = new AliMUONSimData(fLoaderSim,"MUON","MUON");
+      fDataSim = new AliMUONData(fLoaderSim,"MUON","MUON");
     }
     else
     {
@@ -187,9 +185,9 @@ AliMUONCheck::~AliMUONCheck()
   fRunLoader->UnloadAll();
   fRunLoaderSim->UnloadAll();
   delete fRunLoader;
-  delete fRecData;
+  delete fData;
   delete fRunLoaderSim;
-  delete fSimData;
+  delete fDataSim;
 }
 
 //_____________________________________________________________________________
@@ -953,9 +951,9 @@ AliMUONCheck::CheckRecTracks () const
   for (Int_t ievent=fFirstEvent; ieventGetEvent(ievent);
     
-    fRecData->SetTreeAddress("RT");
-    fRecData->GetRecTracks();
-    TClonesArray* recTracks = fRecData->RecTracks();
+    fData->SetTreeAddress("RT");
+    fData->GetRecTracks();
+    TClonesArray* recTracks = fData->RecTracks();
     
     Int_t nrectracks = (Int_t) recTracks->GetEntriesFast(); //
     printf(">>> Event %d, Number of Recconstructed tracks %d \n",ievent, nrectracks);
@@ -970,7 +968,7 @@ AliMUONCheck::CheckRecTracks () const
       AliMUONTrackExtrap::ExtrapToZ(trackParam,0.);
       recTrack->Print("full");
     }
-    fRecData->ResetRecTracks();
+    fData->ResetRecTracks();
   }   
   fLoader->UnloadTracks();
 }
diff --git a/MUON/AliMUONCheck.h b/MUON/AliMUONCheck.h
index e5a50221ad6..b0908feb3ad 100644
--- a/MUON/AliMUONCheck.h
+++ b/MUON/AliMUONCheck.h
@@ -19,8 +19,7 @@
 #  include "TString.h"
 #endif
 
-class AliMUONSimData;
-class AliMUONRecData;
+class AliMUONData;
 class AliRunLoader;
 class AliLoader;
 class AliESD;
@@ -37,7 +36,7 @@ class AliMUONCheck : public TObject
   virtual ~AliMUONCheck();
  
   /// Return true if contains valid data
-  Bool_t IsValid() const { return (fRecData!=0); }
+  Bool_t IsValid() const { return (fData!=0); }
   
   void CheckESD(Bool_t pdc06TriggerResponse= false);
   void CheckKine();
@@ -69,8 +68,8 @@ class AliMUONCheck : public TObject
   AliLoader*    fLoader;    //!< MUON loader pointer for reconstruction
   AliLoader*    fLoaderSim; //!< MUON loader pointer for simulation
 
-  AliMUONRecData*  fRecData;  //!< AliMUONData pointer (to access containers) for recontruction 
-  AliMUONSimData*  fSimData;  //!< AliMUONData pointer (to access containers) for simulation
+  AliMUONData*  fData;     //!< AliMUONData pointer (to access containers) for recontruction 
+  AliMUONData*  fDataSim;  //!< AliMUONData pointer (to access containers) for simulation
 
   TTree   * fTree ;     //!< pointer to the analyzed TTree or TChain
   AliESD  * fESD ;      //!< Declaration of leave types
diff --git a/MUON/AliMUONClusterDrawAZ.cxx b/MUON/AliMUONClusterDrawAZ.cxx
index 3576c5d67e9..53250865848 100644
--- a/MUON/AliMUONClusterDrawAZ.cxx
+++ b/MUON/AliMUONClusterDrawAZ.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+//#include 
 #include 
 #include 
 #include 
@@ -33,15 +34,17 @@
 #include "AliMUONClusterDrawAZ.h"
 #include "AliMUONClusterFinderAZ.h"
 #include "AliMUONGeometryModuleTransformer.h"
-#include "AliMUONGeometrySegmentation.h"
 #include "AliHeader.h"
 #include "AliRun.h"
+#include "AliMUON.h"
+//#include "AliMUONChamber.h"
 #include "AliMUONDigit.h"
+#include "AliMUONHit.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONClusterInput.h"
 #include "AliMUONPixel.h"
-#include "AliMUONRecLoader.h"
-#include "AliMUONRecData.h"
+//#include "AliMC.h"
+#include "AliMUONLoader.h"
 #include "AliLog.h"
 
 ClassImp(AliMUONClusterDrawAZ)
@@ -101,9 +104,9 @@ void AliMUONClusterDrawAZ::Init()
   //Loaders
   AliRunLoader *rl = AliRunLoader::GetRunLoader();
   AliLoader *gime = rl->GetLoader("MUONLoader");
-  fData = ((AliMUONRecLoader*)gime)->GetMUONData();
+  fData = ((AliMUONLoader*)gime)->GetMUONData();
 
-  // gime->LoadHits("READ"); 
+  gime->LoadHits("READ"); 
   gime->LoadRecPoints("READ"); 
 }
 
@@ -314,9 +317,9 @@ void AliMUONClusterDrawAZ::DrawCluster()
   } // for (Int_t cath = 0;
 
   // Draw simulated and reconstructed hits 
-  // DrawHits();
+  DrawHits();
 }
-/*
+
 //_____________________________________________________________________________
 void AliMUONClusterDrawAZ::DrawHits()
 {
@@ -419,14 +422,14 @@ void AliMUONClusterDrawAZ::DrawHits()
 	  p1[0] > hist->GetXaxis()->GetXmax()) continue;
       if (p1[1] < hist->GetYaxis()->GetXmin() || 
 	  p1[1] > hist->GetYaxis()->GetXmax()) continue;
-
-	//treeD->GetEvent(cath);
-	//cout << mRaw->fMultiplicity[0] << mRaw->fMultiplicity[1] << endl;
-	//for (Int_t j=0; jfMultiplicity[cath]; j++) {
-	//Int_t digit = mRaw->fIndexMap[j][cath];
-	//cout << ((AliMUONDigit*)fMuonDigits->UncheckedAt(digit))->Signal() << endl;
-	//}
-
+      /*
+	treeD->GetEvent(cath);
+	cout << mRaw->fMultiplicity[0] << mRaw->fMultiplicity[1] << endl;
+	for (Int_t j=0; jfMultiplicity[cath]; j++) {
+	Int_t digit = mRaw->fIndexMap[j][cath];
+	cout << ((AliMUONDigit*)fMuonDigits->UncheckedAt(digit))->Signal() << endl;
+	}
+      */
       // Check if track comes thru pads with signal
       iok = 0;
       for (Int_t ihist = 0; ihist < 4; ihist++) {
@@ -453,7 +456,7 @@ void AliMUONClusterDrawAZ::DrawHits()
   if (fData->TreeR()) fData->ResetRawClusters();
   c1->Update();
 }
-*/
+
 //_____________________________________________________________________________
 Int_t AliMUONClusterDrawAZ::Next()
 {
diff --git a/MUON/AliMUONClusterDrawAZ.h b/MUON/AliMUONClusterDrawAZ.h
index 8c3f0303139..e22b7d889e1 100644
--- a/MUON/AliMUONClusterDrawAZ.h
+++ b/MUON/AliMUONClusterDrawAZ.h
@@ -14,7 +14,7 @@
 #include "AliMUONClusterDrawAZ.h"
 
 class TH2D;
-class AliMUONRecData;
+class AliMUONData;
 class AliMUONPixel;
 class AliMUONClusterFinderAZ;
 
@@ -35,7 +35,7 @@ class AliMUONClusterDrawAZ : public TObject
   void     UpdateCluster(Int_t npad); // update cluster after removing non-overlapped pads
 
 private:
-  AliMUONRecData *fData; //!<  pointer to muon data container
+  AliMUONData *fData; //!<  pointer to muon data container
   AliMUONClusterFinderAZ* fFind; //!<  pointer to ClusterFinder
   TH2D*      fHist[4]; //!<  histograms
   Int_t      fnMu; //!<  number of muons passing thru the selected area
@@ -55,7 +55,7 @@ class AliMUONClusterDrawAZ : public TObject
 
   void   Init(); // initialization
   void   ModifyHistos(); // modify histograms
-  // void   DrawHits(); // draw simulated and reconstructed hits
+  void   DrawHits(); // draw simulated and reconstructed hits
   TH2D*  GetBackground(Int_t iHist); // build histogram with bkg. contaminated pads
 
 ClassDef(AliMUONClusterDrawAZ,0) // cluster drawing for MUON arm of ALICE
diff --git a/MUON/AliMUONClusterFinderAZ.cxx b/MUON/AliMUONClusterFinderAZ.cxx
index 08205ed44e3..2d9e05a8f4b 100644
--- a/MUON/AliMUONClusterFinderAZ.cxx
+++ b/MUON/AliMUONClusterFinderAZ.cxx
@@ -33,7 +33,7 @@
 #include "AliMUONClusterDrawAZ.h"
 #include "AliMUONVGeometryDESegmentation.h"
 #include "AliMUONGeometryModuleTransformer.h"
-#include "AliMUONGeometrySegmentation.h"
+#include "AliMUON.h"
 #include "AliMUONDigit.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONClusterInput.h"
diff --git a/MUON/AliMUONClusterReconstructor.cxx b/MUON/AliMUONClusterReconstructor.cxx
index 9decfd382d7..7c610922870 100644
--- a/MUON/AliMUONClusterReconstructor.cxx
+++ b/MUON/AliMUONClusterReconstructor.cxx
@@ -28,7 +28,7 @@
 
 #include "AliMUONDigit.h"
 #include "AliMUONConstants.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONClusterFinderVS.h"
 #include "AliMUONClusterInput.h"
 #include "AliMUONRawCluster.h"
@@ -45,7 +45,7 @@ ClassImp(AliMUONClusterReconstructor) // Class implementation in ROOT context
 /// \endcond
  
 //__________________________________________________________________________
-AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONRecData* data,
+AliMUONClusterReconstructor::AliMUONClusterReconstructor(AliMUONData* data,
                                                          AliMUONVClusterFinder* clusterFinder,
                                                          const AliMUONGeometryTransformer* transformer)
 : TObject(),
diff --git a/MUON/AliMUONClusterReconstructor.h b/MUON/AliMUONClusterReconstructor.h
index 5f9670dcd12..b684a2af8fa 100644
--- a/MUON/AliMUONClusterReconstructor.h
+++ b/MUON/AliMUONClusterReconstructor.h
@@ -13,7 +13,7 @@
 #include 
 
 class AliMUONClusterFinderVS;
-class AliMUONRecData;
+class AliMUONData;
 class TClonesArray;
 class AliMUONVClusterFinder;
 class AliMUONGeometryTransformer;
@@ -21,7 +21,7 @@ class AliMUONGeometryTransformer;
 class AliMUONClusterReconstructor : public TObject 
 {
  public:
-  AliMUONClusterReconstructor(AliMUONRecData* data = 0x0,
+  AliMUONClusterReconstructor(AliMUONData* data = 0x0,
                               AliMUONVClusterFinder* finder = 0x0,
                               const AliMUONGeometryTransformer* transformer = 0x0
                               ); 
@@ -48,7 +48,7 @@ class AliMUONClusterReconstructor : public TObject
   
 private:
   AliMUONVClusterFinder* fClusterFinder; //!< the object doing the real job (not owner)  
-  AliMUONRecData*         fMUONData;           //!< Data container for MUON subsystem 
+  AliMUONData*            fMUONData;           //!< Data container for MUON subsystem 
   AliMUONClusterFinderVS* fRecModel;           //!< cluster recontruction model
 
   TClonesArray* fDigitsCath0; //!< digits for cathode 0 of the current DE
diff --git a/MUON/AliMUONData.cxx b/MUON/AliMUONData.cxx
index 0e877991a73..200920aa396 100644
--- a/MUON/AliMUONData.cxx
+++ b/MUON/AliMUONData.cxx
@@ -26,6 +26,7 @@
 #include "AliMUONData.h"
 #include "AliMUONDataIterator.h"
 #include "AliMUONConstants.h"
+#include "AliMUONHit.h"
 #include "AliMUONDigit.h"
 #include "AliMUONGlobalTrigger.h"
 #include "AliMUONLocalTrigger.h"
@@ -35,6 +36,10 @@
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONRawCluster.h"
 
+// This is from rec, classes in base should not depend on rec !!!
+#include "AliMUONTrack.h"
+#include "AliMUONTriggerTrack.h"
+
 #include "AliRunLoader.h"
 #include "AliStack.h"
 #include "AliLog.h"
@@ -54,16 +59,24 @@ ClassImp(AliMUONData)
     TNamed(),
     fRunLoader(0x0),
     fLoader(0x0),
-    fSDigits(0x0),
+    fHits(0x0),
     fDigits(0x0),
+    fSDigits(0x0),
+    fRawClusters(0x0),
     fGlobalTrigger(0x0),
     fLocalTrigger(0x0),
     fRegionalTrigger(0x0),
-    fNSdigits(0x0),
+    fRecTracks(0x0),
+    fRecTriggerTracks(0x0),
+    fNhits(0),
     fNdigits(0x0),
+    fNSdigits(0x0),
+    fNrawclusters(0x0),
     fNglobaltrigger(0),
     fNlocaltrigger(0),
     fNregionaltrigger(0),
+    fNrectracks(0),
+    fNrectriggertracks(0),
     fSplitLevel(0),
     fCurrentEvent(-1)
 {
@@ -74,16 +87,24 @@ AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title
   TNamed(name,title),
     fRunLoader(0x0),
     fLoader(loader),
-    fSDigits(0x0),
+    fHits(0x0),
     fDigits(0x0),
+    fSDigits(0x0),
+    fRawClusters(0x0),
     fGlobalTrigger(0x0),
     fLocalTrigger(0x0),
     fRegionalTrigger(0x0),
-    fNSdigits(0x0),
+    fRecTracks(0x0),
+    fRecTriggerTracks(0x0),
+    fNhits(0),
     fNdigits(0x0),
+    fNSdigits(0x0),
+    fNrawclusters(0x0),
     fNglobaltrigger(0),
     fNlocaltrigger(0),
     fNregionaltrigger(0),
+    fNrectracks(0),
+    fNrectriggertracks(0),
     fSplitLevel(0),
     fCurrentEvent(-1)
 {
@@ -91,26 +112,34 @@ AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title
 }
 
 //_____________________________________________________________________________
-AliMUONData::AliMUONData(const char* galiceFile, const char* folderName):
+AliMUONData::AliMUONData(const char* galiceFile):
   TNamed("MUON", "MUON"),
     fRunLoader(0x0),
     fLoader(0x0),
-    fSDigits(0x0),
+    fHits(0x0),
     fDigits(0x0),
+    fSDigits(0x0),
+    fRawClusters(0x0),
     fGlobalTrigger(0x0),
     fLocalTrigger(0x0),
     fRegionalTrigger(0x0),
-    fNSdigits(0x0),
+    fRecTracks(0x0),
+    fRecTriggerTracks(0x0),
+    fNhits(0),
     fNdigits(0x0),
+    fNSdigits(0x0),
+    fNrawclusters(0x0),
     fNglobaltrigger(0),
     fNlocaltrigger(0),
     fNregionaltrigger(0),
+    fNrectracks(0),
+    fNrectriggertracks(0),
     fSplitLevel(0),
     fCurrentEvent(-1)
 {
 /// Constructor for loading data from gAlice file
 
-  fRunLoader = AliRunLoader::Open(galiceFile, folderName, "READ");
+  fRunLoader = AliRunLoader::Open(galiceFile, "MUONFolder", "READ");
   if (!fRunLoader) {
     AliError(Form("Error opening %s file \n", galiceFile));
     return;
@@ -127,15 +156,22 @@ AliMUONData::AliMUONData(const char* galiceFile, const char* folderName):
 AliMUONData::~AliMUONData()
 {
 /// Destructor for AliMUONData
+  if (fHits) {
+    fHits->Delete();
+    delete fHits;
+  }
   
+  if (fDigits) {
+    fDigits->Delete();
+    delete fDigits;
+  }
   if (fSDigits) {
     fSDigits->Delete();
     delete fSDigits;
   }
-
-  if (fDigits) {
-    fDigits->Delete();
-    delete fDigits;
+  if (fRawClusters) {
+    fRawClusters->Delete();
+    delete fRawClusters;
   }
   if (fGlobalTrigger){
     fGlobalTrigger->Delete();
@@ -149,19 +185,35 @@ AliMUONData::~AliMUONData()
     fLocalTrigger->Delete();
     delete fLocalTrigger;
   }
+  if (fRecTracks){
+    fRecTracks->Delete();
+    delete fRecTracks;
+  }
+  if (fRecTriggerTracks){
+    fRecTriggerTracks->Delete();
+    delete fRecTriggerTracks;
+  }
 
   if (fRunLoader) {
     fRunLoader->UnloadAll();
     delete fRunLoader;
   }  
 }
-//_____________________________________________________________________________
-void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
+//____________________________________________________________________________
+void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t detElemId, 
+			 Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
+			 Float_t tof, Float_t momentum, Float_t theta, 
+			 Float_t phi, Float_t length, Float_t destep,
+			 Float_t Xref,Float_t Yref,Float_t Zref)
 {
-/// Add a MUON Sdigit to the list of SDigits of the detection plane id
-
-  TClonesArray &lSdigits = * SDigits(id) ; 
-  new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
+ /// Add new hit to the hit list
+
+  TClonesArray &lhits = *fHits;
+  new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId, 
+				  idpart, X, Y, Z, 
+				  tof, momentum, theta, 
+				  phi, length, destep,
+				  Xref,Yref,Zref);
 }
 //_____________________________________________________________________________
 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
@@ -171,6 +223,14 @@ void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
   TClonesArray &ldigits = * Digits(id) ; 
   new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
 }
+//_____________________________________________________________________________
+void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
+{
+/// Add a MUON Sdigit to the list of SDigits of the detection plane id
+
+  TClonesArray &lSdigits = * SDigits(id) ; 
+  new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
+}
 
 //_____________________________________________________________________________
 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
@@ -197,6 +257,40 @@ void AliMUONData::AddLocalTrigger(const  AliMUONLocalTrigger& trigger)
   new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
 }
 
+//_____________________________________________________________________________
+void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
+{
+/// Add a MUON rawcluster to the list in the detection plane id
+
+  TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
+  new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
+}
+//_____________________________________________________________________________
+void AliMUONData::AddRecTrack(const AliMUONTrack& track)
+{
+/// Add a MUON rectrack
+
+  TClonesArray &lrectracks = *fRecTracks;
+  new(lrectracks[fNrectracks++]) AliMUONTrack(track);
+}
+//_____________________________________________________________________________
+void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
+{
+/// Add a MUON triggerrectrack
+
+  TClonesArray &lrectriggertracks = *fRecTriggerTracks;  
+  new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
+}
+//____________________________________________________________________________
+TClonesArray*  AliMUONData::Digits(Int_t DetectionPlane) const
+{
+/// Getting List of Digits
+
+  if (fDigits)
+    return ( (TClonesArray*) fDigits->At(DetectionPlane) );
+  else
+    return NULL;
+}
 //____________________________________________________________________________
 TClonesArray*  AliMUONData::SDigits(Int_t DetectionPlane) const
 {
@@ -208,19 +302,27 @@ TClonesArray*  AliMUONData::SDigits(Int_t DetectionPlane) const
     return NULL;
 }
 //____________________________________________________________________________
-TClonesArray*  AliMUONData::Digits(Int_t DetectionPlane) const
+Bool_t   AliMUONData::IsRawClusterBranchesInTree()
 {
-/// Getting List of Digits
+/// Checking if there are RawCluster Branches In TreeR
 
-  if (fDigits)
-    return ( (TClonesArray*) fDigits->At(DetectionPlane) );
-  else
-    return NULL;
+  if (TreeR()==0x0) {
+    AliError("No treeR in memory");
+    return kFALSE;
+  }
+  else {
+     char branchname[30];
+     sprintf(branchname,"%sRawClusters1",GetName());
+     TBranch * branch = 0x0;
+     branch = TreeR()->GetBranch(branchname);
+     if (branch)  return kTRUE;
+     else return kFALSE;    
+  }
 }
 //____________________________________________________________________________
 Bool_t   AliMUONData::IsDigitsBranchesInTree()
 {
-/// Checking if there are Digits Branches In TreeD
+/// Checking if there are RawCluster Branches In TreeR
 
   if (TreeD()==0x0) {
     AliError("No treeD in memory");
@@ -236,9 +338,26 @@ Bool_t   AliMUONData::IsDigitsBranchesInTree()
   }
 }
 //____________________________________________________________________________
+Bool_t   AliMUONData::IsTriggerBranchesInTree()
+{
+/// Checking if there are Trigger Branches In TreeR
+ if (TreeR()==0x0) {
+    AliError("No treeR in memory");
+    return kFALSE;
+  }
+  else {
+     char branchname[30];
+     sprintf(branchname,"%sLocalTrigger",GetName());
+     TBranch * branch = 0x0;
+     branch = TreeR()->GetBranch(branchname);
+     if (branch)  return kTRUE;
+     else return kFALSE;    
+  }
+}
+//____________________________________________________________________________
 Bool_t   AliMUONData::IsTriggerBranchesInTreeD()
 {
-/// Checking if there are Trigger Branches In TreeD
+/// Checking if there are Trigger Branches In TreeR
  if (TreeD()==0x0) {
     AliError("No treeD in memory");
     return kFALSE;
@@ -253,24 +372,64 @@ Bool_t   AliMUONData::IsTriggerBranchesInTreeD()
   }
 }
 
+//____________________________________________________________________________
+Bool_t   AliMUONData::IsTrackBranchesInTree()
+{
+/// Checking if there are Track Branches In TreeT
+  if (TreeT()==0x0) {
+    AliError("No treeT in memory");
+    return kFALSE;
+  }
+  else {
+     char branchname[30];
+     sprintf(branchname,"%sTrack",GetName());
+     TBranch * branch = 0x0;
+     branch = TreeT()->GetBranch(branchname);
+     if (branch)  return kTRUE;
+     else return kFALSE;    
+  }
+}
+//____________________________________________________________________________
+Bool_t   AliMUONData::IsTriggerTrackBranchesInTree()
+{
+/// Checking if there are TriggerTrack Branches In TreeT
+  if (TreeT()==0x0) {
+    AliError("No treeT in memory");
+    return kFALSE;
+  }
+  else {
+     char branchname[30];
+     sprintf(branchname,"%sTriggerTrack",GetName());
+     TBranch * branch = 0x0;
+     branch = TreeT()->GetBranch(branchname);
+     if (branch)  return kTRUE;
+     else return kFALSE;    
+  }
+}
 //____________________________________________________________________________
 void AliMUONData::Fill(Option_t* option)
 {
 /// Method to fill the trees
-
-  const char *cS   = strstr(option,"S");   // SDigits branches in TreeS
+  const char *cH   = strstr(option,"H");
   const char *cD   = strstr(option,"D");   // Digits branches in TreeD
+  const char *cS   = strstr(option,"S");   // SDigits branches in TreeS
+  const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
   const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
+  const char *cTC = strstr(option,"TC");   // global and local Trigger branches Copy in TreeR
+  const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
+  const char *cRL = strstr(option,"RL");   // Reconstructed Trigger Track in TreeT
+
+  //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
   
   char branchname[30];
   TBranch * branch = 0x0;
 
-  // Filling TreeS
-  if ( TreeS() && cS) 
+  // Filling TreeH
+  if ( TreeH() && cH ) 
   {
-    TreeS()->Fill();
-  }
-
+    TreeH()->Fill();
+  }  
+ 
   // Filling TreeD
 
   if ( TreeD() && cD && cGLT )
@@ -318,6 +477,97 @@ void AliMUONData::Fill(Option_t* option)
       }
     }
   } // end of TreeD() handling.
+
+  // Filling TreeS
+  if ( TreeS() && cS) 
+  {
+    TreeS()->Fill();
+  }
+
+  // Filling TreeR
+  
+  if ( TreeR() && cRC && cTC )
+  {
+    TreeR()->Fill();
+  }
+  else
+  {  
+    if ( TreeR()  && cRC ) 
+    {
+      if ( IsTriggerBranchesInTree() ) 
+      {
+      // Branch per branch filling
+        for (int i=0; iGetBranch(branchname);
+          branch->Fill();
+        }
+      }
+      else  
+      {
+        TreeR()->Fill();
+      }
+    }
+    
+    if ( TreeR()  && cTC) 
+    {
+      if (IsRawClusterBranchesInTree()) 
+      {
+        // Branch per branch filling
+        sprintf(branchname,"%sLocalTrigger",GetName());
+        branch = TreeR()->GetBranch(branchname); 
+        branch->Fill();
+	sprintf(branchname,"%sRegionalTrigger",GetName());
+        branch = TreeR()->GetBranch(branchname); 
+        branch->Fill();
+        sprintf(branchname,"%sGlobalTrigger",GetName());
+        branch = TreeR()->GetBranch(branchname);
+        branch->Fill();
+      }
+      else
+      {
+        TreeR()->Fill();
+      }
+    }
+  }
+
+  // Filling TreeT
+  
+  if ( TreeT() && cRT && cRL )
+  {
+    TreeT()->Fill();
+  }
+  else
+  {
+    if ( TreeT() && cRT ) 
+    {
+      if (IsTriggerTrackBranchesInTree()) 
+      {
+        sprintf(branchname,"%sTrack",GetName());  
+        branch = TreeT()->GetBranch(branchname);
+        branch->Fill();
+      }
+      else 
+      {
+        TreeT()->Fill();
+      }
+    }
+
+    if ( TreeT() && cRL ) 
+    {
+      if (IsTrackBranchesInTree()) 
+      {
+        sprintf(branchname,"%sTriggerTrack",GetName());  
+        branch = TreeT()->GetBranch(branchname);
+        branch->Fill();
+      }    
+      else 
+      {
+        TreeT()->Fill();
+      }
+    }
+  }
 }
 
 //_____________________________________________________________________________
@@ -331,29 +581,30 @@ void AliMUONData::MakeBranch(Option_t* option)
   //Setting Data Container
   SetDataContainer(option);  
 
-  const char *cS   = strstr(option,"S");   // Digits branches in TreeS
+  const char *cH   = strstr(option,"H");
   const char *cD   = strstr(option,"D");   // Digits branches in TreeD
+  const char *cS   = strstr(option,"S");   // Digits branches in TreeS
+  const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
   const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
+  const char *cTC  = strstr(option,"TC");   // global and local Trigger branches Copy in TreeR
+  const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
+  const char *cRL  = strstr(option,"RL");  // Reconstructed Trigger Track in TreeT
+                                           //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
   
   TBranch * branch = 0x0;
   
-  //Creating Branches for SDigits
-  if (TreeS() && cS ) {
-    // one branch for Sdigits per chamber
-    for (Int_t iDetectionPlane=0; iDetectionPlaneGetBranch(branchname);
-      if (branch) {  
-        AliInfo(Form("Branch %s is already in tree.",branchname));
-        return;
-      }
-      TClonesArray * sdigits = SDigits(iDetectionPlane); 
-      branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
-      //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
+  // Creating Branches for Hits
+  if (TreeH() && cH) {
+    sprintf(branchname,"%sHits",GetName());  
+    branch = TreeH()->GetBranch(branchname);
+    if (branch) {  
+      AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname));
+      return ;
     }
-  }
-
+    branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
+    //Info("MakeBranch","Making Branch %s for hits \n",branchname);
+  }  
+  
   //Creating Branches for Digits
   TTree* treeD = 0x0;
   if ( cD || cGLT )
@@ -419,11 +670,117 @@ void AliMUONData::MakeBranch(Option_t* option)
     }
     branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize);
   }
-}
+    
+  //Creating Branches for SDigits
+  if (TreeS() && cS ) {
+    // one branch for Sdigits per chamber
+    for (Int_t iDetectionPlane=0; iDetectionPlaneGetBranch(branchname);
+      if (branch) {  
+        AliInfo(Form("Branch %s is already in tree.",branchname));
+        return;
+      }
+      TClonesArray * sdigits = SDigits(iDetectionPlane); 
+      branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
+      //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
+    }
+  }
+  
+  if (TreeR() && cRC ) {
+    //  one branch for raw clusters per tracking detection plane
+    //        
+    Int_t i; 
+    for (i=0; iGetBranch(branchname);
+      if (branch) {  
+        AliInfo(Form("Branch %s is already in tree.",branchname));
+        return;
+      }
+      branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
+      //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
+    }
+  }
+  
+  if (TreeR() && cTC ) {
+    //
+    // one branch for global trigger
+    //
+    sprintf(branchname,"%sGlobalTrigger",GetName());
+    branch = 0x0;
+    branch = TreeR()->GetBranch(branchname);
+    if (branch) {  
+      AliInfo(Form("Branch GlobalTrigger is already in treeR."));
+      return ;
+    }
+    branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
+    //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
 
+  //
+    // one branch for regional trigger
+    //  
+    sprintf(branchname,"%sRegionalTrigger",GetName());
+    branch = 0x0;
+    branch = TreeR()->GetBranch(branchname);
+    if (branch) {  
+      AliInfo(Form("Branch RegionalTrigger is already in treeR."));
+      return;
+    }
+    branch = TreeR()->Branch(branchname, &fRegionalTrigger, kBufferSize);
+     
+    //
+    // one branch for local trigger
+    //  
+    sprintf(branchname,"%sLocalTrigger",GetName());
+    branch = 0x0;
+    branch = TreeR()->GetBranch(branchname);
+    if (branch) {  
+      AliInfo(Form("Branch LocalTrigger is already in treeR."));
+      return;
+    }
+    branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
+    //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);  
+  }
+  
+  if (TreeT() && cRT ) {
+    sprintf(branchname,"%sTrack",GetName());  
+    branch = TreeT()->GetBranch(branchname);
+    if (branch) {  
+      AliInfo(Form("Branch %s is already in tree.",GetName()));
+      return ;
+    }
+    branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
+    //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
+  }  
+  // trigger tracks
+  if (TreeT() && cRL ) {
+    sprintf(branchname,"%sTriggerTrack",GetName());  
+    branch = TreeT()->GetBranch(branchname);
+    if (branch) {  
+      AliInfo(Form("Branch %s is already in tree.",GetName()));
+      return ;
+    }
+    branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
+    //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
+  }  
+}
 //____________________________________________________________________________
-TClonesArray*  
-AliMUONData::LocalTrigger() const
+TClonesArray*  AliMUONData::RawClusters(Int_t DetectionPlane)
+{
+/// Getting Raw Clusters
+
+  if (fRawClusters) 
+    return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
+  else
+    return NULL;
+}
+
+//____________________________________________________________________________
+TClonesArray*  
+AliMUONData::LocalTrigger() const
 {
 /// Getting local trigger
 
@@ -439,6 +796,18 @@ AliMUONData::RegionalTrigger() const
   return fRegionalTrigger;
 }
 
+//____________________________________________________________________________
+Int_t          
+AliMUONData::GetNtracks() const      
+{
+/// Get number of entries in hits three
+
+  Int_t ntrk = 0;
+  if (fLoader && fLoader->TreeH())
+    ntrk = (Int_t) fLoader->TreeH()->GetEntries();
+  return ntrk;
+}
+
 //____________________________________________________________________________
 void
 AliMUONData::GetDigits() const 
@@ -464,6 +833,17 @@ AliMUONData::GlobalTrigger() const
   return fGlobalTrigger;
 }
 
+//____________________________________________________________________________
+void AliMUONData::ResetDigits()
+{
+/// Reset number of digits and the digits array for this detector
+
+    if (fDigits == 0x0) return;
+    for ( int i=0;iAt(i))->Clear("C");
+      if (fNdigits)  fNdigits[i]=0;
+    }
+}
 //____________________________________________________________________________
 void AliMUONData::ResetSDigits()
 {
@@ -475,16 +855,23 @@ void AliMUONData::ResetSDigits()
       if (fNSdigits)  fNSdigits[i]=0;
     }
 }
-//____________________________________________________________________________
-void AliMUONData::ResetDigits()
+//______________________________________________________________________________
+void AliMUONData::ResetHits()
 {
-/// Reset number of digits and the digits array for this detector
+/// Reset number of clusters and the cluster array for this detector
 
-    if (fDigits == 0x0) return;
-    for ( int i=0;iAt(i))->Clear("C");
-      if (fNdigits)  fNdigits[i]=0;
-    }
+  fNhits   = 0;
+  if (fHits) fHits->Clear();
+}
+//_______________________________________________________________________________
+void AliMUONData::ResetRawClusters()
+{
+/// Reset number of raw clusters and the raw clust array for this detector
+
+  for ( int i=0;iAt(i))->Clear();
+    if (fNrawclusters)  fNrawclusters[i]=0;
+  }
 }
 //_______________________________________________________________________________
 void AliMUONData::ResetTrigger()
@@ -500,37 +887,44 @@ void AliMUONData::ResetTrigger()
 
 }
 //____________________________________________________________________________
+void AliMUONData::ResetRecTracks()
+{
+/// Reset tracks information
+
+  fNrectracks = 0;
+  if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
+}
+//____________________________________________________________________________
+void AliMUONData::ResetRecTriggerTracks()
+{
+/// Reset tracks information
+
+  fNrectriggertracks = 0;
+  if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
+}
+//____________________________________________________________________________
 void AliMUONData::SetDataContainer(Option_t* option)
 {
 /// Setting data containers of muon data
-
-  const char *cS   = strstr(option,"S");   // SDigits
+  const char *cH   = strstr(option,"H");
   const char *cD   = strstr(option,"D");   // Digits
+  const char *cS   = strstr(option,"S");   // SDigits
+  const char *cRC  = strstr(option,"RC");  // RawCluster
   const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger
-
+  const char *cTC = strstr(option,"TC");   // global and local Trigger 
+  const char *cRT  = strstr(option,"RT");  // Reconstructed Tracks
+  const char *cRL  = strstr(option,"RL");  // Reconstructed Trigger Tracks
+                                           //const char *cRP  = strstr(option,"RP");  // Reconstructed Particles  
   AliDebug(1,Form("option=%s",option));
-  
   //
-  // Container for Sdigits
-  if (cS) {
-    if (fSDigits == 0x0) { 
-      AliDebug(1,"Creating fSDigits TObjArray");
-      fSDigits = new TObjArray(AliMUONConstants::NCh());
-      fNSdigits= new Int_t[AliMUONConstants::NCh()];
-      for (Int_t i=0; iSetOwner();
-	fSDigits->AddAt(a,i);
-	AliDebug(1,Form("fSDigits[%d]=%p",i,a));
-        fNSdigits[i]=0;
-      }
+  // Clones array for hits
+  if ( cH ) {
+    if (fHits == 0x0) {
+      fHits     = new TClonesArray("AliMUONHit",1000);
     }
-    else {
-      AliDebug(1,Form("fSDigits already there = %p",fSDigits));
-    }
-    ResetSDigits();
-  }  
-
+    ResetHits();
+  }
+  
   //
   // ObjArray of ClonesArrays for Digits
   if ( cD ) {      
@@ -545,7 +939,7 @@ void AliMUONData::SetDataContainer(Option_t* option)
       }
     } 
     else {
-      AliDebug(1,Form("fDigits already there = %p",fDigits));
+      AliDebug(1,Form("fDigits already there = %p",fSDigits));
     }
     ResetDigits();
   }
@@ -564,6 +958,73 @@ void AliMUONData::SetDataContainer(Option_t* option)
     }
     ResetTrigger();
   }
+    
+  //
+  // Container for Sdigits
+  if (cS) {
+    if (fSDigits == 0x0) { 
+      AliDebug(1,"Creating fSDigits TObjArray");
+      fSDigits = new TObjArray(AliMUONConstants::NCh());
+      fNSdigits= new Int_t[AliMUONConstants::NCh()];
+      for (Int_t i=0; iSetOwner();
+	fSDigits->AddAt(a,i);
+	AliDebug(1,Form("fSDigits[%d]=%p",i,a));
+        fNSdigits[i]=0;
+      }
+    }
+    else {
+      AliDebug(1,Form("fSDigits already there = %p",fSDigits));
+    }
+    ResetSDigits();
+  }
+  
+  //
+  // Containers for rawclusters, globaltrigger and local trigger tree
+  if (cRC ) {
+    if (fRawClusters == 0x0) {
+      fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
+      fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
+      for (Int_t i=0; iSetOwner();
+        fRawClusters->AddAt(tca,i); 
+        fNrawclusters[i]=0;
+      }
+    }
+    // ResetRawClusters(); 
+    // It breaks the correct functioning of the combined reconstruction (AZ)
+    
+  }
+  if (cTC ) {
+    if (fLocalTrigger == 0x0) {
+      fLocalTrigger  = new TClonesArray("AliMUONLocalTrigger",234);
+    }
+   if (fRegionalTrigger == 0x0) {
+      fRegionalTrigger  = new TClonesArray("AliMUONRegionalTrigger",16);
+    }
+    if (fGlobalTrigger== 0x0) {
+      fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); 
+    }
+    // ResetTrigger(); 
+    // This is not necessary here since trigger info ins copied from digits info on flight to RecPoint output
+  }
+
+  //
+  // Containers for rectracks and rectrigger tracks
+  if ( cRT ) {
+    if (fRecTracks == 0x0)  {
+      fRecTracks  = new TClonesArray("AliMUONTrack",100);
+    }
+    ResetRecTracks();
+  }
+  if (cRL) {
+    if (fRecTriggerTracks == 0x0 && cRL)  {
+      fRecTriggerTracks  = new TClonesArray("AliMUONTriggerTrack",100);
+    }
+    ResetRecTriggerTracks();
+  }  
 }
 
 //____________________________________________________________________________
@@ -574,33 +1035,35 @@ void AliMUONData::SetTreeAddress(Option_t* option)
 
 /// Setting Addresses to the events trees
 
-  const char *cS   = strstr(option,"S");   // SDigits branches in TreeS
+  const char *cH   = strstr(option,"H");
   const char *cD   = strstr(option,"D");   // Digits branches in TreeD
+  const char *cS   = strstr(option,"S");   // SDigits branches in TreeS
+  const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
   const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
+  const char *cTC = strstr(option,"TC");   // global and local Trigger branches Copy in TreeR
+  const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
+  const char *cRL  = strstr(option,"RL");  // Reconstructed Trigger Track in TreeT
+                                           //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
   
   // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
   char branchname[30];
   TBranch * branch = 0x0;
   
   AliDebug(1,Form("option=%s",option));
-  
   //
-  // Branch address for Sdigit tree
-  if (TreeS() && fSDigits && cS) {
-    AliDebug(1,"Setting branch addresses");
-    for (int i=0; iGetBranch(branchname);
-        TClonesArray * sdigits = SDigits(i);
-        if (branch) branch->SetAddress( &sdigits );
-        else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
-      }
+  // Branch address for hit tree
+  if (TreeH() && fHits && cH) {
+    sprintf(branchname,"%sHits",GetName());  
+    branch = TreeH()->GetBranch(branchname);
+    if (branch) {
+      //      Info("SetTreeAddress","(%s) Setting for Hits",GetName());
+      branch->SetAddress(&fHits);
+    }
+    else { //can be invoked before branch creation
+      //AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
     }
   }
-
+  
   //
   // Branch address for digit tree
   if (TreeD() && fDigits && cD) {
@@ -634,6 +1097,69 @@ void AliMUONData::SetTreeAddress(Option_t* option)
     if (branch) branch->SetAddress(&fGlobalTrigger);
     else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
   }
+  
+  //
+  // Branch address for Sdigit tree
+  if (TreeS() && fSDigits && cS) {
+    AliDebug(1,"Setting branch addresses");
+    for (int i=0; iGetBranch(branchname);
+        TClonesArray * sdigits = SDigits(i);
+        if (branch) branch->SetAddress( &sdigits );
+        else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
+      }
+    }
+  }
+  
+  //
+  // Branch address for rawclusters, globaltrigger and local trigger tree
+  if ( TreeR()  && fRawClusters && cRC && !strstr(cRC,"RCC")) {
+    for (int i=0; iGetBranch(branchname);
+        if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
+        else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
+      }
+    }
+  }
+  if ( TreeR()  && fLocalTrigger && cTC) {
+    sprintf(branchname,"%sLocalTrigger",GetName());
+    branch = TreeR()->GetBranch(branchname);
+    if (branch) branch->SetAddress(&fLocalTrigger);
+    else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
+  }
+  if ( TreeR()  && fRegionalTrigger && cTC) {
+    sprintf(branchname,"%sRegionalTrigger",GetName());
+    branch = TreeR()->GetBranch(branchname);
+    if (branch) branch->SetAddress(&fRegionalTrigger);
+    else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeR.",GetName()));
+  }
+  if ( TreeR() && fGlobalTrigger && cTC) {
+    sprintf(branchname,"%sGlobalTrigger",GetName());
+    branch = TreeR()->GetBranch(branchname);
+    if (branch) branch->SetAddress(&fGlobalTrigger);
+    else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
+  }
+
+  // Rec Trakcs
+  if ( TreeT() && fRecTracks && cRT ) {
+    sprintf(branchname,"%sTrack",GetName());  
+    branch = TreeT()->GetBranch(branchname);
+    if (branch) branch->SetAddress(&fRecTracks);
+    else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
+  }
+  // Trigger tracks
+  if ( TreeT() && fRecTriggerTracks && cRL ) {
+    sprintf(branchname,"%sTriggerTrack",GetName());  
+    branch = TreeT()->GetBranch(branchname);
+    if (branch) branch->SetAddress(&fRecTriggerTracks);
+    else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
+  }
 }
 
 //_____________________________________________________________________________
@@ -659,7 +1185,7 @@ AliMUONData::Print(Option_t* opt) const
       }
     }
   }
-
+  
   if ( options.Contains("S") )
   {
     for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
@@ -673,17 +1199,48 @@ AliMUONData::Print(Option_t* opt) const
         digit->Print();
       }
     }
-  }  
+  }
+  
 }
 
 //_____________________________________________________________________________
 void 
-AliMUONData::DumpSDigits(Int_t event2Check, Option_t* opt)
+AliMUONData::DumpKine(Int_t event2Check)
 {
-/// Dump SDigits
+/// Dump kinematics
+
+  fRunLoader->LoadKinematics("READ");
+
+  Int_t nevents = fRunLoader->GetNumberOfEvents();
+  for (Int_t ievent=0; ieventGetEvent(ievent); 
+
+    // Stack of particle for this event
+    AliStack* stack = fRunLoader->Stack();
+
+    Int_t nparticles = (Int_t) fRunLoader->Stack()->GetNtrack();
+    printf(">>> Event %d, Number of particles is %d \n", ievent, nparticles);
+
+    for (Int_t iparticle=0; iparticleParticle(iparticle)->Print("");  
+    }
+    if (event2Check!=0) ievent=nevents;
+  }
+  fRunLoader->UnloadKinematics();
+}
+
+
+//_____________________________________________________________________________
+void 
+AliMUONData::DumpHits(Int_t event2Check, Option_t* opt)
+{
+/// Dump hits
+
+  fLoader->LoadHits("READ");
 
-  fLoader->LoadSDigits("READ");
-  
   // Event loop
   Int_t nevents = fRunLoader->GetNumberOfEvents();
   for (Int_t ievent=0; ievent>> Event %d \n",ievent);
 
     // Getting event ievent
-    fRunLoader->GetEvent(ievent);
-    SetTreeAddress("S");
-    GetSDigits();
-
-    // Loop on chambers
-    Int_t nchambers = AliMUONConstants::NCh(); ;
-    for (Int_t ichamber=0; ichamberGetEntriesFast();
-      for (Int_t idigit=0; idigit(digits->At(idigit));
-        mDigit->Print(opt);
+    fRunLoader->GetEvent(ievent); 
+    SetTreeAddress("H");
+
+    // Track loop
+    Int_t ntracks = (Int_t) GetNtracks();
+    for (Int_t itrack=0; itrackGetEntriesFast();
+      printf(">>> Track %d, Number of hits %d \n",itrack,nhits);
+      for (Int_t ihit=0; ihit(Hits()->At(ihit));
+	mHit->Print(opt);
       }
+      ResetHits();
     }
-    ResetSDigits();
     if (event2Check!=0) ievent=nevents;
   }
-  fLoader->UnloadSDigits();
+  fLoader->UnloadHits();
 }
+
 //_____________________________________________________________________________
 void 
 AliMUONData::DumpDigits(Int_t event2Check, Option_t* opt)
@@ -742,3 +1300,241 @@ AliMUONData::DumpDigits(Int_t event2Check, Option_t* opt)
   } 
   fLoader->UnloadDigits();
 }
+
+//_____________________________________________________________________________
+void 
+AliMUONData::DumpSDigits(Int_t event2Check, Option_t* opt)
+{
+/// Dump SDigits
+
+  fLoader->LoadSDigits("READ");
+  
+  // Event loop
+  Int_t nevents = fRunLoader->GetNumberOfEvents();
+  for (Int_t ievent=0; ievent>> Event %d \n",ievent);
+
+    // Getting event ievent
+    fRunLoader->GetEvent(ievent);
+    SetTreeAddress("S");
+    GetSDigits();
+
+    // Loop on chambers
+    Int_t nchambers = AliMUONConstants::NCh(); ;
+    for (Int_t ichamber=0; ichamberGetEntriesFast();
+      for (Int_t idigit=0; idigit(digits->At(idigit));
+        mDigit->Print(opt);
+      }
+    }
+    ResetSDigits();
+    if (event2Check!=0) ievent=nevents;
+  }
+  fLoader->UnloadSDigits();
+}
+
+//_____________________________________________________________________________
+void 
+AliMUONData::DumpRecPoints(Int_t event2Check, Option_t* opt) 
+{
+/// Dump rec points
+
+  fLoader->LoadRecPoints("READ");
+
+  // Event loop
+  Int_t nevents = fRunLoader->GetNumberOfEvents();
+  for (Int_t ievent=0; ievent>> Event %d \n",ievent);
+
+    // Getting event ievent
+    fRunLoader->GetEvent(ievent);
+    Int_t nchambers = AliMUONConstants::NTrackingCh();
+    SetTreeAddress("RC,TC"); 
+    GetRawClusters();
+
+    // Loop on chambers
+    for (Int_t ichamber=0; ichamber>>  branchname %s\n",branchname);
+
+      // Loop on rec points
+      Int_t nrecpoints = (Int_t) RawClusters(ichamber)->GetEntriesFast();
+      // printf(">>> Chamber %2d, Number of recpoints = %6d \n",ichamber+1, nrecpoints);
+      for (Int_t irecpoint=0; irecpoint(RawClusters(ichamber)->At(irecpoint));
+	mRecPoint->Print(opt);
+      }
+    }
+    ResetRawClusters();
+    if (event2Check!=0) ievent=nevents;
+  }
+  fLoader->UnloadRecPoints();
+}
+
+
+//_____________________________________________________________________________
+void 
+AliMUONData::DumpRecTrigger(Int_t event2Check, 
+                            Int_t write, Bool_t readFromRP)
+{
+/// Reads and dumps trigger objects from MUON.RecPoints.root
+
+  TClonesArray * globalTrigger;
+  TClonesArray * localTrigger;
+  
+  // Do NOT print out all the info if the loop runs over all events 
+  Int_t printout = (event2Check == 0 ) ? 0 : 1 ;  
+
+  // Book a ntuple for more detailled studies
+  TNtuple *tupleGlo = new TNtuple("TgtupleGlo","Global Trigger Ntuple","ev:global:slpt:shpt:uplpt:uphpt:lplpt:lplpt");
+  TNtuple *tupleLoc = new TNtuple("TgtupleLoc","Local Trigger Ntuple","ev:LoCircuit:LoStripX:LoDev:StripY:LoLpt:LoHpt:y11:y21:x11");
+
+  // counters
+  Int_t sLowpt=0,sHighpt=0;
+  Int_t uSLowpt=0,uSHighpt=0;
+  Int_t lSLowpt=0,lSHighpt=0;
+
+  AliMUONTriggerCrateStore* crateManager = new AliMUONTriggerCrateStore();   
+  crateManager->ReadFromFile();
+
+  AliMUONGeometryTransformer* transformer = new AliMUONGeometryTransformer(kFALSE);
+  transformer->ReadGeometryData("volpath.dat", "geometry.root");
+
+  TClonesArray*  triggerCircuit = new TClonesArray("AliMUONTriggerCircuit", 234);
+
+  for (Int_t i = 0; i < AliMUONConstants::NTriggerCircuit(); i++)  {
+      AliMUONTriggerCircuit* c = new AliMUONTriggerCircuit();
+      c->SetTransformer(transformer);
+      c->Init(i,*crateManager);
+      TClonesArray& circuit = *triggerCircuit;
+      new(circuit[circuit.GetEntriesFast()])AliMUONTriggerCircuit(*c);
+      delete c;
+  }
+  
+  Char_t fileName[30];
+  if (!readFromRP) {
+      AliInfoStream() << " reading from digits \n";
+      fLoader->LoadDigits("READ");
+      sprintf(fileName,"TriggerCheckFromDigits.root");
+  } else {
+      AliInfoStream() << " reading from RecPoints \n";
+      fLoader->LoadRecPoints("READ");
+      sprintf(fileName,"TriggerCheckFromRP.root");
+  }
+
+  
+  AliMUONGlobalTrigger *gloTrg(0x0);
+  AliMUONLocalTrigger *locTrg(0x0);
+
+  Int_t nevents = fRunLoader->GetNumberOfEvents();
+  for (Int_t ievent=0; ieventGetEvent(ievent);
+    
+    if (!readFromRP) {
+	SetTreeAddress("D,GLT"); 
+	GetTriggerD();
+    } else {    
+	SetTreeAddress("RC,TC"); 
+	GetTrigger();
+    }
+
+    globalTrigger = GlobalTrigger();
+    localTrigger = LocalTrigger();
+    
+    Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1
+    Int_t nlocals  = (Int_t) localTrigger->GetEntriesFast(); // up to 234
+    if (printout) printf("###################################################\n");
+    if (printout) printf("event %d nglobal %d nlocal %d \n",ievent,nglobals,nlocals);
+
+    for (Int_t iglobal=0; iglobal(globalTrigger->At(iglobal));
+      
+      sLowpt+=gloTrg->SingleLpt() ;
+      sHighpt+=gloTrg->SingleHpt() ;
+      uSLowpt+=gloTrg->PairUnlikeLpt(); 
+      uSHighpt+=gloTrg->PairUnlikeHpt();
+      lSLowpt+=gloTrg->PairLikeLpt(); 
+      lSHighpt+=gloTrg->PairLikeHpt();
+      
+      if (printout) gloTrg->Print("full");
+
+    } // end of loop on Global Trigger
+
+    for (Int_t ilocal=0; ilocal(localTrigger->At(ilocal));
+
+      Bool_t xTrig=kFALSE;
+      Bool_t yTrig=kFALSE;
+
+      if ( locTrg->LoSdev()==1 && locTrg->LoDev()==0 && 
+	   locTrg->LoStripX()==0) xTrig=kFALSE; // no trigger in X
+      else xTrig=kTRUE;                         // trigger in X
+      if (locTrg->LoTrigY()==1 && 
+	  locTrg->LoStripY()==15 ) yTrig = kFALSE; // no trigger in Y
+      else yTrig = kTRUE;                          // trigger in Y
+
+      if (xTrig && yTrig) { // make Trigger Track if trigger in X and Y
+	  
+	  if (printout) locTrg->Print("full");
+	  
+	  AliMUONTriggerCircuit* circuit = (AliMUONTriggerCircuit*)triggerCircuit->At(locTrg->LoCircuit()-1); 
+	  
+	  tupleLoc->Fill(ievent,locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoDev(),locTrg->LoStripY(),locTrg->LoLpt(),locTrg->LoHpt(),circuit->GetY11Pos(locTrg->LoStripX()),circuit->GetY21Pos(locTrg->LoStripX()+locTrg->LoDev()+1),circuit->GetX11Pos(locTrg->LoStripY()));
+      }
+      
+    } // end of loop on Local Trigger
+    
+    // fill ntuple
+    tupleGlo->Fill(ievent,nglobals,gloTrg->SingleLpt(),gloTrg->SingleHpt(),gloTrg->PairUnlikeLpt(),gloTrg->PairUnlikeHpt(),gloTrg->PairLikeLpt(),gloTrg->PairLikeHpt());
+    
+    ResetTrigger();
+    if (event2Check!=0) ievent=nevents;
+  } // end loop on event  
+  
+  // Print out summary if loop ran over all event
+  if (!event2Check){
+
+    printf("\n");
+    printf("=============================================\n");
+    printf("================  SUMMARY  ==================\n");
+    printf("\n");
+    printf("Total number of events processed %d \n", (event2Check==0) ? nevents : 1);
+    printf("\n");
+    printf(" Global Trigger output       Low pt  High pt\n");
+    printf(" number of Single           :\t");
+    printf("%i\t%i\t",sLowpt,sHighpt);
+    printf("\n");
+    printf(" number of UnlikeSign pair  :\t"); 
+    printf("%i\t%i\t",uSLowpt,uSHighpt);
+    printf("\n");
+    printf(" number of LikeSign pair    :\t");  
+    printf("%i\t%i\t",lSLowpt,lSHighpt);
+    printf("\n");
+    printf("=============================================\n");
+    fflush(stdout);
+  }
+  
+  if (write){
+      TFile *myFile = new TFile(fileName, "RECREATE");
+      tupleGlo->Write();
+      tupleLoc->Write();
+      myFile->Close();
+  }
+
+  fLoader->UnloadRecPoints();
+
+  delete crateManager;
+  delete transformer;
+  delete triggerCircuit;
+  
+}
diff --git a/MUON/AliMUONData.h b/MUON/AliMUONData.h
index baff514cfa3..fa7959eb581 100644
--- a/MUON/AliMUONData.h
+++ b/MUON/AliMUONData.h
@@ -18,7 +18,12 @@
 
 #include "AliLoader.h"
 
+class AliMUONConstants;
+class AliMUONRawCluster;
+class AliMUONTrack;
+class AliMUONTriggerTrack;
 class AliMUONDigit;
+class AliMUONHit;
 class AliMUONLocalTrigger;
 class AliMUONRegionalTrigger;
 class AliMUONGlobalTrigger;
@@ -26,8 +31,11 @@ class AliMUONGlobalTrigger;
 class AliRunLoader;
 
 class TClonesArray;
+class TNamed;
 class TObjArray;
 class TTree;
+class TIterator;
+class TArrayI;
 
 
 //__________________________________________________________________
@@ -45,11 +53,15 @@ class AliMUONData : public TNamed
   
     AliMUONData();
     AliMUONData(AliLoader * loader, const char* name, const char* title);
-    AliMUONData(const char* galiceFile, const char* folderName);
+    AliMUONData(const char* galiceFile);
     virtual ~AliMUONData();  
-    virtual void   AddSDigit(Int_t id, const AliMUONDigit& digit); // use copy constructor
     virtual void   AddDigit(Int_t id, const AliMUONDigit& digit); // use copy constructor
-
+    virtual void   AddSDigit(Int_t id, const AliMUONDigit& digit); // use copy constructor
+    virtual void   AddHit(Int_t fIshunt, Int_t track, Int_t detElemId, 
+			  Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
+			  Float_t tof, Float_t momentum, Float_t theta, 
+			  Float_t phi, Float_t length, Float_t destep, 
+			  Float_t Xref,Float_t Yref,Float_t Zref);
     
     virtual void   AddGlobalTrigger(const AliMUONGlobalTrigger& trigger); // use copy constructor
 
@@ -57,25 +69,42 @@ class AliMUONData : public TNamed
  
     virtual void   AddRegionalTrigger(const AliMUONRegionalTrigger& trigger); // use copy constructor
 
+    virtual void   AddRawCluster(Int_t id, const AliMUONRawCluster& clust);
+    virtual void   AddRecTrack(const AliMUONTrack& track);
+    virtual void   AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack);
 
-    TClonesArray*  SDigits(Int_t DetectionPlane) const;
+    TClonesArray*  Hits() {return fHits;} ///< Return hits
     TClonesArray*  Digits(Int_t DetectionPlane) const;
+    TClonesArray*  SDigits(Int_t DetectionPlane) const;
     TClonesArray*  LocalTrigger() const;
     TClonesArray*  RegionalTrigger() const;
     TClonesArray*  GlobalTrigger() const;    
+    TClonesArray*  RawClusters(Int_t DetectionPlane);
+    
+                    /// Return reconstructed tracks
+    TClonesArray*  RecTracks() {return fRecTracks;} 
+                   /// Return reconstructed trigger tracks
+    TClonesArray*  RecTriggerTracks() {return fRecTriggerTracks;}
 
-    void           GetSDigits() const;
+    void           GetTrack(Int_t it) const;
+    Int_t          GetNtracks() const;
     void           GetDigits() const;
+    void           GetSDigits() const;
+    void           GetRawClusters() const;
+    void           GetTrigger() const;
     void           GetTriggerD() const;
+    void           GetRecTracks() const;
+    void           GetRecTriggerTracks() const;
 
                    /// Return split level
     Int_t          GetSplitLevel() const {return fSplitLevel;}
 
-                   /// Set split level
-    void           SetSplitLevel(Int_t SplitLevel) {fSplitLevel=SplitLevel;}
-
+    Bool_t        IsRawClusterBranchesInTree();
     Bool_t        IsDigitsBranchesInTree();
+    Bool_t        IsTriggerBranchesInTree();
     Bool_t        IsTriggerBranchesInTreeD();
+    Bool_t        IsTrackBranchesInTree();
+    Bool_t        IsTriggerTrackBranchesInTree();
 
                        /// Get loader
     virtual AliLoader* GetLoader() const { return fLoader; }
@@ -87,20 +116,39 @@ class AliMUONData : public TNamed
     virtual void   SetDataContainer(Option_t *opt=" ");
     virtual void   SetTreeAddress(Option_t *opt=" ");
     
+                   /// Set split level
+    void           SetSplitLevel(Int_t SplitLevel) {fSplitLevel=SplitLevel;}
+    
     virtual void Print(Option_t* opt="") const;
     
-    virtual void   ResetSDigits();
+    virtual void   ResetHits();
     virtual void   ResetDigits();
+    virtual void   ResetSDigits();
     virtual void   ResetTrigger();
+    virtual void   ResetRawClusters();
+    virtual void   ResetRecTracks();
+    virtual void   ResetRecTriggerTracks();
   
-                   /// Return tree with summable digits
-    TTree*         TreeS() {return fLoader->TreeS(); }
+                   /// Return tree with hits
+    TTree*         TreeH() {return fLoader->TreeH(); }
                    /// Return tree with digits
     TTree*         TreeD() {return fLoader->TreeD(); }
+                   /// Return tree with summable digits
+    TTree*         TreeS() {return fLoader->TreeS(); }
+                   /// Return tree with raw clusters
+    TTree*         TreeR() {return fLoader->TreeR(); }
+                   /// Return tree with tracks
+    TTree*         TreeT() {return fLoader->TreeT(); }
+                   /// Return tree with particles
+    TTree*         TreeP() {return fLoader->TreeP(); }
 
                    // Methods to dump data
-    void DumpSDigits(Int_t event2Check=0, Option_t* opt="tracks");
+    void DumpKine(Int_t event2Check=0);
+    void DumpHits(Int_t event2Check=0, Option_t* opt="full");
     void DumpDigits(Int_t event2Check=0, Option_t* opt="tracks");
+    void DumpSDigits(Int_t event2Check=0, Option_t* opt="tracks");
+    void DumpRecPoints(Int_t event2Check=0, Option_t* opt="full");
+    void DumpRecTrigger(Int_t event2Check=0, Int_t write = 0, Bool_t readFromRP = kTRUE);
     
   protected: 
     /// Not implemented
@@ -110,42 +158,81 @@ class AliMUONData : public TNamed
 
     AliRunLoader*   fRunLoader; //!< Run loader pointer
     AliLoader*      fLoader;  //!< Detector Loader pointer
-
-    TObjArray*      fSDigits; ///< One event in treeS and one branch per detection plane
+    TClonesArray*   fHits;    ///< One event in treeH per primary track
     TObjArray*      fDigits;  ///< One event in treeD and one branch per detection plane
+    TObjArray*      fSDigits; ///< One event in treeS and one branch per detection plane
+    TObjArray*      fRawClusters; ///< One event in TreeR/Rawcluster and one branch per tracking detection plane
     TClonesArray*   fGlobalTrigger; ///< List of Global Trigger One event in TreeR/GlobalTriggerBranch
     TClonesArray*   fLocalTrigger;  ///< List of Local Trigger, One event in TreeR/LocalTriggerBranch
     TClonesArray*   fRegionalTrigger;  ///< List of Regional Trigger, One event in TreeR/LocalTriggerBranch
 
-    Int_t*          fNSdigits;//!< Number of Digits
+    TClonesArray*   fRecTracks; ///< pointer to array of reconstructed tracks
+    TClonesArray*   fRecTriggerTracks; ///< pointer to array of reconstructed trigger tracks
+
+    Int_t           fNhits;   //!< Number of Hits
     Int_t*          fNdigits; //!< Number of Digits
+    Int_t*          fNSdigits;//!< Number of Digits
+    Int_t*          fNrawclusters;  //!< Number of Raw Clusters
     Int_t           fNglobaltrigger;//!< Number of Global trigger
     Int_t           fNlocaltrigger; //!< Number of Local trigger
     Int_t           fNregionaltrigger; //!< Number of regional trigger
+    Int_t           fNrectracks;    //!< Number of reconstructed tracks
+    Int_t           fNrectriggertracks; //!< Number of reconstructed tracks
     Int_t           fSplitLevel;   ///< Splitting of branches 0 no spitting (root files are smaller) 1 splitting (larger output files)
 
     mutable Int_t fCurrentEvent; ///< Current event we're dealing with
     
 private:  
 
-  ClassDef(AliMUONData,4) // Data accessor for MUON module
+  ClassDef(AliMUONData,3) // Data accessor for MUON module
       
 };
 // inline functions
 
 
+/// Load hits for \a i th entry in hits three
+inline void AliMUONData::GetTrack(Int_t it) const  {
+  if (fLoader && fLoader->TreeH())
+    fLoader->TreeH()->GetEvent(it);
+}
+
 /// Load sdigits tree
 inline void AliMUONData::GetSDigits() const {
   if (fLoader && fLoader->TreeS())
     fLoader->TreeS()->GetEvent(0);
 }
 
+/// Load raw clusters tree
+inline void AliMUONData::GetRawClusters() const {
+  if (fLoader && fLoader->TreeR())
+    fLoader->TreeR()->GetEvent(0);
+}
+
+/// Load trigger tree
+inline void AliMUONData::GetTrigger() const {
+  if (fLoader && fLoader->TreeR())
+    fLoader->TreeR()->GetEvent(0);
+}
+
 /// Load trigger D tree
 inline void AliMUONData::GetTriggerD() const {
   if (fLoader && fLoader->TreeD())
     fLoader->TreeD()->GetEvent(0);
 }
 
+/// Return reconstructed tracks
+inline void AliMUONData::GetRecTracks() const {
+  if (fLoader && fLoader->TreeT())
+    fLoader->TreeT()->GetBranch("MUONTrack")->GetEvent(0);
+}
+
+/// Return reconstructed trigger tracks
+inline void AliMUONData::GetRecTriggerTracks() const {
+  if (fLoader && fLoader->TreeT())
+    fLoader->TreeT()->GetBranch("MUONTriggerTrack")->GetEvent(0);
+}
+
+
 
 #endif
 
diff --git a/MUON/AliMUONDataInterface.cxx b/MUON/AliMUONDataInterface.cxx
index e0a2873e654..b132191e1ad 100644
--- a/MUON/AliMUONDataInterface.cxx
+++ b/MUON/AliMUONDataInterface.cxx
@@ -70,7 +70,6 @@ ClassImp(AliMUONDataInterface)
 AliMUONDataInterface::AliMUONDataInterface()
 	: TObject(), 
 	  fCreatedRunLoader(kFALSE),
-	  fCreatedRunLoaderSim(kFALSE),
 	  fHitAddressSet(kFALSE),
 	  fSDigitAddressSet(kFALSE),
 	  fDigitAddressSet(kFALSE),
@@ -78,14 +77,10 @@ AliMUONDataInterface::AliMUONDataInterface()
 	  fTriggerAddressSet(kFALSE),
 	  fRecTracksAddressSet(kFALSE),
 	  fRunloader(0x0),
-	  fRunloaderSim(0x0),
-	  fRecLoader(0x0),
-	  fSimLoader(0x0),
-	  fRecData(0x0, "MUON", "MUON"),
-	  fSimData(0x0, "MUON", "MUON"),
+	  fMuonloader(0x0),
+	  fData(0x0, "MUON", "MUON"),
 	  fFilename(),
-	  fFoldername("MUONLoader"),
-	  fFoldernameSim("MUONLoaderSim"),
+	  fFoldername(),
 	  fEventnumber(-1),
 	  fTrack(-1),
 	  fSCathode(-1),
@@ -104,9 +99,6 @@ AliMUONDataInterface::~AliMUONDataInterface()
 
 	if (fRunloader != NULL && fCreatedRunLoader)
 		delete fRunloader;
-
-	if (fRunloaderSim != NULL && fCreatedRunLoaderSim)
-		delete fRunloaderSim;
 }
 
 void AliMUONDataInterface::Reset()
@@ -116,11 +108,8 @@ void AliMUONDataInterface::Reset()
 /// Specificaly AliRunLoader is not deleted.
 
 	fCreatedRunLoader = kFALSE;
-	fCreatedRunLoaderSim = kFALSE;
 	fRunloader = NULL;
-	fRunloaderSim = NULL;
-	fRecLoader = NULL;
-	fSimLoader = NULL;
+	fMuonloader = NULL;
 	fEventnumber = -1;
 	fTrack = -1;
 	fSCathode = -1;
@@ -144,10 +133,10 @@ Bool_t AliMUONDataInterface::UseCurrentRunLoader()
 	if (fRunloader == NULL) return kFALSE;
 	// Fetch the current file name, folder name and event number.
 	fFilename = fRunloader->GetFileName();
-        // fFoldername = fRunloader->GetEventFolder()->GetName();
+	fFoldername = fRunloader->GetEventFolder()->GetName();
 	fEventnumber = fRunloader->GetEventNumber();
 
-	if ( ! FetchMuonLoader(fFilename.Data()) )
+	if ( ! FetchMuonLoader(fFilename.Data(), fFoldername.Data()) )
 	{
 		Reset();
 		return kFALSE;
@@ -157,75 +146,52 @@ Bool_t AliMUONDataInterface::UseCurrentRunLoader()
 }
 
 
-Bool_t AliMUONDataInterface::FetchMuonLoader(TString filename)
+Bool_t AliMUONDataInterface::FetchMuonLoader(TString filename, TString foldername)
 {
 /// Fetches the muon loader for the given filename/foldername
 
-
-	fRecLoader = fRunloader->GetLoader("MUONLoader");
-	if (fRecLoader == NULL)
-	{
-		AliError(Form("Could not find the MUON loader in file: %s and folder: %s", 
-			(const char*)filename, fFoldername.Data() ));
-		return kFALSE;
-	}
-	
-	// Need to connect the muon loader to the AliMUONData object,
-	// else class to fRecData will return NULL.
-	fRecData.SetLoader(fRecLoader);
-
-	fSimLoader = fRunloaderSim->GetLoader("MUONLoader");
-	if (fSimLoader == NULL)
+	fMuonloader = fRunloader->GetLoader("MUONLoader");
+	if (fMuonloader == NULL)
 	{
 		AliError(Form("Could not find the MUON loader in file: %s and folder: %s", 
-			(const char*)filename, fFoldernameSim.Data()));
+			(const char*)filename, (const char*)foldername));
 		return kFALSE;
 	}
 	
 	// Need to connect the muon loader to the AliMUONData object,
-	// else class to fSimData will return NULL.
-	fSimData.SetLoader(fSimLoader);
+	// else class to fData will return NULL.
+	fData.SetLoader(fMuonloader);
 	return kTRUE;
 }
 
 
-Bool_t AliMUONDataInterface::LoadLoaders(TString filename)
+Bool_t AliMUONDataInterface::LoadLoaders(TString filename, TString foldername)
 {
 /// Load the run and muon loaders from the specified file and folder.
 /// kTRUE is returned on success and kFALSE on failure.
 
-	fRunloader = AliRunLoader::Open(filename, "MUONFolder", "READ");
+	fRunloader = AliRunLoader::Open(filename, foldername, "READ");
 	if (fRunloader == NULL)
 	{
-		AliError(Form("Could not find or load the run loader for the file: %s and folder: MUONFolder", 
-			(const char*)filename));
+		AliError(Form("Could not find or load the run loader for the file: %s and folder: %s", 
+			(const char*)filename, (const char*)foldername));
 		return kFALSE;
 	}
 	fCreatedRunLoader = kTRUE;
-
-	fRunloaderSim = AliRunLoader::Open(filename, "MUONFolderSim", "READ");
-	if (fRunloaderSim == NULL)
-	{
-		AliError(Form("Could not find or load the run loader for the file: %s and folder: MUONFolderSim", 
-			(const char*)filename));
-		return kFALSE;
-	}
-	fCreatedRunLoaderSim = kTRUE;
-
-	if ( ! FetchMuonLoader(filename) )
+	if ( ! FetchMuonLoader(filename, foldername) )
 	{
 		fRunloader = NULL;
-		fRunloaderSim = NULL;
 		return kFALSE;
 	}
 	
 	fFilename = filename;
+	fFoldername = foldername;
 	fEventnumber = -1;  // Reset the event number to force the event to be loaded.
 	return kTRUE;
 }
 
 
-Bool_t AliMUONDataInterface::FetchLoaders(TString filename)
+Bool_t AliMUONDataInterface::FetchLoaders(TString filename, TString foldername)
 {
 /// Fetch the run loader and muon loader objects from memory if they already exist,
 /// or from memory if they do not. 
@@ -237,12 +203,12 @@ Bool_t AliMUONDataInterface::FetchLoaders(TString filename)
 	{
 		fRunloader = AliRunLoader::GetRunLoader();
 		if (fRunloader == NULL)
-			return LoadLoaders(filename);
+			return LoadLoaders(filename, foldername);
 		else
 		{
-			if (fRecLoader == NULL)
+			if (fMuonloader == NULL)
 			{
-				if ( ! FetchMuonLoader(filename) )
+				if ( ! FetchMuonLoader(filename, foldername) )
 				{
 					fRunloader = NULL;
 					return kFALSE;
@@ -252,15 +218,15 @@ Bool_t AliMUONDataInterface::FetchLoaders(TString filename)
 		
 		// Fetch the current file and folder names.
 		fFilename = fRunloader->GetFileName();
-		// fFoldername = fRunloader->GetEventFolder()->GetName();
+		fFoldername = fRunloader->GetEventFolder()->GetName();
 	}
 
 	// If filename or foldername are not the same as the ones currently selected then
 	// reopen the file.
-	if ( filename.CompareTo(fFilename) != 0 )
+	if ( filename.CompareTo(fFilename) != 0 || foldername.CompareTo(fFoldername) != 0 )
 	{
 		delete fRunloader;
-		return LoadLoaders(filename);
+		return LoadLoaders(filename, foldername);
 	}
 	return kTRUE;
 }
@@ -308,10 +274,10 @@ Bool_t AliMUONDataInterface::FetchTreeK()
 {
 /// Fetch the Kine tree from the current run loader.
 
-	if (fRunloaderSim->TreeK() == NULL)
+	if (fRunloader->TreeK() == NULL)
 	{
-		fRunloaderSim->LoadKinematics("READ");
-		if (fRunloaderSim->TreeK() == NULL)
+		fRunloader->LoadKinematics("READ");
+		if (fRunloader->TreeK() == NULL)
 		{
 			AliError("Could not load TreeK.");
 			return kFALSE;
@@ -326,20 +292,20 @@ Bool_t AliMUONDataInterface::FetchTreeH()
 /// Fetch the Hits tree from the current muon loader.
 /// Set all the required addresses etc...
 
-	if (fSimLoader->TreeH() == NULL)
+	if (fMuonloader->TreeH() == NULL)
 	{
-		fSimLoader->LoadHits("READ");
-		if (fSimLoader->TreeH() == NULL)
+		fMuonloader->LoadHits("READ");
+		if (fMuonloader->TreeH() == NULL)
 		{
 			AliError("Could not load TreeH.");
 			return kFALSE;
 		}
-		fSimData.SetTreeAddress("H");
+		fData.SetTreeAddress("H");
 		fHitAddressSet = kTRUE;
 	}
 	else if ( ! fHitAddressSet )
 	{
-		fSimData.SetTreeAddress("H");
+		fData.SetTreeAddress("H");
 		fHitAddressSet = kTRUE;
 	}
 	return kTRUE;
@@ -351,20 +317,20 @@ Bool_t AliMUONDataInterface::FetchTreeS()
 /// Fetch the S-Digits tree from the current muon loader.
 /// Set all the required addresses etc...
 
-	if (fSimLoader->TreeS() == NULL)
+	if (fMuonloader->TreeS() == NULL)
 	{
-		fSimLoader->LoadSDigits("READ");
-		if (fSimLoader->TreeS() == NULL)
+		fMuonloader->LoadSDigits("READ");
+		if (fMuonloader->TreeS() == NULL)
 		{
 			AliError("Could not load TreeS.");
 			return kFALSE;
 		}
-		fSimData.SetTreeAddress("S");
+		fData.SetTreeAddress("S");
 		fSDigitAddressSet = kTRUE;
 	}
 	else if ( ! fSDigitAddressSet )
 	{
-		fSimData.SetTreeAddress("S");
+		fData.SetTreeAddress("S");
 		fSDigitAddressSet = kTRUE;
 	}
 	return kTRUE;
@@ -376,20 +342,20 @@ Bool_t AliMUONDataInterface::FetchTreeD()
 /// Fetch the digits tree from the current muon loader.
 /// Set all the required addresses etc...
 
-	if (fSimLoader->TreeD() == NULL)
+	if (fMuonloader->TreeD() == NULL)
 	{
-		fSimLoader->LoadDigits("READ");
-		if (fSimLoader->TreeD() == NULL)
+		fMuonloader->LoadDigits("READ");
+		if (fMuonloader->TreeD() == NULL)
 		{
 			AliError("Could not load TreeD.");
 			return kFALSE;
 		}
-		fSimData.SetTreeAddress("D");
+		fData.SetTreeAddress("D");
 		fDigitAddressSet = kTRUE;
 	}
 	else if ( ! fDigitAddressSet )
 	{
-		fSimData.SetTreeAddress("D");
+		fData.SetTreeAddress("D");
 		fDigitAddressSet = kTRUE;
 	}
 	return kTRUE;
@@ -401,10 +367,10 @@ Bool_t AliMUONDataInterface::FetchTreeR()
 /// Fetch the reconstructed objects tree from the current muon loader.
 /// Note: The addresses must still be set. 
   
-  if (fRecLoader->TreeR() == NULL)
+  if (fMuonloader->TreeR() == NULL)
     {
-      fRecLoader->LoadRecPoints("READ");
-      if (fRecLoader->TreeR() == NULL)
+      fMuonloader->LoadRecPoints("READ");
+      if (fMuonloader->TreeR() == NULL)
 	{
 	  AliError("Could not load TreeR.");
 	  return kFALSE;
@@ -422,10 +388,10 @@ Bool_t AliMUONDataInterface::FetchTreeT()
 {
 /// fetch the reconstructed tracks tree from the current muon loader
 /// note : the addresses must still be set.
-  if (fRecLoader->TreeT() == NULL)
+  if (fMuonloader->TreeT() == NULL)
     {
-      fRecLoader->LoadTracks("READ");
-      if (fRecLoader->TreeT() == NULL)
+      fMuonloader->LoadTracks("READ");
+      if (fMuonloader->TreeT() == NULL)
 	{
 	  AliError("Could not load TreeT.");
 	  return kFALSE;
@@ -442,7 +408,7 @@ Int_t AliMUONDataInterface::NumberOfEvents(TString filename, TString foldername)
 {
 /// Returns the number of events in the specified file/folder, and -1 on error.
 
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	return fRunloader->GetNumberOfEvents();
 }
 
@@ -451,7 +417,7 @@ Int_t AliMUONDataInterface::NumberOfParticles(TString filename, TString folderna
 {
 /// Returns the number of events in the specified file/folder, and -1 on error.
 
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	if ( ! FetchEvent(event) ) return -1;
 	if ( ! FetchTreeK() ) return -1;
 	return (Int_t) fRunloader->TreeK()->GetEntriesFast();
@@ -465,7 +431,7 @@ TParticle* AliMUONDataInterface::Particle(
 /// Returns the specified particle in the given file, folder and event.
 /// NULL is returned on error.
 
-	if ( ! FetchLoaders(filename) ) return NULL;
+	if ( ! FetchLoaders(filename, foldername) ) return NULL;
 	if ( ! FetchEvent(event) ) return NULL;
 	if ( ! FetchTreeK() ) return NULL;
 	
@@ -482,10 +448,10 @@ Int_t AliMUONDataInterface::NumberOfTracks(TString filename, TString foldername,
 /// Returns the number of tracks in the specified file/folder and event.
 /// -1 is returned on error.
 
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	if ( ! FetchEvent(event) ) return -1;
 	if ( ! FetchTreeH() ) return -1;
-	return fSimData.GetNtracks();
+	return fData.GetNtracks();
 }
 
 
@@ -496,17 +462,17 @@ Int_t AliMUONDataInterface::NumberOfHits(
 /// Returns the number of hits in the specified file/folder, event and track.
 /// -1 is returned on error.
 
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	if ( ! FetchEvent(event) ) return -1;
 	if ( ! FetchTreeH() ) return -1;
 
 	if (fTrack < 0 || fTrack != track)
 	{
-		fSimData.ResetHits();
-		fSimData.GetTrack(track);
+		fData.ResetHits();
+		fData.GetTrack(track);
 		fTrack = track;
 	}
-	return fSimData.Hits()->GetEntriesFast();
+	return fData.Hits()->GetEntriesFast();
 }
 
 
@@ -518,17 +484,17 @@ AliMUONHit* AliMUONDataInterface::Hit(
 /// Returns the specified hit in the given file, folder, event and track.
 /// NULL is returned on error.
 
-	if ( ! FetchLoaders(filename) ) return NULL;
+	if ( ! FetchLoaders(filename, foldername) ) return NULL;
 	if ( ! FetchEvent(event) ) return NULL;
 	if ( ! FetchTreeH() ) return NULL;
 
 	if (fTrack < 0 || fTrack != track)
 	{
-		fSimData.ResetHits();
-		fSimData.GetTrack(track);
+		fData.ResetHits();
+		fData.GetTrack(track);
 		fTrack = track;
 	}
-	return static_cast( fSimData.Hits()->At(hit) );
+	return static_cast( fData.Hits()->At(hit) );
 }
 
 
@@ -543,17 +509,17 @@ Int_t AliMUONDataInterface::NumberOfSDigits(
 	assert( 0 <= chamber && chamber <= 13 );
 	assert( 0 <= cathode && cathode <= 1 );
 	
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	if ( ! FetchEvent(event) ) return -1;
 	if ( ! FetchTreeS() ) return -1;
 
 	if ( fSCathode != cathode )
 	{
-		fSimData.ResetSDigits();
-		fSimData.GetSDigits();
+		fData.ResetSDigits();
+		fData.GetSDigits();
 		fSCathode = cathode;
 	}
-	return fSimData.SDigits(chamber)->GetEntriesFast();
+	return fData.SDigits(chamber)->GetEntriesFast();
 }
 
 
@@ -568,17 +534,17 @@ AliMUONDigit* AliMUONDataInterface::SDigit(
 	assert( 0 <= chamber && chamber <= 13 );
 	assert( 0 <= cathode && cathode <= 1 );
 	
-	if ( ! FetchLoaders(filename) ) return NULL;
+	if ( ! FetchLoaders(filename, foldername) ) return NULL;
 	if ( ! FetchEvent(event) ) return NULL;
 	if ( ! FetchTreeS() ) return NULL;
 
 	if ( fSCathode != cathode )
 	{
-		fSimData.ResetSDigits();
-		fSimData.GetSDigits();
+		fData.ResetSDigits();
+		fData.GetSDigits();
 		fSCathode = cathode;
 	}
-	return static_cast( fSimData.SDigits(chamber)->At(sdigit) );
+	return static_cast( fData.SDigits(chamber)->At(sdigit) );
 }
 
 
@@ -592,17 +558,17 @@ Int_t AliMUONDataInterface::NumberOfDigits(
 	assert( 0 <= chamber && chamber <= 13 );
 	assert( 0 <= cathode && cathode <= 1 );
 	
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	if ( ! FetchEvent(event) ) return -1;
 	if ( ! FetchTreeD() ) return -1;
 
 	if ( fCathode != cathode )
 	{
-		fSimData.ResetDigits();
-		fSimData.GetDigits();
+		fData.ResetDigits();
+		fData.GetDigits();
 		fCathode = cathode;
 	}
-	return fSimData.Digits(chamber)->GetEntriesFast();
+	return fData.Digits(chamber)->GetEntriesFast();
 }
 
 
@@ -617,17 +583,17 @@ AliMUONDigit* AliMUONDataInterface::Digit(
 	assert( 0 <= chamber && chamber <= 13 );
 	assert( 0 <= cathode && cathode <= 1 );
 	
-	if ( ! FetchLoaders(filename) ) return NULL;
+	if ( ! FetchLoaders(filename, foldername) ) return NULL;
 	if ( ! FetchEvent(event) ) return NULL;
 	if ( ! FetchTreeD() ) return NULL;
 
 	if ( fCathode != cathode )
 	{
-		fSimData.ResetDigits();
-		fSimData.GetDigits();
+		fData.ResetDigits();
+		fData.GetDigits();
 		fCathode = cathode;
 	}
-	return static_cast( fSimData.Digits(chamber)->At(digit) );
+	return static_cast( fData.Digits(chamber)->At(digit) );
 }
 
 
@@ -639,18 +605,18 @@ Int_t AliMUONDataInterface::NumberOfRawClusters(
 /// -1 is returned or error.
 
 	assert( 0 <= chamber && chamber <= 13 );
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	if ( ! FetchEvent(event) ) return -1;
 	if ( ! FetchTreeR() ) return -1;
 	if ( ! fClusterAddressSet )
 	{
 		// If the raw cluster address in TreeR is not set yet then set it now.
-		fRecData.SetTreeAddress("RC");
-		fRecData.ResetRawClusters();
-		fRecData.GetRawClusters();
+		fData.SetTreeAddress("RC");
+		fData.ResetRawClusters();
+		fData.GetRawClusters();
 		fClusterAddressSet = kTRUE;
 	}
-	return fRecData.RawClusters(chamber)->GetEntriesFast();
+	return fData.RawClusters(chamber)->GetEntriesFast();
 }
 
 
@@ -663,18 +629,18 @@ AliMUONRawCluster* AliMUONDataInterface::RawCluster(
 /// NULL is returned on error.
 
 	assert( 0 <= chamber && chamber <= 13 );
-	if ( ! FetchLoaders(filename) ) return NULL;
+	if ( ! FetchLoaders(filename, foldername) ) return NULL;
 	if ( ! FetchEvent(event) ) return NULL;
 	if ( ! FetchTreeR() ) return NULL;
 	if ( ! fClusterAddressSet )
 	{
 		// If the raw cluster address in TreeR is not set yet then set it now.
-		fRecData.SetTreeAddress("RC");
-		fRecData.ResetRawClusters();
-		fRecData.GetRawClusters();
+		fData.SetTreeAddress("RC");
+		fData.ResetRawClusters();
+		fData.GetRawClusters();
 		fClusterAddressSet = kTRUE;
 	}
-	return static_cast( fRecData.RawClusters(chamber)->At(cluster) );
+	return static_cast( fData.RawClusters(chamber)->At(cluster) );
 }
 
 
@@ -683,18 +649,18 @@ Int_t AliMUONDataInterface::NumberOfLocalTriggers(TString filename, TString fold
 /// Return the number of local trigger objects in the specified file, folder and
 /// event number. -1 is returned on error.
 
-	if ( ! FetchLoaders(filename) ) return -1;
+	if ( ! FetchLoaders(filename, foldername) ) return -1;
 	if ( ! FetchEvent(event) ) return -1;
 	if ( ! FetchTreeD() ) return -1;
 	if ( ! fTriggerAddressSet )
 	{
 		// If the local trigger address in TreeR is not set yet then set it now.
-		fRecData.SetTreeAddress("GLT");
-		fRecData.ResetTrigger();
-		fRecData.GetTriggerD();
+		fData.SetTreeAddress("GLT");
+		fData.ResetTrigger();
+		fData.GetTriggerD();
 		fTriggerAddressSet = kTRUE;
 	}
-	return fRecData.LocalTrigger()->GetEntriesFast();
+	return fData.LocalTrigger()->GetEntriesFast();
 }
 
 
@@ -705,18 +671,18 @@ AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(
 /// Fetch the specified local trigger object from the given file, folder and event number.
 /// NULL is returned on error.
 
-	if ( ! FetchLoaders(filename) ) return NULL;
+	if ( ! FetchLoaders(filename, foldername) ) return NULL;
 	if ( ! FetchEvent(event) ) return NULL;
 	if ( ! FetchTreeD() ) return NULL;
 	if ( ! fTriggerAddressSet )
 	{
 		// If the local trigger address in TreeR is not set yet then set it now.
-		fRecData.SetTreeAddress("GLT");
-		fRecData.ResetTrigger();
-		fRecData.GetTriggerD();
+		fData.SetTreeAddress("GLT");
+		fData.ResetTrigger();
+		fData.GetTriggerD();
 		fTriggerAddressSet = kTRUE;
 	}
-	return static_cast( fRecData.LocalTrigger()->At(trigger) );
+	return static_cast( fData.LocalTrigger()->At(trigger) );
 }
 
 Bool_t AliMUONDataInterface::SetFile(TString filename, TString foldername)
@@ -724,7 +690,7 @@ Bool_t AliMUONDataInterface::SetFile(TString filename, TString foldername)
 /// Set the current file and folder from which to fetch data.
 /// kTRUE is returned if the run and muon loaders were found, else kFALSE. 
 
-	return FetchLoaders(filename);
+	return FetchLoaders(filename, foldername);
 }
 
 
@@ -812,7 +778,7 @@ Int_t AliMUONDataInterface::NumberOfTracks()
 		return -1;
 	}
 	if ( ! FetchTreeH() ) return -1;
-	return fSimData.GetNtracks();
+	return fData.GetNtracks();
 }
 
 
@@ -834,11 +800,11 @@ Int_t AliMUONDataInterface::NumberOfHits(Int_t track)
 	if ( ! FetchTreeH() ) return -1;
 	if (fTrack < 0 || fTrack != track)
 	{
-		fSimData.ResetHits();
-		fSimData.GetTrack(track);
+		fData.ResetHits();
+		fData.GetTrack(track);
 		fTrack = track;
 	}
-	return fSimData.Hits()->GetEntriesFast();
+	return fData.Hits()->GetEntriesFast();
 }
 
 
@@ -860,11 +826,11 @@ AliMUONHit* AliMUONDataInterface::Hit(Int_t track, Int_t hit)
 	if ( ! FetchTreeH() ) return NULL;
 	if (fTrack < 0 || fTrack != track)
 	{
-		fSimData.ResetHits();
-		fSimData.GetTrack(track);
+		fData.ResetHits();
+		fData.GetTrack(track);
 		fTrack = track;
 	}
-	return static_cast( fSimData.Hits()->At(hit) );
+	return static_cast( fData.Hits()->At(hit) );
 }
 
 
@@ -890,11 +856,11 @@ Int_t AliMUONDataInterface::NumberOfSDigits(Int_t chamber, Int_t cathode)
 	if ( ! FetchTreeS() ) return -1;
 	if ( fSCathode != cathode )
 	{
-		fSimData.ResetSDigits();
-		fSimData.GetSDigits();
+		fData.ResetSDigits();
+		fData.GetSDigits();
 		fSCathode = cathode;
 	}
-	return fSimData.SDigits(chamber)->GetEntriesFast();
+	return fData.SDigits(chamber)->GetEntriesFast();
 }
 
 
@@ -920,11 +886,11 @@ AliMUONDigit* AliMUONDataInterface::SDigit(Int_t chamber, Int_t cathode, Int_t s
 	if ( ! FetchTreeS() ) return NULL;
 	if ( fSCathode != cathode )
 	{
-		fSimData.ResetSDigits();
-		fSimData.GetSDigits();
+		fData.ResetSDigits();
+		fData.GetSDigits();
 		fSCathode = cathode;
 	}
-	return static_cast( fSimData.SDigits(chamber)->At(sdigit) );
+	return static_cast( fData.SDigits(chamber)->At(sdigit) );
 }
 
 
@@ -950,11 +916,11 @@ Int_t AliMUONDataInterface::NumberOfDigits(Int_t chamber, Int_t cathode)
 	if ( ! FetchTreeD() ) return -1;
 	if ( fCathode != cathode )
 	{
-		fSimData.ResetDigits();
-		fSimData.GetDigits();
+		fData.ResetDigits();
+		fData.GetDigits();
 		fCathode = cathode;
 	}
-	return fSimData.Digits(chamber)->GetEntriesFast();
+	return fData.Digits(chamber)->GetEntriesFast();
 }
 
 
@@ -980,11 +946,11 @@ AliMUONDigit* AliMUONDataInterface::Digit(Int_t chamber, Int_t cathode, Int_t di
 	if ( ! FetchTreeD() ) return NULL;
 	if ( fCathode != cathode )
 	{
-		fSimData.ResetDigits();
-		fSimData.GetDigits();
+		fData.ResetDigits();
+		fData.GetDigits();
 		fCathode = cathode;
 	}
-	return static_cast( fSimData.Digits(chamber)->At(digit) );
+	return static_cast( fData.Digits(chamber)->At(digit) );
 }
 
 
@@ -1009,12 +975,12 @@ Int_t AliMUONDataInterface::NumberOfRawClusters(Int_t chamber)
 	if ( ! FetchTreeR() ) return -1;
 	if ( ! fClusterAddressSet )
 	{
-		fRecData.SetTreeAddress("RC");
-		fRecData.ResetRawClusters();
-		fRecData.GetRawClusters();
+		fData.SetTreeAddress("RC");
+		fData.ResetRawClusters();
+		fData.GetRawClusters();
 		fClusterAddressSet = kTRUE;
 	}
-	return fRecData.RawClusters(chamber)->GetEntriesFast();
+	return fData.RawClusters(chamber)->GetEntriesFast();
 }
 
 
@@ -1039,12 +1005,12 @@ AliMUONRawCluster* AliMUONDataInterface::RawCluster(Int_t chamber, Int_t cluster
 	if ( ! FetchTreeR() ) return NULL;
 	if ( ! fClusterAddressSet )
 	{
-		fRecData.SetTreeAddress("RC");
-		fRecData.ResetRawClusters();
-		fRecData.GetRawClusters();
+		fData.SetTreeAddress("RC");
+		fData.ResetRawClusters();
+		fData.GetRawClusters();
 		fClusterAddressSet = kTRUE;
 	}
-	return static_cast( fRecData.RawClusters(chamber)->At(cluster) );
+	return static_cast( fData.RawClusters(chamber)->At(cluster) );
 }
 
 
@@ -1067,12 +1033,12 @@ Int_t AliMUONDataInterface::NumberOfLocalTriggers()
 	if ( ! FetchTreeD() ) return -1;
 	if ( ! fTriggerAddressSet )
 	{
-		fRecData.SetTreeAddress("GLT");
-		fRecData.ResetTrigger();
-		fRecData.GetTriggerD();
+		fData.SetTreeAddress("GLT");
+		fData.ResetTrigger();
+		fData.GetTriggerD();
 		fTriggerAddressSet = kTRUE;
 	}
-	return fRecData.LocalTrigger()->GetEntriesFast();
+	return fData.LocalTrigger()->GetEntriesFast();
 }
 
 
@@ -1095,12 +1061,12 @@ AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(Int_t trigger)
 	if ( ! FetchTreeD() ) return NULL;
 	if ( ! fTriggerAddressSet )
 	{
-		fRecData.SetTreeAddress("GLT");
-		fRecData.ResetTrigger();
-		fRecData.GetTriggerD();
+		fData.SetTreeAddress("GLT");
+		fData.ResetTrigger();
+		fData.GetTriggerD();
 		fTriggerAddressSet = kTRUE;
 	}
-	return static_cast( fRecData.LocalTrigger()->At(trigger) );
+	return static_cast( fData.LocalTrigger()->At(trigger) );
 }
 
 Int_t AliMUONDataInterface::NumberOfGlobalTriggers()
@@ -1122,12 +1088,12 @@ Int_t AliMUONDataInterface::NumberOfGlobalTriggers()
   if ( ! FetchTreeD() ) return -1;
   if ( ! fTriggerAddressSet )
     {
-      fRecData.SetTreeAddress("GLT");
-      fRecData.ResetTrigger();
-      fRecData.GetTriggerD();
+      fData.SetTreeAddress("GLT");
+      fData.ResetTrigger();
+      fData.GetTriggerD();
       fTriggerAddressSet = kTRUE;
     }
-  return fRecData.GlobalTrigger()->GetEntriesFast();
+  return fData.GlobalTrigger()->GetEntriesFast();
 }
 
 AliMUONGlobalTrigger* AliMUONDataInterface::GlobalTrigger(Int_t trigger)
@@ -1149,12 +1115,12 @@ AliMUONGlobalTrigger* AliMUONDataInterface::GlobalTrigger(Int_t trigger)
   if ( ! FetchTreeD() ) return NULL;
   if ( ! fTriggerAddressSet )
     {
-      fRecData.SetTreeAddress("GLT");
-      fRecData.ResetTrigger();
-      fRecData.GetTriggerD();
+      fData.SetTreeAddress("GLT");
+      fData.ResetTrigger();
+      fData.GetTriggerD();
       fTriggerAddressSet = kTRUE;
     }
-  return static_cast( fRecData.GlobalTrigger()->At(trigger) );
+  return static_cast( fData.GlobalTrigger()->At(trigger) );
 }
 
 Int_t AliMUONDataInterface::NumberOfRecTracks()
@@ -1176,12 +1142,12 @@ Int_t AliMUONDataInterface::NumberOfRecTracks()
   if ( ! FetchTreeT() ) return -1;
   if ( ! fRecTracksAddressSet )
     {
-      fRecData.SetTreeAddress("RT");
-      fRecData.ResetRecTracks();
-      fRecData.GetRecTracks();
+      fData.SetTreeAddress("RT");
+      fData.ResetRecTracks();
+      fData.GetRecTracks();
       fRecTracksAddressSet = kTRUE;
     }
-  return fRecData.RecTracks()->GetEntriesFast();
+  return fData.RecTracks()->GetEntriesFast();
 }
 
 AliMUONTrack* AliMUONDataInterface::RecTrack(Int_t rectrack)
@@ -1203,11 +1169,11 @@ AliMUONTrack* AliMUONDataInterface::RecTrack(Int_t rectrack)
   if ( ! FetchTreeT() ) return NULL;
   if ( ! fRecTracksAddressSet )
     {
-      fRecData.SetTreeAddress("RT");
-      fRecData.ResetRecTracks();
-      fRecData.GetRecTracks();
+      fData.SetTreeAddress("RT");
+      fData.ResetRecTracks();
+      fData.GetRecTracks();
       fRecTracksAddressSet = kTRUE;
     }
-  return static_cast( fRecData.RecTracks()->At(rectrack) );
-  // return (AliMUONTrack*)(fRecData.RecTracks()->At(rectrack));
+  return static_cast( fData.RecTracks()->At(rectrack) );
+  // return (AliMUONTrack*)(fData.RecTracks()->At(rectrack));
 }
diff --git a/MUON/AliMUONDataInterface.h b/MUON/AliMUONDataInterface.h
index 3a1a074bcdf..ea821a591a9 100644
--- a/MUON/AliMUONDataInterface.h
+++ b/MUON/AliMUONDataInterface.h
@@ -6,7 +6,7 @@
 /* $Id$ */
 // Includes revised 07/05/2004
 //
-/// \ingroup evaluation
+/// \ingroup base
 /// \class AliMUONDataInterface
 /// \brief An easy to use interface to data in the MUON module
 
@@ -16,8 +16,7 @@
 #include 
 #include 
 
-#include "AliMUONRecData.h"
-#include "AliMUONSimData.h"
+#include "AliMUONData.h"
 
 class TParticle;
 
@@ -117,9 +116,9 @@ class AliMUONDataInterface : public TObject
   /// Not implemented
   AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
   
-  Bool_t FetchMuonLoader(TString filename);
-  Bool_t LoadLoaders(TString filename);
-  Bool_t FetchLoaders(TString filename);
+  Bool_t FetchMuonLoader(TString filename, TString foldername);
+  Bool_t LoadLoaders(TString filename, TString foldername);
+  Bool_t FetchLoaders(TString filename, TString foldername);
   Bool_t FetchEvent(Int_t event);
   Bool_t FetchTreeK();
   Bool_t FetchTreeH();
@@ -128,8 +127,7 @@ class AliMUONDataInterface : public TObject
   Bool_t FetchTreeR();
   Bool_t FetchTreeT();
   
-  Bool_t fCreatedRunLoader;   //!< If this object created the fRunloader then this flag is set.	
-  Bool_t fCreatedRunLoaderSim;//!< If this object created the fRunloader then this flag is set.	
+  Bool_t fCreatedRunLoader;  //!< If this object created the fRunloader then this flag is set.	
   
   Bool_t fHitAddressSet;     //!< Flag specifying if the TTree address for the hit tree was set.
   Bool_t fSDigitAddressSet;  //!< Flag specifying if the TTree address for the s-digit tree was set.
@@ -139,14 +137,10 @@ class AliMUONDataInterface : public TObject
   Bool_t fRecTracksAddressSet; //!< Flag specifying if the TTree address for the rec tracks tree was set.
   
   AliRunLoader* fRunloader;  //!< Pointer to the runloader object used.
-  AliRunLoader* fRunloaderSim; //!< Pointer to the runloader object used.
-  AliLoader* fRecLoader;    //!< Pointer to the muon loader object used.
-  AliLoader* fSimLoader;    //!< Pointer to the muon loader object used.
-  AliMUONRecData fRecData;  //!< Pointer to the muon raw data interface.
-  AliMUONSimData fSimData;  //!< Pointer to the muon raw data interface.
+  AliLoader* fMuonloader;    //!< Pointer to the muon loader object used.
+  AliMUONData fData;         //!< Pointer to the muon raw data interface.
   TString fFilename;         //!< The file name from which we are fetching data.
   TString fFoldername;       //!< The folder name from which we are fetching data.
-  TString fFoldernameSim;    //!< The folder name from which we are fetching data.
   Int_t fEventnumber;        //!< The currently selected event.
   Int_t fTrack;              //!< The currently selected track.
   Int_t fSCathode;           //!< The currently selected cathode in TreeS.
diff --git a/MUON/AliMUONDetElement.cxx b/MUON/AliMUONDetElement.cxx
index 81fe1a7bd0f..631919ebfcb 100644
--- a/MUON/AliMUONDetElement.cxx
+++ b/MUON/AliMUONDetElement.cxx
@@ -23,6 +23,7 @@
 // Author: Alexander Zinchenko, JINR Dubna
  
 #include "AliMUONDetElement.h"
+#include "AliMUON.h"
 #include "AliMUONSegmentation.h"
 #include "AliMUONDigit.h"
 #include "AliMUONHitMapA1.h"
@@ -33,7 +34,6 @@
 #include "AliMUONClusterFinderAZ.h"
 #include "AliMUONGeometryModuleTransformer.h" 
 #include "AliMUONSegmentation.h"
-#include "AliMUONGeometrySegmentation.h" 
 #include "AliMUONVGeometryDESegmentation.h" 
 #include "AliMpVSegmentation.h" 
 
diff --git a/MUON/AliMUONDigitizerV3.cxx b/MUON/AliMUONDigitizerV3.cxx
index 6df5a2df058..5fbf692d17e 100644
--- a/MUON/AliMUONDigitizerV3.cxx
+++ b/MUON/AliMUONDigitizerV3.cxx
@@ -22,7 +22,7 @@
 #include "AliMUONCalibrationData.h"
 #include "AliCDBManager.h"
 #include "AliMUONConstants.h"
-#include "AliMUONSimData.h"
+#include "AliMUONData.h"
 #include "AliMUONDataIterator.h"
 #include "AliMUONDigit.h"
 #include "AliMUONLogger.h"
@@ -409,7 +409,7 @@ AliMUONDigitizerV3::Exec(Option_t*)
   // files.
   for ( Int_t iFile = 0; iFile < nInputFiles; ++iFile )
   {    
-    AliMUONSimData* inputData = GetDataAccess(fManager->GetInputFolderName(iFile));
+    AliMUONData* inputData = GetDataAccess(fManager->GetInputFolderName(iFile));
     if (!inputData)
     {
       AliFatal(Form("Could not get access to input file #%d",iFile));
@@ -655,10 +655,10 @@ AliMUONDigitizerV3::GenerateNoisyDigitsForOneCathode(Int_t detElemId, Int_t cath
 }
 
 //_____________________________________________________________________________
-AliMUONSimData* 
+AliMUONData* 
 AliMUONDigitizerV3::GetDataAccess(const TString& folderName)
 {
-  /// Create an AliMUONSimData to deal with data found in folderName.
+  /// Create an AliMUONData to deal with data found in folderName.
 
   AliDebug(2,Form("Getting access to folder %s",folderName.Data()));
   AliRunLoader* runLoader = AliRunLoader::GetRunLoader(folderName);
@@ -673,8 +673,8 @@ AliMUONDigitizerV3::GetDataAccess(const TString& folderName)
     AliError(Form("Could not get MuonLoader from folder %s",folderName.Data()));
     return 0x0;
   }
-  AliMUONSimData* data = new AliMUONSimData(loader,"MUON","MUONDataForDigitOutput");
-  AliDebug(2,Form("AliMUONSimData=%p loader=%p",data,loader));
+  AliMUONData* data = new AliMUONData(loader,"MUON","MUONDataForDigitOutput");
+  AliDebug(2,Form("AliMUONData=%p loader=%p",data,loader));
   return data;
 }
 
@@ -775,8 +775,8 @@ AliMUONDigitizerV3::MergeDigits(const AliMUONDigit& src,
 
 //_____________________________________________________________________________
 void 
-AliMUONDigitizerV3::MergeWithSDigits(AliMUONSimData& outputData, 
-                                     const AliMUONSimData& inputData, Int_t mask)
+AliMUONDigitizerV3::MergeWithSDigits(AliMUONData& outputData, 
+                                     const AliMUONData& inputData, Int_t mask)
 {
   /// Merge the sdigits in inputData with the digits already present in outputData
 
diff --git a/MUON/AliMUONDigitizerV3.h b/MUON/AliMUONDigitizerV3.h
index aad00e7374c..0323abc423c 100644
--- a/MUON/AliMUONDigitizerV3.h
+++ b/MUON/AliMUONDigitizerV3.h
@@ -21,7 +21,7 @@
 #endif
 
 class AliMUONCalibrationData;
-class AliMUONSimData;
+class AliMUONData;
 class AliMUONDigit;
 class AliMUONLogger;
 class AliMUONTriggerEfficiencyCells;
@@ -62,16 +62,16 @@ class AliMUONDigitizerV3 : public AliDigitizer
   void GenerateNoisyDigits();
   void GenerateNoisyDigitsForOneCathode(Int_t detElemId, Int_t cathode);
 
-  AliMUONSimData* GetDataAccess(const TString& folderName);
+  AliMUONData* GetDataAccess(const TString& folderName);
 
   Bool_t MergeDigits(const AliMUONDigit& src, AliMUONDigit& srcAndDest);
 
-  void MergeWithSDigits(AliMUONSimData& outputData, const AliMUONSimData& inputData, 
+  void MergeWithSDigits(AliMUONData& outputData, const AliMUONData& inputData, 
                         Int_t mask);
   
 private:
   Bool_t fIsInitialized; ///< are we initialized ?
-  AliMUONSimData* fOutputData; //!< pointer to access digits
+  AliMUONData* fOutputData; //!< pointer to access digits
   AliMUONCalibrationData* fCalibrationData; //!< pointer to access calib parameters
   TTask* fTriggerProcessor; ///< pointer to the trigger part of the job
   AliMUONTriggerEfficiencyCells* fTriggerEfficiency; ///< trigger efficiency map  
@@ -84,7 +84,7 @@ class AliMUONDigitizerV3 : public AliDigitizer
   /// for noise-only digit generation and zero-suppression
   AliMUONLogger* fLogger; //!< to keep track of messages
   
-  ClassDef(AliMUONDigitizerV3,4) // MUON Digitizer V3-3
+  ClassDef(AliMUONDigitizerV3,3) // MUON Digitizer V3-3
 };
 
 #endif
diff --git a/MUON/AliMUONDisplay.cxx b/MUON/AliMUONDisplay.cxx
index d889216b9cc..9205a0dffa5 100644
--- a/MUON/AliMUONDisplay.cxx
+++ b/MUON/AliMUONDisplay.cxx
@@ -79,8 +79,6 @@
 #include "AliMUONGeometrySegmentation.h"
 #include "AliMUONConstants.h"
 #include "AliMUONTriggerSegmentation.h"
-#include "AliMUONSimData.h"
-#include "AliMUONRecData.h"
 
 #include "AliMpDEIterator.h"
 #include "AliMpSegmentation.h"
@@ -141,17 +139,14 @@ AliMUONDisplay::AliMUONDisplay()
     fPhits(0),
     fRpoints(0),
     fNextCathode(0),
-    fSimLoader(0), 
-    fRecLoader(0), 
-    fMUONSimData(0),
-    fMUONRecData(0)
+    fLoader(0), 
+    fMUONData(0)
 {
 /// Default constructor
 }
 
 //_____________________________________________________________________________
-AliMUONDisplay::AliMUONDisplay(Int_t size, 
-                               AliLoader * simLoader, AliLoader * recLoader)
+AliMUONDisplay::AliMUONDisplay(Int_t size, AliLoader * loader)
   : AliDisplay(),
     fEvent(0),
     fChamber(1),
@@ -165,10 +160,8 @@ AliMUONDisplay::AliMUONDisplay(Int_t size,
     fPhits(0),
     fRpoints(0),
     fNextCathode(kFALSE),
-    fSimLoader(simLoader), 
-    fRecLoader(recLoader), 
-    fMUONSimData(0),
-    fMUONRecData(0)
+    fLoader(loader), 
+    fMUONData(0)
   
 {
 /// Standard constructor to create an event display object.
@@ -252,10 +245,10 @@ AliMUONDisplay::AliMUONDisplay(Int_t size,
     fCanvas->Update();
  
     // initialize container
-    if(fSimLoader) 
-      fMUONSimData = new AliMUONSimData(fSimLoader,"MUON","MUON");
-    if(fRecLoader) 
-      fMUONRecData = new AliMUONRecData(fRecLoader,"MUON","MUON");
+    if(fLoader) 
+      fMUONData = new AliMUONData(fLoader,"MUON","MUON");
+    else
+      fMUONData =0x0;
 }
 
 //_____________________________________________________________________________
@@ -538,16 +531,16 @@ void AliMUONDisplay::PrintKinematics()
 {
 /// Print kinematic tree
 
-  if ( !fSimLoader || !fRecLoader ) {
-    AliErrorStream() << "Detector loaders are not defined." << endl;
-    return;
-  }  
-
-  AliRunLoader* runLoader = fSimLoader->GetRunLoader();
+  AliRunLoader * runLoader;
   TParticle *particle = new TParticle();
   Int_t nPart;
   Float_t vertex[3], momentum[3];
 
+  if (fLoader)
+    runLoader = fLoader->GetRunLoader();
+  else
+    runLoader = 0x0;
+  
   printf("******  Event # %d ******\n",runLoader->GetEventNumber());
   runLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle);
   nPart = (Int_t)runLoader->TreeK()->GetEntries();
@@ -735,11 +728,6 @@ void AliMUONDisplay::DrawTitle(Option_t *option)
 {
 /// Draw the event title
 
-  if ( !fSimLoader || !fRecLoader ) {
-    AliErrorStream() << "Detector loaders are not defined." << endl;
-    return;
-  }  
-
     Float_t xmin = gPad->GetX1();
     Float_t xmax = gPad->GetX2();
     Float_t ymin = gPad->GetY1();
@@ -747,7 +735,12 @@ void AliMUONDisplay::DrawTitle(Option_t *option)
     Float_t dx   = xmax-xmin;
     Float_t dy   = ymax-ymin;
     
-    AliRunLoader * runLoader = fSimLoader->GetRunLoader();
+    AliRunLoader * runLoader;
+    if (fLoader)
+      runLoader = fLoader->GetRunLoader();
+    else
+      runLoader = 0x0;
+
 
     if (strlen(option) == 0) {
 	TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
@@ -1070,18 +1063,18 @@ void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
     
     AliMUON *pMUON  =     (AliMUON*)gAlice->GetModule("MUON");
 
-    GetMUONSimData()->SetTreeAddress("D");
+    GetMUONData()->SetTreeAddress("D");
 
-    TClonesArray *muonDigits  = GetMUONSimData()->Digits(chamber-1);
+    TClonesArray *muonDigits  = GetMUONData()->Digits(chamber-1);
     if (muonDigits == 0) return;
 
     gAlice->ResetDigits();
     Int_t nent = 0;
  
-    if (GetSimLoader()->TreeD()) {
-	nent = (Int_t) GetSimLoader()->TreeD()->GetEntries();
+    if (GetLoader()->TreeD()) {
+	nent = (Int_t) GetLoader()->TreeD()->GetEntries();
 	//     gAlice->TreeD()->GetEvent(nent-2+cathode-1);
-	GetMUONSimData()->GetDigits();
+	GetMUONData()->GetDigits();
     }
     
     Int_t ndigits = muonDigits->GetEntriesFast();    
@@ -1269,15 +1262,15 @@ void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
     
     ResetRpoints();
     
-    GetMUONRecData()->SetTreeAddress("RC");
-    TClonesArray *muonRawClusters  = GetMUONRecData()->RawClusters(chamber-1);
+    GetMUONData()->SetTreeAddress("RC");
+    TClonesArray *muonRawClusters  = GetMUONData()->RawClusters(chamber-1);
 
     if (muonRawClusters == 0) return;
 
     Int_t nent = 0;
-    if (GetMUONRecData()->TreeR()) {
-	nent=(Int_t) GetMUONRecData()->TreeR()->GetEntries();
-	GetMUONRecData()->TreeR()->GetEvent(0);
+    if (GetMUONData()->TreeR()) {
+	nent=(Int_t) GetMUONData()->TreeR()->GetEntries();
+	GetMUONData()->TreeR()->GetEvent(0);
     }
     
     Int_t nrawcl = muonRawClusters->GetEntriesFast();
@@ -1316,10 +1309,10 @@ void AliMUONDisplay::LoadTracks()
 
   ResetRpoints();
 
-  GetMUONRecData()->SetTreeAddress("RT");
-  TClonesArray* recTracksArray = GetMUONRecData()->RecTracks();
+  GetMUONData()->SetTreeAddress("RT");
+  TClonesArray* recTracksArray = GetMUONData()->RecTracks();
   if (recTracksArray == NULL) return;
-  GetMUONRecData()->GetRecTracks();
+  GetMUONData()->GetRecTracks();
 
   Int_t nRecTracks = 0;
   if (recTracksArray)
@@ -1379,8 +1372,15 @@ void AliMUONDisplay::PrintTrack(Int_t iRecTracks, AliMUONTrack *recTrack)
   vertex[0] = trackParam->GetNonBendingCoor();
   vertex[1] = trackParam->GetBendingCoor();
   vertex[2] = trackParam->GetZ();
+  pYZ =  1./TMath::Abs(trackParam->GetInverseBendingMomentum());
+  bendingSlope = trackParam->GetBendingSlope();
+  nonBendingSlope = trackParam->GetNonBendingSlope();
+  momentum[2] = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);
+  momentum[0] = momentum[2] * nonBendingSlope;
+  momentum[1] = momentum[2] * bendingSlope;
   charge = Int_t(TMath::Sign(1.,trackParam->GetInverseBendingMomentum()));
-
+  chi2dof = recTrack->GetFitFMin()/(2.0 * recTrack->GetNTrackHits() - 5.);
+  
   printf("===================================================\n");
   printf("//*****************************************************************//\n");
   printf("// meaningless since the vertex is not known at the tracking level //\n");
@@ -1388,22 +1388,9 @@ void AliMUONDisplay::PrintTrack(Int_t iRecTracks, AliMUONTrack *recTrack)
   printf(" Reconstructed track # %d \n",iRecTracks);
   printf(" charge: %d \n",charge);
   printf(" vertex x,y,z (cm): %f %f %f \n",vertex[0],vertex[1],vertex[2]); 
-
-  if ( trackParam->GetInverseBendingMomentum() != 0. ) {
-    pYZ =  1./TMath::Abs(trackParam->GetInverseBendingMomentum());
-    bendingSlope = trackParam->GetBendingSlope();
-    nonBendingSlope = trackParam->GetNonBendingSlope();
-    momentum[2] = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);
-    momentum[0] = momentum[2] * nonBendingSlope;
-    momentum[1] = momentum[2] * bendingSlope;
-    printf(" momentum Px,Py,Pz (GeV/c): %f %f %f \n",momentum[0],momentum[1],momentum[2]);
-  }
-  else { 
-    AliErrorStream() << "Cannot calculate momentum: pYZ = inf" << endl;
-  }  
- 
-  chi2dof = recTrack->GetFitFMin()/(2.0 * recTrack->GetNTrackHits() - 5.);
+  printf(" momentum Px,Py,Pz (GeV/c): %f %f %f \n",momentum[0],momentum[1],momentum[2]);
   printf(" track chi2/dof: %f \n",chi2dof); 
+  
 }
 
 //___________________________________________
@@ -1421,23 +1408,23 @@ void AliMUONDisplay::LoadHits(Int_t chamber)
     
     Float_t zpos=AliMUONConstants::DefaultChamberZ(chamber-1);
 
-    if (GetMUONSimData()->TreeH()) {
-      GetMUONSimData()->SetTreeAddress("H");
-      Int_t ntracks = (Int_t)GetMUONSimData()->TreeH()->GetEntries(); //skowron
+    if (GetMUONData()->TreeH()) {
+      GetMUONData()->SetTreeAddress("H");
+      Int_t ntracks = (Int_t)GetMUONData()->TreeH()->GetEntries(); //skowron
       Int_t nthits  = 0;
       for (track = 0; track < ntracks; track++) {
-	GetMUONSimData()->ResetHits();
-	GetMUONSimData()->GetTrack(track);//skowron
-	TClonesArray *muonHits  = GetMUONSimData()->Hits();
+	GetMUONData()->ResetHits();
+	GetMUONData()->GetTrack(track);//skowron
+	TClonesArray *muonHits  = GetMUONData()->Hits();
 	if (muonHits == 0) return;
 	nthits += muonHits->GetEntriesFast();
       } 
       if (fPhits == 0) fPhits = new TObjArray(nthits);
       Int_t nhold=0;
       for (track=0; trackResetHits();
-	GetMUONSimData()->GetTrack(track);//skowron
-	TClonesArray *muonHits  = GetMUONSimData()->Hits();
+	GetMUONData()->ResetHits();
+	GetMUONData()->GetTrack(track);//skowron
+	TClonesArray *muonHits  = GetMUONData()->Hits();
 	if (muonHits == 0) return;
 	Int_t nhits = muonHits->GetEntriesFast();
 	if (nhits == 0) continue;
@@ -1542,10 +1529,10 @@ void AliMUONDisplay::Trigger()
 
   AliMUONGlobalTrigger* globalTrig;
 
-  GetMUONRecData()->SetTreeAddress("GLT");
-  GetMUONRecData()->GetTriggerD();
+  GetMUONData()->SetTreeAddress("GLT");
+  GetMUONData()->GetTriggerD();
 
-  globalTrig =  (AliMUONGlobalTrigger*)GetMUONRecData()->GlobalTrigger()->UncheckedAt(0);
+  globalTrig =  (AliMUONGlobalTrigger*)GetMUONData()->GlobalTrigger()->UncheckedAt(0);
   if (globalTrig == 0) return;
 
   globalTrig->Print("full");
@@ -1554,7 +1541,7 @@ void AliMUONDisplay::Trigger()
 //   AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(GetLoader(),1);
 
 //   //  AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
-//   AliMUONData* muonData = decision->GetMUONRecData();
+//   AliMUONData* muonData = decision->GetMUONData();
 //   muonData->SetTreeAddress("D");
 //   decision->Trigger(); 
 }
@@ -1623,22 +1610,18 @@ void AliMUONDisplay::ShowNextEvent(Int_t delta)
 ///  -  delta =  1  shown next event
 ///  -  delta = -1 show previous event
 
-   if ( !fSimLoader || !fRecLoader ) {
-     AliErrorStream() << "Detector loaders are not defined." << endl;
-     return;
-   }  
-    
-   AliRunLoader* runSimLoader =  fSimLoader->GetRunLoader();
-   AliRunLoader* runRecLoader =  fRecLoader->GetRunLoader();
-   
+  AliRunLoader * runLoader;
+  if (fLoader)
+    runLoader = fLoader->GetRunLoader();
+  else
+    runLoader = 0x0;
     
-   if (delta) {
+    if (delta) {
       //runLoader->CleanDetectors();
       //runLoader->CleanKinematics();
-      Int_t currentEvent = runSimLoader->GetEventNumber();
+      Int_t currentEvent = runLoader->GetEventNumber();
       Int_t newEvent     = currentEvent + delta;
-      runSimLoader->GetEvent(newEvent);
-      runRecLoader->GetEvent(newEvent);
+      runLoader->GetEvent(newEvent);
       fEvent=newEvent;
     }
     LoadDigits(fChamber, fCathode);
diff --git a/MUON/AliMUONDisplay.h b/MUON/AliMUONDisplay.h
index 126d0521801..3e7783913c0 100644
--- a/MUON/AliMUONDisplay.h
+++ b/MUON/AliMUONDisplay.h
@@ -7,15 +7,14 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup evaluation
+/// \ingroup base
 /// \class AliMUONDisplay
 /// \brief Utility class to display MUON events
 
 #include "AliDisplay.h"
 
 class AliLoader;
-class AliMUONSimData;
-class AliMUONRecData;
+class AliMUONData;
 class AliMUONTrack;
 class TCanvas;
 class TPad;
@@ -28,8 +27,7 @@ class AliMUONDisplay : public AliDisplay
 {
 public:
                      AliMUONDisplay();
-                     AliMUONDisplay(Int_t size, 
-                                    AliLoader * simLoader, AliLoader * recLoader);
+                     AliMUONDisplay(Int_t size, AliLoader * loader=0x0);
 		     
    virtual          ~AliMUONDisplay();
    virtual void      Clear(Option_t *option="");
@@ -57,10 +55,8 @@ class AliMUONDisplay : public AliDisplay
    Int_t             GetChamber() const {return fChamber;}    ///< Return current chamber
    Int_t             GetCathode() const {return fCathode;}    ///< Return current cathode
 
-   AliMUONSimData*   GetMUONSimData() {return fMUONSimData;}        ///< Return MUON data
-   AliMUONRecData*   GetMUONRecData() {return fMUONRecData;}        ///< Return MUON data
-   AliLoader*        GetSimLoader()  {return fSimLoader;}           ///< Return loader
-   AliLoader*        GetRecLoader()  {return fRecLoader;}           ///< Return loader
+   AliMUONData*      GetMUONData() {return fMUONData;}        ///< Return MUON data
+   AliLoader*        GetLoader()  {return fLoader;}           ///< Return loader
 
    virtual void      LoadDigits(Int_t chamber, Int_t cathode);
    virtual void      LoadHits(Int_t chamber);
@@ -111,10 +107,8 @@ class AliMUONDisplay : public AliDisplay
    TObjArray        *fRpoints;              ///< Array of cog points for each cathode
    Int_t            fNextCathode;           ///< Flagging next cathode
 
-   AliLoader*        fSimLoader;            //!< MUON loader to get data
-   AliLoader*        fRecLoader;            //!< MUON loader to get data
-   AliMUONSimData*   fMUONSimData;          //!< Data container for MUON subsystem 
-   AliMUONRecData*   fMUONRecData;          //!< Data container for MUON subsystem 
+   AliLoader*       fLoader;                //!< MUON loader to get data
+   AliMUONData*     fMUONData;              //!< Data container for MUON subsystem 
 
    ClassDef(AliMUONDisplay, 0)   //Utility class to display MUON events
 };
diff --git a/MUON/AliMUONEventRecoCombi.cxx b/MUON/AliMUONEventRecoCombi.cxx
index 899d7b64e35..5186222070c 100644
--- a/MUON/AliMUONEventRecoCombi.cxx
+++ b/MUON/AliMUONEventRecoCombi.cxx
@@ -23,7 +23,7 @@
 
 #include "AliMUONEventRecoCombi.h"
 
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONDetElement.h"
 #include "AliMUONDigit.h"
 #include "AliMUONHitForRec.h"
@@ -81,7 +81,7 @@ AliMUONEventRecoCombi::~AliMUONEventRecoCombi()
 }
 
 //_________________________________________________________________________
-void AliMUONEventRecoCombi::FillEvent(AliMUONRecData *data, AliMUONClusterFinderAZ *recModel)
+void AliMUONEventRecoCombi::FillEvent(AliMUONData *data, AliMUONClusterFinderAZ *recModel)
 {
   /// Fill event information
 
@@ -182,7 +182,7 @@ void AliMUONEventRecoCombi::FillEvent(AliMUONRecData *data, AliMUONClusterFinder
 }
 
 //_________________________________________________________________________
-void AliMUONEventRecoCombi::FillRecP(AliMUONRecData *dataCluster, AliMUONTrackReconstructorK *recoTrack) const
+void AliMUONEventRecoCombi::FillRecP(AliMUONData *dataCluster, AliMUONTrackReconstructorK *recoTrack) const
 {
   /// Fill rec. points used for tracking from det. elems
 
diff --git a/MUON/AliMUONEventRecoCombi.h b/MUON/AliMUONEventRecoCombi.h
index d4625d207b5..7222b08cf4b 100644
--- a/MUON/AliMUONEventRecoCombi.h
+++ b/MUON/AliMUONEventRecoCombi.h
@@ -14,7 +14,7 @@
 #include 
 #include 
 
-class AliMUONRecData;
+class AliMUONData;
 class AliMUONDetElement;
 class AliMUONTrackReconstructorK;
 class AliMUONClusterFinderAZ;
@@ -27,8 +27,8 @@ class AliMUONEventRecoCombi : public TObject
  public:
     virtual ~AliMUONEventRecoCombi();
     static AliMUONEventRecoCombi* Instance(AliMUONSegmentation* segmentation = 0);
-    void FillEvent(AliMUONRecData *data, AliMUONClusterFinderAZ *recModel); // fill event info
-    void FillRecP(AliMUONRecData *dataCluster, AliMUONTrackReconstructorK *recoTrack) const; // fill used rec. points from det. elems
+    void FillEvent(AliMUONData *data, AliMUONClusterFinderAZ *recModel); // fill event info
+    void FillRecP(AliMUONData *dataCluster, AliMUONTrackReconstructorK *recoTrack) const; // fill used rec. points from det. elems
 
     Int_t Nz() const { return fNZ; } ///< number of DE different Z-positions
     Double_t Z(Int_t iz) const { return (*fZ)[iz]; } ///< Z of DE
diff --git a/MUON/AliMUONGlobalTrigger.h b/MUON/AliMUONGlobalTrigger.h
index 51975817f36..851fce0d3dd 100644
--- a/MUON/AliMUONGlobalTrigger.h
+++ b/MUON/AliMUONGlobalTrigger.h
@@ -7,7 +7,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup trigger
+/// \ingroup base
 /// \class AliMUONGlobalTrigger
 /// \brief Global trigger object
 //  Author Ph. Crochet
diff --git a/MUON/AliMUONGlobalTriggerBoard.h b/MUON/AliMUONGlobalTriggerBoard.h
index ff051be4377..1e21d704fac 100644
--- a/MUON/AliMUONGlobalTriggerBoard.h
+++ b/MUON/AliMUONGlobalTriggerBoard.h
@@ -5,7 +5,7 @@
 
 /* $Id$ */
 
-/// \ingroup trigger
+/// \ingroup sim
 /// \class AliMUONGlobalTriggerBoard
 /// \brief Global trigger board
 ///
diff --git a/MUON/AliMUONHVNamer.h b/MUON/AliMUONHVNamer.h
index 7b74fb24e65..1667f37c403 100644
--- a/MUON/AliMUONHVNamer.h
+++ b/MUON/AliMUONHVNamer.h
@@ -6,7 +6,7 @@
 
 // $Id$
 
-/// \ingroup base
+/// \ingroup shuttle
 /// \class AliMUONHVNamer
 /// \brief Collection of methods usefull to HV subprocessor for MUON TRK
 /// 
diff --git a/MUON/AliMUONHit.h b/MUON/AliMUONHit.h
index 669677d2bd7..4719f0f86f9 100644
--- a/MUON/AliMUONHit.h
+++ b/MUON/AliMUONHit.h
@@ -6,7 +6,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup sim
+/// \ingroup base
 /// \class AliMUONHit
 /// \brief MonteCarlo hit
 ///
diff --git a/MUON/AliMUONHitForRec.cxx b/MUON/AliMUONHitForRec.cxx
index 076332d7588..ba464bbc52d 100644
--- a/MUON/AliMUONHitForRec.cxx
+++ b/MUON/AliMUONHitForRec.cxx
@@ -24,6 +24,7 @@
 #include "AliTrackReference.h" 
 #include "AliMUONHitForRec.h" 
 #include "AliMUONRawCluster.h"
+#include "AliMUONHit.h"
 #include "AliMUONConstants.h"
 #include "AliLog.h"
 #include "Riostream.h"
diff --git a/MUON/AliMUONHitMapA1.h b/MUON/AliMUONHitMapA1.h
index b1da3d9e441..dc0d2421ceb 100644
--- a/MUON/AliMUONHitMapA1.h
+++ b/MUON/AliMUONHitMapA1.h
@@ -7,7 +7,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup base
+/// \ingroup sim
 /// \class AliMUONHitMapA1
 /// \brief Implements AliHitMap as a 1-dim array
 
diff --git a/MUON/AliMUONRecLoader.cxx b/MUON/AliMUONLoader.cxx
similarity index 84%
rename from MUON/AliMUONRecLoader.cxx
rename to MUON/AliMUONLoader.cxx
index a22d555aecd..cac512e27f2 100644
--- a/MUON/AliMUONRecLoader.cxx
+++ b/MUON/AliMUONLoader.cxx
@@ -21,30 +21,30 @@
 // Implements AliLoader for MUON subsystem
 // Author: Gines Martinez
 
-#include "AliMUONRecLoader.h"
+#include "AliMUONLoader.h"
 #include "AliMUONConstants.h"
 #include "AliLog.h"
 
 /// \cond CLASSIMP
-ClassImp(AliMUONRecLoader)
+ClassImp(AliMUONLoader)
 /// \endcond
 
 //___________________________________________________________________
-AliMUONRecLoader::AliMUONRecLoader()
+AliMUONLoader::AliMUONLoader()
   : AliLoader(),
     fMUONData(0)
 {
 /// Default constructor
 }
 //_______________________________________________________________________________
-AliMUONRecLoader::AliMUONRecLoader(const Char_t* detname,const Char_t* eventfoldername)
+AliMUONLoader::AliMUONLoader(const Char_t* detname,const Char_t* eventfoldername)
   : AliLoader(detname,eventfoldername),
     fMUONData(0)
 {
 /// Standard contructor with name of the top folder of the tree
 }
 //_______________________________________________________________________________
-AliMUONRecLoader::AliMUONRecLoader(const Char_t * detname,TFolder* eventfolder)
+AliMUONLoader::AliMUONLoader(const Char_t * detname,TFolder* eventfolder)
   : AliLoader(detname,eventfolder),
     fMUONData(0)
 {
@@ -52,20 +52,20 @@ AliMUONRecLoader::AliMUONRecLoader(const Char_t * detname,TFolder* eventfolder)
 }
 
 //_______________________________________________________________________________
-AliMUONRecLoader::~AliMUONRecLoader()
+AliMUONLoader::~AliMUONLoader()
 {
 /// Destructor 
 }
 
 //_______________________________________________________________________________
-void AliMUONRecLoader::SetMUONData(AliMUONRecData * MUONData)
+void AliMUONLoader::SetMUONData(AliMUONData * MUONData)
 {
 /// Set MUON data
 
   fMUONData = MUONData;
 }
 //_______________________________________________________________________________
-AliMUONRecData * AliMUONRecLoader::GetMUONData()
+AliMUONData * AliMUONLoader::GetMUONData()
 {
 /// Get MUON data
 
diff --git a/MUON/AliMUONLoader.h b/MUON/AliMUONLoader.h
new file mode 100644
index 00000000000..49ac94bdc93
--- /dev/null
+++ b/MUON/AliMUONLoader.h
@@ -0,0 +1,43 @@
+#ifndef ALIMUONLOADER_H
+#define ALIMUONLOADER_H
+
+/*  Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+// Revision of includes 07/05/2004
+//
+/// \ingroup base
+/// \class AliMUONLoader
+/// \brief Implements AliLoader for MUON subsystem
+///
+/// \author Gines Martinez
+
+#include "AliLoader.h"
+
+class AliMUONData;
+
+
+class AliMUONLoader : public AliLoader 
+{
+  public:
+    AliMUONLoader();
+    AliMUONLoader(const Char_t *detname,const Char_t *eventfoldername); //contructor with name of the top folder of the tree
+    AliMUONLoader(const Char_t *detname,TFolder* eventfolder);
+    virtual ~AliMUONLoader();
+
+    void           SetMUONData(AliMUONData * MUONData);
+    AliMUONData *  GetMUONData();
+ 
+  protected:
+    /// Not implemented
+    AliMUONLoader(const AliMUONLoader& rhs);
+    /// Not implemented
+    AliMUONLoader& operator=(const AliMUONLoader& rhs);
+
+    AliMUONData * fMUONData; ///< data for MUON subsystem 
+
+  ClassDef(AliMUONLoader,1)
+};
+
+#endif
diff --git a/MUON/AliMUONLocalStruct.cxx b/MUON/AliMUONLocalStruct.cxx
index 6d4294837b1..65b1f40c61d 100644
--- a/MUON/AliMUONLocalStruct.cxx
+++ b/MUON/AliMUONLocalStruct.cxx
@@ -131,22 +131,6 @@ AliMUONLocalStruct::operator=(const AliMUONLocalStruct& event)
   return *this;
 }
 
-//___________________________________________
-void AliMUONLocalStruct::GetXPattern(TArrayS& array) const
-{
-    /// return array of X pattern
-    Short_t vec[4] = {GetX1(), GetX2(), GetX3(), GetX4()};
-    array.Set(4, vec);
-}
-
-//___________________________________________
-void AliMUONLocalStruct::GetYPattern(TArrayS& array) const
-{
-    /// return array of Y pattern
-    Short_t vec[4] = {GetY1(), GetY2(), GetY3(), GetY4()};
-    array.Set(4, vec);
-}
-
 //___________________________________________
 void AliMUONLocalStruct::SetScalersNumbers()
 {
diff --git a/MUON/AliMUONLocalStruct.h b/MUON/AliMUONLocalStruct.h
index 0b6387271b8..e60c88aee50 100644
--- a/MUON/AliMUONLocalStruct.h
+++ b/MUON/AliMUONLocalStruct.h
@@ -13,8 +13,6 @@
 
 #include 
 #include 
-#include 
-
 
 class AliMUONLocalStruct : public TObject{
  
@@ -38,10 +36,6 @@ class AliMUONLocalStruct : public TObject{
    UShort_t GetX4() const {return (fData[1] >> 16) &  0xFFFF;}
             /// Return X3
    UShort_t GetX3() const {return (fData[1])       &  0xFFFF;}
-           /// return X pattern array
-   void    GetXPattern(TArrayS& array) const;
-           /// return Y pattern array
-   void    GetYPattern(TArrayS& array) const;
 
             /// Return Y2
    UShort_t GetY2() const {return (fData[2] >> 16) &  0xFFFF;}
diff --git a/MUON/AliMUONLocalTrigger.h b/MUON/AliMUONLocalTrigger.h
index 963e80c99fc..9d0f6ad4f44 100644
--- a/MUON/AliMUONLocalTrigger.h
+++ b/MUON/AliMUONLocalTrigger.h
@@ -7,7 +7,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup trigger
+/// \ingroup base
 /// \class AliMUONLocalTrigger
 /// \brief Reconstructed Local Trigger object
 //  Author Ph. Crochet
diff --git a/MUON/AliMUONLocalTriggerBoard.h b/MUON/AliMUONLocalTriggerBoard.h
index d5c1c316c37..c6c4679e57a 100644
--- a/MUON/AliMUONLocalTriggerBoard.h
+++ b/MUON/AliMUONLocalTriggerBoard.h
@@ -5,7 +5,7 @@
 
 /* $Id$ */
 
-/// \ingroup trigger 
+/// \ingroup sim 
 /// \class AliMUONLocalTriggerBoard
 /// \brief Implementation of local trigger board objects
 ///
diff --git a/MUON/AliMUONPadStatusMaker.h b/MUON/AliMUONPadStatusMaker.h
index c0161c399fb..41cc91ecfaf 100644
--- a/MUON/AliMUONPadStatusMaker.h
+++ b/MUON/AliMUONPadStatusMaker.h
@@ -6,7 +6,7 @@
 
 // $Id$
 
-/// \ingroup rec
+/// \ingroup reco
 /// \class AliMUONPadStatusMaker
 /// \brief Make a 2DStore of pad statuses, using different sources of information
 /// 
diff --git a/MUON/AliMUONPoints.h b/MUON/AliMUONPoints.h
index a037d9bd542..3032da5864d 100644
--- a/MUON/AliMUONPoints.h
+++ b/MUON/AliMUONPoints.h
@@ -7,7 +7,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 //
-/// \ingroup evaluation
+/// \ingroup base
 /// \class AliMUONPoints
 /// \brief Class to draw detector clusters (is PolyMarker3D)
 
diff --git a/MUON/AliMUONRawWriter.h b/MUON/AliMUONRawWriter.h
index 2e53d3aebea..4d58020542a 100644
--- a/MUON/AliMUONRawWriter.h
+++ b/MUON/AliMUONRawWriter.h
@@ -5,7 +5,7 @@
 
 /*$Id$*/
 
-/// \ingroup base
+/// \ingroup sim
 /// \class AliMUONRawWriter
 /// \brief Raw data class for trigger and tracker chambers
 ///
diff --git a/MUON/AliMUONRecData.cxx b/MUON/AliMUONRecData.cxx
deleted file mode 100644
index c6c35d78975..00000000000
--- a/MUON/AliMUONRecData.cxx
+++ /dev/null
@@ -1,836 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/* $Id$ */
-
-/// \class AliMUONRecData
-///
-/// Class containing MUON data: hits, digits, rawclusters, globaltrigger, localtrigger, etc ..
-/// The classe makes the lik between the MUON data lists and the event trees from loaders
-///
-/// \author Gines Martinez, Subatech,  September 2003
-///
-
-#include "AliMUONRecData.h"
-#include "AliMUONDataIterator.h"
-#include "AliMUONConstants.h"
-#include "AliMUONDigit.h"
-#include "AliMUONGlobalTrigger.h"
-#include "AliMUONLocalTrigger.h"
-#include "AliMUONRegionalTrigger.h"
-#include "AliMUONTriggerCrateStore.h"
-#include "AliMUONTriggerCircuit.h"
-#include "AliMUONGeometryTransformer.h"
-#include "AliMUONRawCluster.h"
-#include "AliMUONTrack.h"
-#include "AliMUONTriggerTrack.h"
-
-#include "AliRunLoader.h"
-#include "AliStack.h"
-#include "AliLog.h"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/// \cond CLASSIMP
-ClassImp(AliMUONRecData)
-/// \endcond
- 
-//_____________________________________________________________________________
-AliMUONRecData::AliMUONRecData()
-  : AliMUONData(),
-    fRawClusters(0x0),
-    fRecTracks(0x0),
-    fRecTriggerTracks(0x0),
-    fNrawclusters(0x0),
-    fNrectracks(0),
-    fNrectriggertracks(0)
-{
-/// Default constructor
-}
-//_____________________________________________________________________________
-AliMUONRecData::AliMUONRecData(AliLoader * loader, const char* name, const char* title)
-  : AliMUONData(loader, name, title),
-    fRawClusters(0x0),
-    fRecTracks(0x0),
-    fRecTriggerTracks(0x0),
-    fNrawclusters(0x0),
-    fNrectracks(0),
-    fNrectriggertracks(0)
-{
-/// Standard constructor
-}
-
-//_____________________________________________________________________________
-AliMUONRecData::AliMUONRecData(const char* galiceFile)
-  : AliMUONData(galiceFile, "MUONFolder"),
-    fRawClusters(0x0),
-    fRecTracks(0x0),
-    fRecTriggerTracks(0x0),
-    fNrawclusters(0x0),
-    fNrectracks(0),
-    fNrectriggertracks(0)
-{
-/// Constructor for loading data from gAlice file
-}
-
-//_____________________________________________________________________________
-AliMUONRecData::~AliMUONRecData()
-{
-/// Destructor for AliMUONRecData
-
-  if (fRawClusters) {
-    fRawClusters->Delete();
-    delete fRawClusters;
-  }
-  if (fRecTracks){
-    fRecTracks->Delete();
-    delete fRecTracks;
-  }
-  if (fRecTriggerTracks){
-    fRecTriggerTracks->Delete();
-    delete fRecTriggerTracks;
-  }
-}
-//_____________________________________________________________________________
-void AliMUONRecData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
-{
-/// Add a MUON rawcluster to the list in the detection plane id
-
-  TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
-  new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
-}
-//_____________________________________________________________________________
-void AliMUONRecData::AddRecTrack(const AliMUONTrack& track)
-{
-/// Add a MUON rectrack
-
-  TClonesArray &lrectracks = *fRecTracks;
-  new(lrectracks[fNrectracks++]) AliMUONTrack(track);
-}
-//_____________________________________________________________________________
-void AliMUONRecData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
-{
-/// Add a MUON triggerrectrack
-
-  TClonesArray &lrectriggertracks = *fRecTriggerTracks;  
-  new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
-}
-//____________________________________________________________________________
-Bool_t   AliMUONRecData::IsRawClusterBranchesInTree()
-{
-/// Checking if there are RawCluster Branches In TreeR
-
-  if (TreeR()==0x0) {
-    AliError("No treeR in memory");
-    return kFALSE;
-  }
-  else {
-     char branchname[30];
-     sprintf(branchname,"%sRawClusters1",GetName());
-     TBranch * branch = 0x0;
-     branch = TreeR()->GetBranch(branchname);
-     if (branch)  return kTRUE;
-     else return kFALSE;    
-  }
-}
-//____________________________________________________________________________
-Bool_t   AliMUONRecData::IsTrackBranchesInTree()
-{
-/// Checking if there are Track Branches In TreeT
-  if (TreeT()==0x0) {
-    AliError("No treeT in memory");
-    return kFALSE;
-  }
-  else {
-     char branchname[30];
-     sprintf(branchname,"%sTrack",GetName());
-     TBranch * branch = 0x0;
-     branch = TreeT()->GetBranch(branchname);
-     if (branch)  return kTRUE;
-     else return kFALSE;    
-  }
-}
-//____________________________________________________________________________
-Bool_t   AliMUONRecData::IsTriggerBranchesInTree()
-{
-/// Checking if there are Trigger Branches In TreeR
- if (TreeR()==0x0) {
-    AliError("No treeR in memory");
-    return kFALSE;
-  }
-  else {
-     char branchname[30];
-     sprintf(branchname,"%sLocalTrigger",GetName());
-     TBranch * branch = 0x0;
-     branch = TreeR()->GetBranch(branchname);
-     if (branch)  return kTRUE;
-     else return kFALSE;    
-  }
-}
-//____________________________________________________________________________
-Bool_t   AliMUONRecData::IsTriggerTrackBranchesInTree()
-{
-/// Checking if there are TriggerTrack Branches In TreeT
-  if (TreeT()==0x0) {
-    AliError("No treeT in memory");
-    return kFALSE;
-  }
-  else {
-     char branchname[30];
-     sprintf(branchname,"%sTriggerTrack",GetName());
-     TBranch * branch = 0x0;
-     branch = TreeT()->GetBranch(branchname);
-     if (branch)  return kTRUE;
-     else return kFALSE;    
-  }
-}
-//____________________________________________________________________________
-void AliMUONRecData::FillOwn(Option_t* option)
-{
-/// Method to fill the trees
-
-  const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
-  const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
-  const char *cRL = strstr(option,"RL");   // Reconstructed Trigger Track in TreeT
-  const char *cTC = strstr(option,"TC");   // global and local Trigger branches Copy in TreeR
-  
-  char branchname[30];
-  TBranch * branch = 0x0;
-
-  // Filling TreeR
-  
-  if ( TreeR() && cRC && cTC )
-  {
-    TreeR()->Fill();
-  }
-  else
-  {  
-    if ( TreeR()  && cRC ) 
-    {
-      if ( IsTriggerBranchesInTree() ) 
-      {
-      // Branch per branch filling
-        for (int i=0; iGetBranch(branchname);
-          branch->Fill();
-        }
-      }
-      else  
-      {
-        TreeR()->Fill();
-      }
-    }
-    
-    if ( TreeR()  && cTC) 
-    {
-      if (IsRawClusterBranchesInTree()) 
-      {
-        // Branch per branch filling
-        sprintf(branchname,"%sLocalTrigger",GetName());
-        branch = TreeR()->GetBranch(branchname); 
-        branch->Fill();
-	sprintf(branchname,"%sRegionalTrigger",GetName());
-        branch = TreeR()->GetBranch(branchname); 
-        branch->Fill();
-        sprintf(branchname,"%sGlobalTrigger",GetName());
-        branch = TreeR()->GetBranch(branchname);
-        branch->Fill();
-      }
-      else
-      {
-        TreeR()->Fill();
-      }
-    }
-  }
-
-  // Filling TreeT
-  
-  if ( TreeT() && cRT && cRL )
-  {
-    TreeT()->Fill();
-  }
-  else
-  {
-    if ( TreeT() && cRT ) 
-    {
-      if (IsTriggerTrackBranchesInTree()) 
-      {
-        sprintf(branchname,"%sTrack",GetName());  
-        branch = TreeT()->GetBranch(branchname);
-        branch->Fill();
-      }
-      else 
-      {
-        TreeT()->Fill();
-      }
-    }
-
-    if ( TreeT() && cRL ) 
-    {
-      if (IsTrackBranchesInTree()) 
-      {
-        sprintf(branchname,"%sTriggerTrack",GetName());  
-        branch = TreeT()->GetBranch(branchname);
-        branch->Fill();
-      }    
-      else 
-      {
-        TreeT()->Fill();
-      }
-    }
-  }
-}
-
-//_____________________________________________________________________________
-void AliMUONRecData::MakeOwnBranch(Option_t* option)
-{
-/// Create Tree branches for the MUON.
-
-  const Int_t kBufferSize = 4000;
-  char branchname[30];
-  
-  //Setting Data Container
-  SetDataContainer(option);  
-
-  const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
-  const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
-  const char *cRL  = strstr(option,"RL");  // Reconstructed Trigger Track in TreeT
-                                           //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
-  const char *cTC = strstr(option,"TC");   // global and local Trigger branches Copy in TreeR
-  
-  TBranch * branch = 0x0;
-  
-  if (TreeR() && cRC ) {
-    //  one branch for raw clusters per tracking detection plane
-    //        
-    Int_t i; 
-    for (i=0; iGetBranch(branchname);
-      if (branch) {  
-        AliInfo(Form("Branch %s is already in tree.",branchname));
-        return;
-      }
-      branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
-      //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
-    }
-  }
-  
-  if (TreeR() && cTC ) {
-    //
-    // one branch for global trigger
-    //
-    sprintf(branchname,"%sGlobalTrigger",GetName());
-    branch = 0x0;
-    branch = TreeR()->GetBranch(branchname);
-    if (branch) {  
-      AliInfo(Form("Branch GlobalTrigger is already in treeR."));
-      return ;
-    }
-    branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
-    //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
-
-  //
-    // one branch for regional trigger
-    //  
-    sprintf(branchname,"%sRegionalTrigger",GetName());
-    branch = 0x0;
-    branch = TreeR()->GetBranch(branchname);
-    if (branch) {  
-      AliInfo(Form("Branch RegionalTrigger is already in treeR."));
-      return;
-    }
-    branch = TreeR()->Branch(branchname, &fRegionalTrigger, kBufferSize);
-     
-    //
-    // one branch for local trigger
-    //  
-    sprintf(branchname,"%sLocalTrigger",GetName());
-    branch = 0x0;
-    branch = TreeR()->GetBranch(branchname);
-    if (branch) {  
-      AliInfo(Form("Branch LocalTrigger is already in treeR."));
-      return;
-    }
-    branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
-    //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);  
-  }
-  
-  if (TreeT() && cRT ) {
-    sprintf(branchname,"%sTrack",GetName());  
-    branch = TreeT()->GetBranch(branchname);
-    if (branch) {  
-      AliInfo(Form("Branch %s is already in tree.",GetName()));
-      return ;
-    }
-    branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
-    //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
-  }  
-  // trigger tracks
-  if (TreeT() && cRL ) {
-    sprintf(branchname,"%sTriggerTrack",GetName());  
-    branch = TreeT()->GetBranch(branchname);
-    if (branch) {  
-      AliInfo(Form("Branch %s is already in tree.",GetName()));
-      return ;
-    }
-    branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
-    //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
-  }  
-}
-//____________________________________________________________________________
-void AliMUONRecData::SetOwnDataContainer(Option_t* option)
-{
-/// Setting data containers of muon data
-
-  const char *cRC  = strstr(option,"RC");  // RawCluster
-  const char *cRT  = strstr(option,"RT");  // Reconstructed Tracks
-  const char *cRL  = strstr(option,"RL");  // Reconstructed Trigger Tracks
-                                           //const char *cRP  = strstr(option,"RP");  // Reconstructed Particles  
-  const char *cTC = strstr(option,"TC");   // global and local Trigger branches Copy in TreeR
-
-  AliDebug(1,Form("option=%s",option));
-
-  //
-  // Containers for rawclusters, globaltrigger and local trigger tree
-  if (cRC ) {
-    if (fRawClusters == 0x0) {
-      fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
-      fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
-      for (Int_t i=0; iSetOwner();
-        fRawClusters->AddAt(tca,i); 
-        fNrawclusters[i]=0;
-      }
-    }
-    // ResetRawClusters(); 
-    // It breaks the correct functioning of the combined reconstruction (AZ)
-    
-  }
-  if (cTC ) {
-    if (fLocalTrigger == 0x0) {
-      fLocalTrigger  = new TClonesArray("AliMUONLocalTrigger",234);
-    }
-   if (fRegionalTrigger == 0x0) {
-      fRegionalTrigger  = new TClonesArray("AliMUONRegionalTrigger",16);
-    }
-    if (fGlobalTrigger== 0x0) {
-      fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); 
-    }
-    // ResetTrigger(); 
-    // This is not necessary here since trigger info ins copied from digits info on flight to RecPoint output
-  }
-
-  //
-  // Containers for rectracks and rectrigger tracks
-  if ( cRT ) {
-    if (fRecTracks == 0x0)  {
-      fRecTracks  = new TClonesArray("AliMUONTrack",100);
-    }
-    ResetRecTracks();
-  }
-  if (cRL) {
-    if (fRecTriggerTracks == 0x0 && cRL)  {
-      fRecTriggerTracks  = new TClonesArray("AliMUONTriggerTrack",100);
-    }
-    ResetRecTriggerTracks();
-  }  
-}
-
-//____________________________________________________________________________
-void AliMUONRecData::SetOwnTreeAddress(Option_t* option)
-{
-  // Setting Data containers
-  SetOwnDataContainer(option);
-
-/// Setting Addresses to the events trees
-
-  const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
-  const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
-  const char *cRL  = strstr(option,"RL");  // Reconstructed Trigger Track in TreeT
-                                           //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
-  const char *cTC = strstr(option,"TC");   // global and local Trigger branches Copy in TreeR
-  
-  // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
-  char branchname[30];
-  TBranch * branch = 0x0;
-  
-  AliDebug(1,Form("option=%s",option));
-
-  //
-  // Branch address for rawclusters, globaltrigger and local trigger tree
-  if ( TreeR()  && fRawClusters && cRC && !strstr(cRC,"RCC")) {
-    for (int i=0; iGetBranch(branchname);
-        if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
-        else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
-      }
-    }
-  }
-  if ( TreeR()  && fLocalTrigger && cTC) {
-    sprintf(branchname,"%sLocalTrigger",GetName());
-    branch = TreeR()->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fLocalTrigger);
-    else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
-  }
-  if ( TreeR()  && fRegionalTrigger && cTC) {
-    sprintf(branchname,"%sRegionalTrigger",GetName());
-    branch = TreeR()->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fRegionalTrigger);
-    else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeR.",GetName()));
-  }
-  if ( TreeR() && fGlobalTrigger && cTC) {
-    sprintf(branchname,"%sGlobalTrigger",GetName());
-    branch = TreeR()->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fGlobalTrigger);
-    else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
-  }
-
-  // Rec Trakcs
-  if ( TreeT() && fRecTracks && cRT ) {
-    sprintf(branchname,"%sTrack",GetName());  
-    branch = TreeT()->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fRecTracks);
-    else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
-  }
-  // Trigger tracks
-  if ( TreeT() && fRecTriggerTracks && cRL ) {
-    sprintf(branchname,"%sTriggerTrack",GetName());  
-    branch = TreeT()->GetBranch(branchname);
-    if (branch) branch->SetAddress(&fRecTriggerTracks);
-    else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
-  }
-}
-
-//____________________________________________________________________________
-void AliMUONRecData::Fill(Option_t* option)
-{
-/// Method to fill the trees
-
-  AliMUONData::Fill(option);
-  FillOwn(option);
-}  
-
-//_____________________________________________________________________________
-void AliMUONRecData::MakeBranch(Option_t* option)
-{
-/// Create Tree branches for the MUON.
-
-  AliMUONData::MakeBranch(option);
-  MakeOwnBranch(option);
-}  
-
-//____________________________________________________________________________
-void AliMUONRecData::SetDataContainer(Option_t* option)
-{
-/// Setting data containers of muon data
-  AliMUONData::SetDataContainer(option);
-  SetOwnDataContainer(option);
-}
-
-//____________________________________________________________________________
-void AliMUONRecData::SetTreeAddress(Option_t* option)
-{
-  AliMUONData::SetTreeAddress(option);
-  SetOwnTreeAddress(option);
-}  
-
-//____________________________________________________________________________
-TClonesArray*  AliMUONRecData::RawClusters(Int_t DetectionPlane)
-{
-/// Getting Raw Clusters
-
-  if (fRawClusters) 
-    return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
-  else
-    return NULL;
-}
-
-//_______________________________________________________________________________
-void AliMUONRecData::ResetRawClusters()
-{
-/// Reset number of raw clusters and the raw clust array for this detector
-
-  for ( int i=0;iAt(i))->Clear();
-    if (fNrawclusters)  fNrawclusters[i]=0;
-  }
-}
-
-//____________________________________________________________________________
-void AliMUONRecData::ResetRecTracks()
-{
-/// Reset tracks information
-
-  fNrectracks = 0;
-  if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
-}
-
-//____________________________________________________________________________
-void AliMUONRecData::ResetRecTriggerTracks()
-{
-/// Reset tracks information
-
-  fNrectriggertracks = 0;
-  if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
-}
-
-//_____________________________________________________________________________
-void 
-AliMUONRecData::DumpRecPoints(Int_t event2Check, Option_t* opt) 
-{
-/// Dump rec points
-
-  fLoader->LoadRecPoints("READ");
-
-  // Event loop
-  Int_t nevents = fRunLoader->GetNumberOfEvents();
-  for (Int_t ievent=0; ievent>> Event %d \n",ievent);
-
-    // Getting event ievent
-    fRunLoader->GetEvent(ievent);
-    Int_t nchambers = AliMUONConstants::NTrackingCh();
-    SetTreeAddress("RC,TC"); 
-    GetRawClusters();
-
-    // Loop on chambers
-    for (Int_t ichamber=0; ichamber>>  branchname %s\n",branchname);
-
-      // Loop on rec points
-      Int_t nrecpoints = (Int_t) RawClusters(ichamber)->GetEntriesFast();
-      // printf(">>> Chamber %2d, Number of recpoints = %6d \n",ichamber+1, nrecpoints);
-      for (Int_t irecpoint=0; irecpoint(RawClusters(ichamber)->At(irecpoint));
-	mRecPoint->Print(opt);
-      }
-    }
-    ResetRawClusters();
-    if (event2Check!=0) ievent=nevents;
-  }
-  fLoader->UnloadRecPoints();
-}
-
-//_____________________________________________________________________________
-void 
-AliMUONRecData::DumpTracks(Int_t event2Check, Option_t* opt) 
-{
-  /// Dump tracks
-  
-  fLoader->LoadTracks("READ");
-  
-  // Event loop
-  Int_t nevents = fRunLoader->GetNumberOfEvents();
-  
-  for (Int_t ievent=0; ievent>> Event %d \n",ievent);
-    
-    // Getting event ievent
-    fRunLoader->GetEvent(ievent);
-    
-    SetTreeAddress("RT"); 
-    GetRecTracks();
-    
-    // Loop on tracks
-    TClonesArray* tracks = RecTracks();
-    Int_t ntracks = (Int_t) tracks->GetEntriesFast();
-
-    for (Int_t i=0; i(tracks->At(i));
-      mTrack->Print(opt);
-    }
-    ResetRecTracks();
-    if (event2Check!=0) ievent=nevents;
-  }
-  fLoader->UnloadTracks();
-}
-
-//_____________________________________________________________________________
-void 
-AliMUONRecData::DumpRecTrigger(Int_t event2Check, 
-                            Int_t write, Bool_t readFromRP)
-{
-/// Reads and dumps trigger objects from MUON.RecPoints.root
-
-  TClonesArray * globalTrigger;
-  TClonesArray * localTrigger;
-  
-  // Do NOT print out all the info if the loop runs over all events 
-  Int_t printout = (event2Check == 0 ) ? 0 : 1 ;  
-
-  // Book a ntuple for more detailled studies
-  TNtuple *tupleGlo = new TNtuple("TgtupleGlo","Global Trigger Ntuple","ev:global:slpt:shpt:uplpt:uphpt:lplpt:lplpt");
-  TNtuple *tupleLoc = new TNtuple("TgtupleLoc","Local Trigger Ntuple","ev:LoCircuit:LoStripX:LoDev:StripY:LoLpt:LoHpt:y11:y21:x11");
-
-  // counters
-  Int_t sLowpt=0,sHighpt=0;
-  Int_t uSLowpt=0,uSHighpt=0;
-  Int_t lSLowpt=0,lSHighpt=0;
-
-  AliMUONTriggerCrateStore* crateManager = new AliMUONTriggerCrateStore();   
-  crateManager->ReadFromFile();
-
-  AliMUONGeometryTransformer* transformer = new AliMUONGeometryTransformer(kFALSE);
-  transformer->ReadGeometryData("volpath.dat", "geometry.root");
-
-  TClonesArray*  triggerCircuit = new TClonesArray("AliMUONTriggerCircuit", 234);
-
-  for (Int_t i = 0; i < AliMUONConstants::NTriggerCircuit(); i++)  {
-      AliMUONTriggerCircuit* c = new AliMUONTriggerCircuit();
-      c->SetTransformer(transformer);
-      c->Init(i,*crateManager);
-      TClonesArray& circuit = *triggerCircuit;
-      new(circuit[circuit.GetEntriesFast()])AliMUONTriggerCircuit(*c);
-      delete c;
-  }
-  
-  Char_t fileName[30];
-  if (!readFromRP) {
-      AliInfoStream() << " reading from digits \n";
-      fLoader->LoadDigits("READ");
-      sprintf(fileName,"TriggerCheckFromDigits.root");
-  } else {
-      AliInfoStream() << " reading from RecPoints \n";
-      fLoader->LoadRecPoints("READ");
-      sprintf(fileName,"TriggerCheckFromRP.root");
-  }
-
-  
-  AliMUONGlobalTrigger *gloTrg(0x0);
-  AliMUONLocalTrigger *locTrg(0x0);
-
-  Int_t nevents = fRunLoader->GetNumberOfEvents();
-  for (Int_t ievent=0; ieventGetEvent(ievent);
-    
-    if (!readFromRP) {
-	SetTreeAddress("D,GLT"); 
-	GetTriggerD();
-    } else {    
-	SetTreeAddress("RC,TC"); 
-	GetTrigger();
-    }
-
-    globalTrigger = GlobalTrigger();
-    localTrigger = LocalTrigger();
-    
-    Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1
-    Int_t nlocals  = (Int_t) localTrigger->GetEntriesFast(); // up to 234
-    if (printout) printf("###################################################\n");
-    if (printout) printf("event %d nglobal %d nlocal %d \n",ievent,nglobals,nlocals);
-
-    for (Int_t iglobal=0; iglobal(globalTrigger->At(iglobal));
-      
-      sLowpt+=gloTrg->SingleLpt() ;
-      sHighpt+=gloTrg->SingleHpt() ;
-      uSLowpt+=gloTrg->PairUnlikeLpt(); 
-      uSHighpt+=gloTrg->PairUnlikeHpt();
-      lSLowpt+=gloTrg->PairLikeLpt(); 
-      lSHighpt+=gloTrg->PairLikeHpt();
-      
-      if (printout) gloTrg->Print("full");
-
-    } // end of loop on Global Trigger
-
-    for (Int_t ilocal=0; ilocal(localTrigger->At(ilocal));
-
-      Bool_t xTrig=kFALSE;
-      Bool_t yTrig=kFALSE;
-
-      if ( locTrg->LoSdev()==1 && locTrg->LoDev()==0 && 
-	   locTrg->LoStripX()==0) xTrig=kFALSE; // no trigger in X
-      else xTrig=kTRUE;                         // trigger in X
-      if (locTrg->LoTrigY()==1 && 
-	  locTrg->LoStripY()==15 ) yTrig = kFALSE; // no trigger in Y
-      else yTrig = kTRUE;                          // trigger in Y
-
-      if (xTrig && yTrig) { // make Trigger Track if trigger in X and Y
-	  
-	  if (printout) locTrg->Print("full");
-	  
-	  AliMUONTriggerCircuit* circuit = (AliMUONTriggerCircuit*)triggerCircuit->At(locTrg->LoCircuit()-1); 
-	  
-	  tupleLoc->Fill(ievent,locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoDev(),locTrg->LoStripY(),locTrg->LoLpt(),locTrg->LoHpt(),circuit->GetY11Pos(locTrg->LoStripX()),circuit->GetY21Pos(locTrg->LoStripX()+locTrg->LoDev()+1),circuit->GetX11Pos(locTrg->LoStripY()));
-      }
-      
-    } // end of loop on Local Trigger
-    
-    // fill ntuple
-    tupleGlo->Fill(ievent,nglobals,gloTrg->SingleLpt(),gloTrg->SingleHpt(),gloTrg->PairUnlikeLpt(),gloTrg->PairUnlikeHpt(),gloTrg->PairLikeLpt(),gloTrg->PairLikeHpt());
-    
-    ResetTrigger();
-    if (event2Check!=0) ievent=nevents;
-  } // end loop on event  
-  
-  // Print out summary if loop ran over all event
-  if (!event2Check){
-
-    printf("\n");
-    printf("=============================================\n");
-    printf("================  SUMMARY  ==================\n");
-    printf("\n");
-    printf("Total number of events processed %d \n", (event2Check==0) ? nevents : 1);
-    printf("\n");
-    printf(" Global Trigger output       Low pt  High pt\n");
-    printf(" number of Single           :\t");
-    printf("%i\t%i\t",sLowpt,sHighpt);
-    printf("\n");
-    printf(" number of UnlikeSign pair  :\t"); 
-    printf("%i\t%i\t",uSLowpt,uSHighpt);
-    printf("\n");
-    printf(" number of LikeSign pair    :\t");  
-    printf("%i\t%i\t",lSLowpt,lSHighpt);
-    printf("\n");
-    printf("=============================================\n");
-    fflush(stdout);
-  }
-  
-  if (write){
-      TFile *myFile = new TFile(fileName, "RECREATE");
-      tupleGlo->Write();
-      tupleLoc->Write();
-      myFile->Close();
-  }
-
-  fLoader->UnloadRecPoints();
-
-  delete crateManager;
-  delete transformer;
-  delete triggerCircuit;
-  
-}
diff --git a/MUON/AliMUONRecData.h b/MUON/AliMUONRecData.h
deleted file mode 100644
index f46bdf8e0ce..00000000000
--- a/MUON/AliMUONRecData.h
+++ /dev/null
@@ -1,147 +0,0 @@
-#ifndef ALIMUONRECDATA_H
-#define ALIMUONRECDATA_H
-//
-/*  Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-//
-/// \ingroup rec
-/// \class AliMUONRecData
-/// \brief Class containing MUON data: hits, digits, rawclusters, globaltrigger, 
-/// localtrigger, etc ...
-///
-//  Author: Gines Martinez, Subatech,  September 2003
-
-#include "AliLoader.h"
-
-#include "AliMUONData.h"
-
-class AliMUONRawCluster;
-class AliMUONTrack;
-class AliMUONTriggerTrack;
-
-class AliRunLoader;
-
-class TClonesArray;
-class TObjArray;
-class TTree;
-
-
-//__________________________________________________________________
-/////////////////////////////////////////////////////////////////////
-//                                                                 //
-//  class AliMUONData                                              //
-//                                                                 //
-/////////////////////////////////////////////////////////////////////
-
-class AliMUONRecData : public AliMUONData
-{
-  public:
-  
-  //  enum EChamberIteration { kAllChambers, kTrackingChambers, kTriggerChambers };
-  
-    AliMUONRecData();
-    AliMUONRecData(AliLoader * loader, const char* name, const char* title);
-    AliMUONRecData(const char* galiceFile);
-    virtual ~AliMUONRecData();  
-    
-    virtual void   AddRawCluster(Int_t id, const AliMUONRawCluster& clust);
-    virtual void   AddRecTrack(const AliMUONTrack& track);
-    virtual void   AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack);
-
-    TClonesArray*  RawClusters(Int_t DetectionPlane);
-    
-                    /// Return reconstructed tracks
-    TClonesArray*  RecTracks() {return fRecTracks;} 
-                   /// Return reconstructed trigger tracks
-    TClonesArray*  RecTriggerTracks() {return fRecTriggerTracks;}
-
-    void           GetRawClusters() const;
-    void           GetTrigger() const;
-    void           GetRecTracks() const;
-    void           GetRecTriggerTracks() const;
-
-    Bool_t        IsRawClusterBranchesInTree();
-    Bool_t        IsTrackBranchesInTree();
-    Bool_t        IsTriggerBranchesInTree();
-    Bool_t        IsTriggerTrackBranchesInTree();
-    
-    virtual void   Fill(Option_t* opt=" ");
-    virtual void   MakeBranch(Option_t *opt=" ");
-    virtual void   SetDataContainer(Option_t *opt=" ");
-    virtual void   SetTreeAddress(Option_t *opt=" ");
-    
-    virtual void   ResetRawClusters();
-    virtual void   ResetRecTracks();
-    virtual void   ResetRecTriggerTracks();
-  
-                   /// Return tree with raw clusters
-    TTree*         TreeR() {return fLoader->TreeR(); }
-                   /// Return tree with tracks
-    TTree*         TreeT() {return fLoader->TreeT(); }
-
-                   // Methods to dump data
-    void DumpRecPoints(Int_t event2Check=0, Option_t* opt="full");
-    void DumpTracks(Int_t event2Check=0, Option_t* opt="full");
-    void DumpRecTrigger(Int_t event2Check=0, Int_t write = 0, Bool_t readFromRP = kTRUE);
-    
-  protected: 
-    /// Not implemented
-    AliMUONRecData(const AliMUONRecData& rhs);
-    /// Not implemented
-    AliMUONRecData& operator=(const AliMUONRecData& rhs);
-
-    TObjArray*      fRawClusters; ///< One event in TreeR/Rawcluster and one branch per tracking detection plane
-    TClonesArray*   fRecTracks; ///< pointer to array of reconstructed tracks
-    TClonesArray*   fRecTriggerTracks; ///< pointer to array of reconstructed trigger tracks
-
-    Int_t*          fNrawclusters;  //!< Number of Raw Clusters
-    Int_t           fNrectracks;    //!< Number of reconstructed tracks
-    Int_t           fNrectriggertracks; //!< Number of reconstructed tracks
-    Int_t           fSplitLevel;   ///< Splitting of branches 0 no spitting (root files are smaller) 1 splitting (larger output files)
-
-    mutable Int_t fCurrentEvent; ///< Current event we're dealing with
-    
-private:  
-    void   FillOwn(Option_t* opt=" ");
-    void   MakeOwnBranch(Option_t *opt=" ");
-    void   SetOwnDataContainer(Option_t *opt=" ");
-    void   SetOwnTreeAddress(Option_t *opt=" ");
-    
-
-  ClassDef(AliMUONRecData,3) // Data accessor for MUON module
-      
-};
-// inline functions
-
-
-/// Load raw clusters tree
-inline void AliMUONRecData::GetRawClusters() const {
-  if (fLoader && fLoader->TreeR())
-    fLoader->TreeR()->GetEvent(0);
-}
-
-/// Load trigger tree
-inline void AliMUONRecData::GetTrigger() const {
-  if (fLoader && fLoader->TreeR())
-    fLoader->TreeR()->GetEvent(0);
-}
-
-/// Load reconstructed tracks
-inline void AliMUONRecData::GetRecTracks() const {
-  if (fLoader && fLoader->TreeT())
-    fLoader->TreeT()->GetBranch("MUONTrack")->GetEvent(0);
-}
-
-/// Load reconstructed trigger tracks
-inline void AliMUONRecData::GetRecTriggerTracks() const {
-  if (fLoader && fLoader->TreeT())
-    fLoader->TreeT()->GetBranch("MUONTriggerTrack")->GetEvent(0);
-}
-
-
-
-#endif
-
diff --git a/MUON/AliMUONRecLoader.h b/MUON/AliMUONRecLoader.h
deleted file mode 100644
index 94137cc9c38..00000000000
--- a/MUON/AliMUONRecLoader.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef ALIMUONRECLOADER_H
-#define ALIMUONRECLOADER_H
-
-/*  Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-//
-/// \ingroup rec
-/// \class AliMUONRecLoader
-/// \brief Implements AliLoader for MUON subsystem
-///
-/// \author Gines Martinez
-
-#include "AliLoader.h"
-
-class AliMUONRecData;
-
-
-class AliMUONRecLoader : public AliLoader 
-{
-  public:
-    AliMUONRecLoader();
-    AliMUONRecLoader(const Char_t *detname,const Char_t *eventfoldername); //contructor with name of the top folder of the tree
-    AliMUONRecLoader(const Char_t *detname,TFolder* eventfolder);
-    virtual ~AliMUONRecLoader();
-
-    void              SetMUONData(AliMUONRecData * MUONData);
-    AliMUONRecData *  GetMUONData();
- 
-  protected:
-    /// Not implemented
-    AliMUONRecLoader(const AliMUONRecLoader& rhs);
-    /// Not implemented
-    AliMUONRecLoader& operator=(const AliMUONRecLoader& rhs);
-
-    AliMUONRecData * fMUONData; ///< data for MUON subsystem 
-
-  ClassDef(AliMUONRecLoader,1)
-};
-
-#endif
diff --git a/MUON/AliMUONRecoCheck.cxx b/MUON/AliMUONRecoCheck.cxx
index 1aaa80214b5..87ce1e9682f 100644
--- a/MUON/AliMUONRecoCheck.cxx
+++ b/MUON/AliMUONRecoCheck.cxx
@@ -24,7 +24,7 @@
 #include "AliMUON.h"
 #include "AliMUONRecoCheck.h"
 #include "AliMUONTrack.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONConstants.h"
 
 #include "AliLoader.h" 
@@ -42,12 +42,10 @@ ClassImp(AliMUONRecoCheck)
 /// \endcond
 
 //_____________________________________________________________________________
-  AliMUONRecoCheck::AliMUONRecoCheck(Char_t *chLoader, Char_t *chLoaderSim)
+  AliMUONRecoCheck::AliMUONRecoCheck(Char_t *chLoader)
   : TObject(),
   fRunLoader(0x0),
   fMUONData(0x0),
-  fRunLoaderSim(0x0),
-  fMUONDataSim(0x0),
   fMuonTrackRef(0x0),
   fTrackReco(0x0),
   fReconstructibleTracks(0),
@@ -60,7 +58,7 @@ ClassImp(AliMUONRecoCheck)
   fMuonTrackRef = new TClonesArray("AliMUONTrack", 10);
 
   // run loader
-  fRunLoader = AliRunLoader::Open(chLoader,"MUONFolder","READ");
+  fRunLoader = AliRunLoader::Open(chLoader);
   if (!fRunLoader) {
     AliError(Form("no run loader found " ));
     return;
@@ -70,43 +68,23 @@ ClassImp(AliMUONRecoCheck)
   AliLoader *loader = fRunLoader->GetLoader("MUONLoader");
 
   // container
-  fMUONData  = new AliMUONRecData(loader,"MUON","MUON");
+  fMUONData  = new AliMUONData(loader,"MUON","MUON");
   if (!fMUONData) {
     AliError(Form("no MUONData found " ));
     return;
   }
 
-  // run loader
-  fRunLoaderSim = AliRunLoader::Open(chLoaderSim,"MUONFolderSim","READ");
-  if (!fRunLoaderSim) {
-    AliError(Form("no run sim loader found " ));
-    return;
-  }
-
- // initialize loader 	 
-  AliLoader *loaderSim = fRunLoaderSim->GetLoader("MUONLoader");
-
-  // container
-  fMUONDataSim  = new AliMUONSimData(loaderSim,"MUON","MUON");
-  if (!fMUONDataSim) {
-    AliError(Form("no MUONDataSim found " ));
-    return;
-  }
-
-  fRunLoaderSim->LoadKinematics("READ"); 	 
+  fRunLoader->LoadKinematics("READ"); 	 
   fRunLoader->LoadTrackRefs("READ"); 	 
   loader->LoadTracks("READ");
 
 }
 
 //_____________________________________________________________________________
-  AliMUONRecoCheck::AliMUONRecoCheck(AliRunLoader *runloader, AliMUONRecData *muondata,
-                                     AliRunLoader *runloaderSim, AliMUONSimData *muondataSim)
+  AliMUONRecoCheck::AliMUONRecoCheck(AliRunLoader *runloader, AliMUONData *muondata)
   : TObject(),
   fRunLoader(0x0),
   fMUONData(0x0),
-  fRunLoaderSim(0x0),
-  fMUONDataSim(0x0),
   fMuonTrackRef(0x0),
   fTrackReco(0x0),
   fReconstructibleTracks(0),
@@ -133,20 +111,6 @@ ClassImp(AliMUONRecoCheck)
     return;
   }
 
-  // run loader
-  fRunLoaderSim = runloaderSim;
-  if (!fRunLoaderSim) {
-    AliError(Form("no run sim loader found " ));
-    return;
-  }
-
-  // container
-  fMUONDataSim  = muondataSim;
-  if (!fMUONDataSim) {
-    AliError(Form("no MUONDataSim found " ));
-    return;
-  }
-
 }
 
 
@@ -156,13 +120,11 @@ AliMUONRecoCheck::~AliMUONRecoCheck()
 /// Destructor
   delete fMuonTrackRef;
   if(fIsLoadConstructor){
-    fRunLoaderSim->UnloadKinematics();
+    fRunLoader->UnloadKinematics();
     fRunLoader->UnloadTrackRefs();
     fRunLoader->UnloadTracks();
     delete fMUONData;
     delete fRunLoader;
-    delete fMUONDataSim;
-    delete fRunLoaderSim;
   }
 }
 
@@ -204,7 +166,7 @@ void AliMUONRecoCheck::MakeTrackRef()
   Int_t charge;
   TParticlePDG *ppdg;
 
-  Int_t max = fRunLoaderSim->GetHeader()->Stack()->GetNtrack();
+  Int_t max = fRunLoader->GetHeader()->Stack()->GetNtrack();
   for (Int_t iTrackRef  = 0; iTrackRef < nTrackRef; iTrackRef++) {
 
     branch->GetEntry(iTrackRef);
@@ -278,7 +240,7 @@ void AliMUONRecoCheck::MakeTrackRef()
       }
 
       // track parameters at vertex 
-      particle = fRunLoaderSim->GetHeader()->Stack()->Particle(muonTrack->GetTrackID());
+      particle = fRunLoader->GetHeader()->Stack()->Particle(muonTrack->GetTrackID());
 
       if (particle) {
 
diff --git a/MUON/AliMUONRecoCheck.h b/MUON/AliMUONRecoCheck.h
index 024e17afe10..061af4bc8de 100644
--- a/MUON/AliMUONRecoCheck.h
+++ b/MUON/AliMUONRecoCheck.h
@@ -6,7 +6,7 @@
 
 /* $Id$ */
 
-/// \ingroup evaluation
+/// \ingroup base
 /// \class AliMUONRecoCheck
 /// \brief Utility class to check reconstruction
 
@@ -14,24 +14,21 @@
 #include "AliMUONTrack.h"
 
 class TClonesArray;
-class AliMUONRecData;
-class AliMUONSimData;
+class AliMUONData;
 class AliRunLoader;
 
 
 class AliMUONRecoCheck : public TObject 
 {
 public:
-  AliMUONRecoCheck(Char_t *chLoader, Char_t *chLoaderSim);
-  AliMUONRecoCheck(AliRunLoader *runloader, AliMUONRecData *muondata,
-                   AliRunLoader *runloaderSim, AliMUONSimData *muondataSim);
+  AliMUONRecoCheck(Char_t *chLoader);
+  AliMUONRecoCheck(AliRunLoader *runloader, AliMUONData *muondata);
   virtual          ~AliMUONRecoCheck();
 
   /// Return MUON data 	 
-  AliMUONRecData*  GetMUONData() {return fMUONData;}
+  AliMUONData*  GetMUONData() {return fMUONData;}
   /// Return run loader 	 
-  AliRunLoader* GetRunLoader()    {return fRunLoader;}
-  AliRunLoader* GetRunLoaderSim() {return fRunLoaderSim;}
+  AliRunLoader* GetRunLoader() {return fRunLoader;}
 
   void MakeTrackRef();
                 /// Add track reference
@@ -56,12 +53,10 @@ class AliMUONRecoCheck : public TObject
   /// Not implemented
   AliMUONRecoCheck& operator = (const AliMUONRecoCheck& rhs);
   
-  AliRunLoader*   fRunLoader;     ///< alice run loader 
-  AliMUONRecData* fMUONData;      ///< Data container for MUON subsystem 
-  AliRunLoader*   fRunLoaderSim;  ///< alice run loader 
-  AliMUONSimData* fMUONDataSim;   ///< Data container for MUON subsystem 
-  TClonesArray*   fMuonTrackRef;  ///< reference muon tracks
-  TClonesArray*   fTrackReco;     ///< reconstructed muon tracks
+  AliRunLoader* fRunLoader;     ///< alice run loader 
+  AliMUONData*  fMUONData;      ///< Data container for MUON subsystem 
+  TClonesArray* fMuonTrackRef;  ///< reference muon tracks
+  TClonesArray* fTrackReco;     ///< reconstructed muon tracks
   Int_t fReconstructibleTracks; ///< number of reconstructible tracks 
   Int_t fRecoTracks;            ///< number of reconstructed tracks 
   Bool_t fIsLoadConstructor;    //!< \brief boolean to tag the constructor, 
diff --git a/MUON/AliMUONReconstructor.cxx b/MUON/AliMUONReconstructor.cxx
index 17c245674dc..5ecfd42618f 100644
--- a/MUON/AliMUONReconstructor.cxx
+++ b/MUON/AliMUONReconstructor.cxx
@@ -26,7 +26,7 @@
 #include "AliMUONCalibrationData.h"
 #include "AliMUONClusterFinderAZ.h"
 #include "AliMUONClusterReconstructor.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONDigitCalibrator.h"
 #include "AliMUONEventRecoCombi.h" 
 #include "AliMUONDigitMaker.h"
@@ -56,7 +56,6 @@
 
 #include "TTask.h"
 #include "TStopwatch.h"
-#include "Riostream.h"
 
 /// \cond CLASSIMP
 ClassImp(AliMUONReconstructor)
@@ -71,7 +70,7 @@ AliMUONReconstructor::AliMUONReconstructor()
     fTriggerCircuit(new TClonesArray("AliMUONTriggerCircuit", 234)),
     fTransformer(new AliMUONGeometryTransformer(kTRUE)),
     fSegmentation(0x0),
-    fMUONData(new AliMUONRecData(0x0,"MUON","MUON"))
+    fMUONData(new AliMUONData(0x0,"MUON","MUON"))
 {
 /// Default constructor
 
@@ -334,7 +333,7 @@ void AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader) const
 void AliMUONReconstructor::Reconstruct(AliRunLoader* runLoader, 
                                        AliRawReader* rawReader) const
 {
-/// Recontruct 
+/// Recontruct
 /// \todo add more
 
   //  AliLoader
diff --git a/MUON/AliMUONReconstructor.h b/MUON/AliMUONReconstructor.h
index 6a4546defc5..e8887a99d57 100644
--- a/MUON/AliMUONReconstructor.h
+++ b/MUON/AliMUONReconstructor.h
@@ -13,7 +13,7 @@
 #include "AliReconstructor.h"
 
 class AliMUONCalibrationData;
-class AliMUONRecData;
+class AliMUONData;
 class AliMUONDigitMaker;
 class AliMUONTriggerCrateStore;
 class AliMUONGeometryTransformer;
@@ -76,7 +76,7 @@ class AliMUONReconstructor: public AliReconstructor
     AliMUONGeometryTransformer* fTransformer; //!< pointer to transformation
     AliMUONSegmentation*        fSegmentation; //!< pointer to segmentation
 
-    AliMUONRecData*             fMUONData;     //!< pointer to container
+    AliMUONData* fMUONData;                    //!< pointer to container
 
   ClassDef(AliMUONReconstructor, 0)   // class for the MUON reconstruction
 };
diff --git a/MUON/AliMUONRegionalTrigger.h b/MUON/AliMUONRegionalTrigger.h
index 47dc4ac185d..2245b1a9499 100644
--- a/MUON/AliMUONRegionalTrigger.h
+++ b/MUON/AliMUONRegionalTrigger.h
@@ -7,7 +7,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup trigger
+/// \ingroup base
 /// \class AliMUONRegionalTrigger
 /// \brief Reconstructed regional Trigger object
 //  Author Ch. Finck
diff --git a/MUON/AliMUONRegionalTriggerBoard.h b/MUON/AliMUONRegionalTriggerBoard.h
index 32a0d0b8386..e6ad58e670b 100644
--- a/MUON/AliMUONRegionalTriggerBoard.h
+++ b/MUON/AliMUONRegionalTriggerBoard.h
@@ -5,7 +5,7 @@
 
 /* $Id$ */
 
-/// \ingroup trigger
+/// \ingroup sim
 /// \class AliMUONRegionalTriggerBoard
 /// \brief Regional trigger - real HW algorithm is implemented
 ///
diff --git a/MUON/AliMUONSDigitizerV2.cxx b/MUON/AliMUONSDigitizerV2.cxx
index b68c70284e6..9912a7056ac 100644
--- a/MUON/AliMUONSDigitizerV2.cxx
+++ b/MUON/AliMUONSDigitizerV2.cxx
@@ -22,7 +22,7 @@
 #include "AliLog.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONSimData.h"
+#include "AliMUONData.h"
 #include "AliMUONDigit.h"
 #include "AliMUONHit.h"
 #include "AliMpDEManager.h"
@@ -87,7 +87,7 @@ AliMUONSDigitizerV2::Exec(Option_t*)
 
   fLoader->LoadHits("READ");
   
-  AliMUONSimData muonData(fLoader,"MUON","MUON");
+  AliMUONData muonData(fLoader,"MUON","MUON");
 
   AliMUON* muon = static_cast(gAlice->GetModule("MUON"));
     
diff --git a/MUON/AliMUONSimData.cxx b/MUON/AliMUONSimData.cxx
deleted file mode 100644
index 7534ef6236b..00000000000
--- a/MUON/AliMUONSimData.cxx
+++ /dev/null
@@ -1,475 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/* $Id$ */
-
-/// \class AliMUONSimData
-///
-/// Class containing MUON data: hits, digits, rawclusters, globaltrigger, localtrigger, etc ..
-/// The classe makes the lik between the MUON data lists and the event trees from loaders
-///
-/// \author Gines Martinez, Subatech,  September 2003
-///
-
-#include "AliMUONSimData.h"
-#include "AliMUONDataIterator.h"
-#include "AliMUONConstants.h"
-#include "AliMUONHit.h"
-#include "AliMUONDigit.h"
-#include "AliMUONGlobalTrigger.h"
-#include "AliMUONLocalTrigger.h"
-#include "AliMUONRegionalTrigger.h"
-#include "AliMUONTriggerCrateStore.h"
-#include "AliMUONTriggerCircuit.h"
-#include "AliMUONGeometryTransformer.h"
-#include "AliMUONRawCluster.h"
-
-// This is from rec, classes in base should not depend on rec !!!
-//#include "AliMUONTrack.h"
-//#include "AliMUONTriggerTrack.h"
-
-#include "AliRunLoader.h"
-#include "AliStack.h"
-#include "AliLog.h"
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/// \cond CLASSIMP
-ClassImp(AliMUONSimData)
-/// \endcond
- 
-//_____________________________________________________________________________
-AliMUONSimData::AliMUONSimData()
-  : AliMUONData(),
-    fHits(0x0),
-    //fSDigits(0x0),
-    fNhits(0)
-    //fNSdigits(0x0)
-{
-/// Default constructor
-}
-//_____________________________________________________________________________
-AliMUONSimData::AliMUONSimData(AliLoader * loader, const char* name, const char* title)
-  : AliMUONData(loader, name, title),
-    fHits(0x0),
-    //fSDigits(0x0),
-    fNhits(0)
-    //fNSdigits(0x0)
-{
-/// Standard constructor
-}
-
-//_____________________________________________________________________________
-AliMUONSimData::AliMUONSimData(const char* galiceFile)
-  : AliMUONData(galiceFile, "MUONFolderSim"),
-    fHits(0x0),
-    //fSDigits(0x0),
-    fNhits(0)
-    //fNSdigits(0x0)
-{
-/// Constructor for loading data from gAlice file
-}
-
-//_____________________________________________________________________________
-AliMUONSimData::~AliMUONSimData()
-{
-/// Destructor for AliMUONSimData
-  if (fHits) {
-    fHits->Delete();
-    delete fHits;
-  }
-/*  
-  if (fSDigits) {
-    fSDigits->Delete();
-    delete fSDigits;
-  }
-*/  
-}
-//____________________________________________________________________________
-void AliMUONSimData::AddHit(Int_t fIshunt, Int_t track, Int_t detElemId, 
-			 Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
-			 Float_t tof, Float_t momentum, Float_t theta, 
-			 Float_t phi, Float_t length, Float_t destep,
-			 Float_t Xref,Float_t Yref,Float_t Zref)
-{
- /// Add new hit to the hit list
-
-  TClonesArray &lhits = *fHits;
-  new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId, 
-				  idpart, X, Y, Z, 
-				  tof, momentum, theta, 
-				  phi, length, destep,
-				  Xref,Yref,Zref);
-}
-/*
-//_____________________________________________________________________________
-void AliMUONSimData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
-{
-/// Add a MUON Sdigit to the list of SDigits of the detection plane id
-
-  TClonesArray &lSdigits = * SDigits(id) ; 
-  new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
-}
-
-//____________________________________________________________________________
-TClonesArray*  AliMUONSimData::SDigits(Int_t DetectionPlane) const
-{
-/// Getting List of SDigits
-
-  if (fSDigits)
-    return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
-  else
-    return NULL;
-}
-*/
-//____________________________________________________________________________
-void AliMUONSimData::FillOwn(Option_t* option)
-{
-/// Method to fill the trees
-
-  const char *cH   = strstr(option,"H");
-  //const char *cS   = strstr(option,"S");   // SDigits branches in TreeS
-
-  //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
-  
-  // Filling TreeH
-  if ( TreeH() && cH ) 
-  {
-    TreeH()->Fill();
-  }  
-/* 
-  // Filling TreeS
-  if ( TreeS() && cS) 
-  {
-    TreeS()->Fill();
-  }
-*/  
-}
-
-//_____________________________________________________________________________
-void AliMUONSimData::MakeOwnBranch(Option_t* option)
-{
-/// Create Tree branches for the MUON.
-
-  const Int_t kBufferSize = 4000;
-  char branchname[30];
-  
-  //Setting Data Container
-  SetDataContainer(option);  
-
-  const char *cH   = strstr(option,"H");
-  //const char *cS   = strstr(option,"S");   // Digits branches in TreeS
-  
-  TBranch * branch = 0x0;
-  
-  // Creating Branches for Hits
-  if (TreeH() && cH) {
-    sprintf(branchname,"%sHits",GetName());  
-    branch = TreeH()->GetBranch(branchname);
-    if (branch) {  
-      AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname));
-      return ;
-    }
-    branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
-    //Info("MakeBranch","Making Branch %s for hits \n",branchname);
-  }  
-/*  
-  //Creating Branches for SDigits
-  if (TreeS() && cS ) {
-    // one branch for Sdigits per chamber
-    for (Int_t iDetectionPlane=0; iDetectionPlaneGetBranch(branchname);
-      if (branch) {  
-        AliInfo(Form("Branch %s is already in tree.",branchname));
-        return;
-      }
-      TClonesArray * sdigits = SDigits(iDetectionPlane); 
-      branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
-      //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
-    }
-  }
-*/  
-}
-
-//____________________________________________________________________________
-void AliMUONSimData::SetOwnDataContainer(Option_t* option)
-{
-/// Setting data containers of muon data
-
-  const char *cH   = strstr(option,"H");
-  //const char *cS   = strstr(option,"S");   // SDigits
-                                           //const char *cRP  = strstr(option,"RP");  // Reconstructed Particles  
-  AliDebug(1,Form("option=%s",option));
-  //
-  // Clones array for hits
-  if ( cH ) {
-    if (fHits == 0x0) {
-      fHits     = new TClonesArray("AliMUONHit",1000);
-    }
-    ResetHits();
-  }
-/*  
-  //
-  // Container for Sdigits
-  if (cS) {
-    if (fSDigits == 0x0) { 
-      AliDebug(1,"Creating fSDigits TObjArray");
-      fSDigits = new TObjArray(AliMUONConstants::NCh());
-      fNSdigits= new Int_t[AliMUONConstants::NCh()];
-      for (Int_t i=0; iSetOwner();
-	fSDigits->AddAt(a,i);
-	AliDebug(1,Form("fSDigits[%d]=%p",i,a));
-        fNSdigits[i]=0;
-      }
-    }
-    else {
-      AliDebug(1,Form("fSDigits already there = %p",fSDigits));
-    }
-    ResetSDigits();
-  }  
-*/
-}
-
-//____________________________________________________________________________
-void AliMUONSimData::SetOwnTreeAddress(Option_t* option)
-{
-  // Setting Data containers
-  SetOwnDataContainer(option);
-
-/// Setting Addresses to the events trees
-
-  const char *cH   = strstr(option,"H");
-  //const char *cS   = strstr(option,"S");   // SDigits branches in TreeS
-  
-  // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
-  char branchname[30];
-  TBranch * branch = 0x0;
-  
-  AliDebug(1,Form("option=%s",option));
-  //
-  // Branch address for hit tree
-  if (TreeH() && fHits && cH) {
-    sprintf(branchname,"%sHits",GetName());  
-    branch = TreeH()->GetBranch(branchname);
-    if (branch) {
-      //      Info("SetTreeAddress","(%s) Setting for Hits",GetName());
-      branch->SetAddress(&fHits);
-    }
-    else { //can be invoked before branch creation
-      //AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
-    }
-  }
-/*    
-  //
-  // Branch address for Sdigit tree
-  if (TreeS() && fSDigits && cS) {
-    AliDebug(1,"Setting branch addresses");
-    for (int i=0; iGetBranch(branchname);
-        TClonesArray * sdigits = SDigits(i);
-        if (branch) branch->SetAddress( &sdigits );
-        else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
-      }
-    }
-  }
-*/  
-}
-
-//____________________________________________________________________________
-void AliMUONSimData::Fill(Option_t* option)
-{
-/// Method to fill the trees
-
-  AliMUONData::Fill(option);
-  FillOwn(option);
-}
-
-//_____________________________________________________________________________
-void AliMUONSimData::MakeBranch(Option_t* option)
-{
-/// Create Tree branches for the MUON.
-
-  AliMUONData::MakeBranch(option);
-  MakeOwnBranch(option);
-}
-
-//____________________________________________________________________________
-void AliMUONSimData::SetDataContainer(Option_t* option)
-{
-/// Setting data containers of muon data
-
-  AliMUONData::SetDataContainer(option);
-  SetOwnDataContainer(option);
-}
-
-//____________________________________________________________________________
-void AliMUONSimData::SetTreeAddress(Option_t* option)
-{
-  // Setting Data containers
-  SetDataContainer(option);
-  
-  AliMUONData::SetTreeAddress(option);
-  SetOwnTreeAddress(option);
-}
-
-//____________________________________________________________________________
-Int_t          
-AliMUONSimData::GetNtracks() const      
-{
-/// Get number of entries in hits three
-
-  Int_t ntrk = 0;
-  if (fLoader && fLoader->TreeH())
-    ntrk = (Int_t) fLoader->TreeH()->GetEntries();
-  return ntrk;
-}
-/*
-//____________________________________________________________________________
-void AliMUONSimData::ResetSDigits()
-{
-/// Reset number of Sdigits and the Sdigits array for this detector
-
-    if (fSDigits == 0x0) return;
-    for ( int i=0;iAt(i))->Clear();
-      if (fNSdigits)  fNSdigits[i]=0;
-    }
-}
-*/
-//______________________________________________________________________________
-void AliMUONSimData::ResetHits()
-{
-/// Reset number of clusters and the cluster array for this detector
-
-  fNhits   = 0;
-  if (fHits) fHits->Clear();
-}
-
-//_____________________________________________________________________________
-void 
-AliMUONSimData::DumpKine(Int_t event2Check)
-{
-/// Dump kinematics
-
-  fRunLoader->LoadKinematics("READ");
-
-  Int_t nevents = fRunLoader->GetNumberOfEvents();
-  for (Int_t ievent=0; ieventGetEvent(ievent); 
-
-    // Stack of particle for this event
-    AliStack* stack = fRunLoader->Stack();
-
-    Int_t nparticles = (Int_t) fRunLoader->Stack()->GetNtrack();
-    printf(">>> Event %d, Number of particles is %d \n", ievent, nparticles);
-
-    for (Int_t iparticle=0; iparticleParticle(iparticle)->Print("");  
-    }
-    if (event2Check!=0) ievent=nevents;
-  }
-  fRunLoader->UnloadKinematics();
-}
-
-
-//_____________________________________________________________________________
-void 
-AliMUONSimData::DumpHits(Int_t event2Check, Option_t* opt)
-{
-/// Dump hits
-
-  fLoader->LoadHits("READ");
-
-  // Event loop
-  Int_t nevents = fRunLoader->GetNumberOfEvents();
-  for (Int_t ievent=0; ievent>> Event %d \n",ievent);
-
-    // Getting event ievent
-    fRunLoader->GetEvent(ievent); 
-    SetTreeAddress("H");
-
-    // Track loop
-    Int_t ntracks = (Int_t) GetNtracks();
-    for (Int_t itrack=0; itrackGetEntriesFast();
-      printf(">>> Track %d, Number of hits %d \n",itrack,nhits);
-      for (Int_t ihit=0; ihit(Hits()->At(ihit));
-	mHit->Print(opt);
-      }
-      ResetHits();
-    }
-    if (event2Check!=0) ievent=nevents;
-  }
-  fLoader->UnloadHits();
-}
-/*
-//_____________________________________________________________________________
-void 
-AliMUONSimData::DumpSDigits(Int_t event2Check, Option_t* opt)
-{
-/// Dump SDigits
-
-  fLoader->LoadSDigits("READ");
-  
-  // Event loop
-  Int_t nevents = fRunLoader->GetNumberOfEvents();
-  for (Int_t ievent=0; ievent>> Event %d \n",ievent);
-
-    // Getting event ievent
-    fRunLoader->GetEvent(ievent);
-    SetTreeAddress("S");
-    GetSDigits();
-
-    // Loop on chambers
-    Int_t nchambers = AliMUONConstants::NCh(); ;
-    for (Int_t ichamber=0; ichamberGetEntriesFast();
-      for (Int_t idigit=0; idigit(digits->At(idigit));
-        mDigit->Print(opt);
-      }
-    }
-    ResetSDigits();
-    if (event2Check!=0) ievent=nevents;
-  }
-  fLoader->UnloadSDigits();
-}
-*/
diff --git a/MUON/AliMUONSimData.h b/MUON/AliMUONSimData.h
deleted file mode 100644
index 61a3df5683c..00000000000
--- a/MUON/AliMUONSimData.h
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef ALIMUONSIMDATA_H
-#define ALIMUONSIMDATA_H
-//
-/*  Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-//
-/// \ingroup sim
-/// \class AliMUONSimData
-/// \brief Class containing MUON data from simulation: hits, digits, globaltrigger, 
-/// localtrigger, etc ...
-///
-//  Author: Gines Martinez, Subatech,  September 2003
-
-#include "AliLoader.h"
-
-#include "AliMUONData.h"
-
-class AliRunLoader;
-
-class TClonesArray;
-class TObjArray;
-class TTree;
-
-
-//__________________________________________________________________
-/////////////////////////////////////////////////////////////////////
-//                                                                 //
-//  class AliMUONSimData                                              //
-//                                                                 //
-/////////////////////////////////////////////////////////////////////
-
-class AliMUONSimData : public AliMUONData
-{
-  public:
-  
-  //  enum EChamberIteration { kAllChambers, kTrackingChambers, kTriggerChambers };
-  
-    AliMUONSimData();
-    AliMUONSimData(AliLoader * loader, const char* name, const char* title);
-    AliMUONSimData(const char* galiceFile);
-    virtual ~AliMUONSimData();  
-    //virtual void   AddSDigit(Int_t id, const AliMUONDigit& digit); // use copy constructor
-    virtual void   AddHit(Int_t fIshunt, Int_t track, Int_t detElemId, 
-			  Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
-			  Float_t tof, Float_t momentum, Float_t theta, 
-			  Float_t phi, Float_t length, Float_t destep, 
-			  Float_t Xref,Float_t Yref,Float_t Zref);
-    
-    TClonesArray*  Hits() {return fHits;} ///< Return hits
-    //TClonesArray*  SDigits(Int_t DetectionPlane) const;
-
-    void           GetTrack(Int_t it) const;
-    Int_t          GetNtracks() const;
-    //void           GetSDigits() const;
-
-    
-    virtual void   Fill(Option_t* opt=" ");
-    virtual void   MakeBranch(Option_t *opt=" ");
-    virtual void   SetDataContainer(Option_t *opt=" ");
-    virtual void   SetTreeAddress(Option_t *opt=" ");
-    
-    virtual void   ResetHits();
-    //virtual void   ResetSDigits();
-  
-                   /// Return tree with hits
-    TTree*         TreeH() {return fLoader->TreeH(); }
-                   /// Return tree with summable digits
-    //TTree*         TreeS() {return fLoader->TreeS(); }
-                   /// Return tree with particles
-    TTree*         TreeP() {return fLoader->TreeP(); }
-
-                   // Methods to dump data
-    void DumpKine(Int_t event2Check=0);
-    void DumpHits(Int_t event2Check=0, Option_t* opt="full");
-    //void DumpSDigits(Int_t event2Check=0, Option_t* opt="tracks");
-    
-  protected: 
-    /// Not implemented
-    AliMUONSimData(const AliMUONSimData& rhs);
-    /// Not implemented
-    AliMUONSimData& operator=(const AliMUONSimData& rhs);
-
-    TClonesArray*   fHits;    ///< One event in treeH per primary track
-    //TObjArray*      fSDigits; ///< One event in treeS and one branch per detection plane
-
-    Int_t           fNhits;   //!< Number of Hits
-    //Int_t*          fNSdigits;//!< Number of Digits
-
-    mutable Int_t fCurrentEvent; ///< Current event we're dealing with
-    
-private:  
-    void   FillOwn(Option_t* opt=" ");
-    void   MakeOwnBranch(Option_t *opt=" ");
-    void   SetOwnDataContainer(Option_t *opt=" ");
-    void   SetOwnTreeAddress(Option_t *opt=" ");
-
-  ClassDef(AliMUONSimData,3) // Data accessor for MUON module
-      
-};
-// inline functions
-
-
-/// Load hits for \a i th entry in hits three
-inline void AliMUONSimData::GetTrack(Int_t it) const  {
-  if (fLoader && fLoader->TreeH())
-    fLoader->TreeH()->GetEvent(it);
-}
-/*
-/// Load sdigits tree
-inline void AliMUONSimData::GetSDigits() const {
-  if (fLoader && fLoader->TreeS())
-    fLoader->TreeS()->GetEvent(0);
-}
-*/
-
-
-#endif
-
diff --git a/MUON/AliMUONSimLoader.cxx b/MUON/AliMUONSimLoader.cxx
deleted file mode 100644
index 8fad895526c..00000000000
--- a/MUON/AliMUONSimLoader.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/* $Id$ */
-
-// -------------------------
-// Class AliMUONDataLoader
-// -------------------------
-// Implements AliLoader for MUON subsystem
-// Author: Gines Martinez
-
-#include "AliMUONSimLoader.h"
-#include "AliMUONConstants.h"
-#include "AliLog.h"
-
-/// \cond CLASSIMP
-ClassImp(AliMUONSimLoader)
-/// \endcond
-
-//___________________________________________________________________
-AliMUONSimLoader::AliMUONSimLoader()
-  : AliLoader(),
-    fMUONData(0)
-{
-/// Default constructor
-}
-//_______________________________________________________________________________
-AliMUONSimLoader::AliMUONSimLoader(const Char_t* detname,const Char_t* eventfoldername)
-  : AliLoader(detname,eventfoldername),
-    fMUONData(0)
-{
-/// Standard contructor with name of the top folder of the tree
-}
-//_______________________________________________________________________________
-AliMUONSimLoader::AliMUONSimLoader(const Char_t * detname,TFolder* eventfolder)
-  : AliLoader(detname,eventfolder),
-    fMUONData(0)
-{
-/// Constructor
-}
-
-//_______________________________________________________________________________
-AliMUONSimLoader::~AliMUONSimLoader()
-{
-/// Destructor 
-}
-
-//_______________________________________________________________________________
-void AliMUONSimLoader::SetMUONData(AliMUONSimData * MUONData)
-{
-/// Set MUON data
-
-  fMUONData = MUONData;
-}
-//_______________________________________________________________________________
-AliMUONSimData * AliMUONSimLoader::GetMUONData()
-{
-/// Get MUON data
-
-  return fMUONData;
-}
-
diff --git a/MUON/AliMUONSimLoader.h b/MUON/AliMUONSimLoader.h
deleted file mode 100644
index 608722067eb..00000000000
--- a/MUON/AliMUONSimLoader.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef ALIMUONSIMLOADER_H
-#define ALIMUONSIMLOADER_H
-
-/*  Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-// Revision of includes 07/05/2004
-//
-/// \ingroup sim
-/// \class AliMUONSimLoader
-/// \brief Implements AliLoader for MUON subsystem
-///
-/// \author Gines Martinez
-
-#include "AliLoader.h"
-
-class AliMUONSimData;
-
-
-class AliMUONSimLoader : public AliLoader 
-{
-  public:
-    AliMUONSimLoader();
-    AliMUONSimLoader(const Char_t *detname,const Char_t *eventfoldername); //contructor with name of the top folder of the tree
-    AliMUONSimLoader(const Char_t *detname,TFolder* eventfolder);
-    virtual ~AliMUONSimLoader();
-
-    void              SetMUONData(AliMUONSimData * MUONData);
-    AliMUONSimData *  GetMUONData();
- 
-  protected:
-    /// Not implemented
-    AliMUONSimLoader(const AliMUONSimLoader& rhs);
-    /// Not implemented
-    AliMUONSimLoader& operator=(const AliMUONSimLoader& rhs);
-
-    AliMUONSimData * fMUONData; ///< data for MUON subsystem 
-
-  ClassDef(AliMUONSimLoader,1)
-};
-
-#endif
diff --git a/MUON/AliMUONSlatGeometryBuilder.cxx b/MUON/AliMUONSlatGeometryBuilder.cxx
index e925ca0fc4f..534064eada9 100644
--- a/MUON/AliMUONSlatGeometryBuilder.cxx
+++ b/MUON/AliMUONSlatGeometryBuilder.cxx
@@ -530,7 +530,7 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
 	  gMC->Gspos("S05E",2*index-1,"SB5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
 	  gMC->Gspos("S05E",2*index  ,"SB5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
 	}
-     }
+      }
 
       // position the volumes approximating the circular section of the pipe
       Float_t epsilon = 0.001; 
@@ -1294,39 +1294,29 @@ void AliMUONSlatGeometryBuilder::SetTransformations()
   TGeoRotation st345inclination("rot99");
   st345inclination.RotateX(AliMUONConstants::St345Inclination());
   
-// The rotation of the half-chamber is done with respect the center of the chamber.
-// the distance beween the roation axis and the chamber position is 
-// AliMUONConstants::DzCh()+AliMUONConstants::DzSlat()
-// Therefore the position of the half-chamber has to be corrected by a traslation in Z and Y axis
-  Double_t delta_y = (AliMUONConstants::DzCh()+AliMUONConstants::DzSlat())*
-    TMath::Sin(AliMUONConstants::St345Inclination() * TMath::Pi()/180.);
-  Double_t delta_z = (AliMUONConstants::DzCh()+AliMUONConstants::DzSlat())*
-    (1.-TMath::Cos(AliMUONConstants::St345Inclination() * TMath::Pi()/180.));
-
-
   Double_t zpos1= - AliMUONConstants::DefaultChamberZ(4); 
-  SetTransformation(4, TGeoTranslation(0., -delta_y, -delta_z+zpos1), st345inclination);
-  SetTransformation(5, TGeoTranslation(0.,  delta_y,  delta_z+zpos1), st345inclination);
+  SetTransformation(4, TGeoTranslation(0., 0., zpos1), st345inclination);
+  SetTransformation(5, TGeoTranslation(0., 0., zpos1), st345inclination);
 
   zpos1= - AliMUONConstants::DefaultChamberZ(5); 
-  SetTransformation(6, TGeoTranslation(0., -delta_y, -delta_z+zpos1), st345inclination);
-  SetTransformation(7, TGeoTranslation(0.,  delta_y,  delta_z+zpos1), st345inclination);
+  SetTransformation(6, TGeoTranslation(0., 0., zpos1), st345inclination);
+  SetTransformation(7, TGeoTranslation(0., 0., zpos1), st345inclination);
 
   zpos1 = - AliMUONConstants::DefaultChamberZ(6); 
-  SetTransformation(8, TGeoTranslation(0., -delta_y, -delta_z+zpos1), st345inclination);
-  SetTransformation(9, TGeoTranslation(0.,  delta_y,  delta_z+zpos1), st345inclination);
+  SetTransformation(8, TGeoTranslation(0., 0., zpos1), st345inclination);
+  SetTransformation(9, TGeoTranslation(0., 0., zpos1), st345inclination);
 
   zpos1 = - AliMUONConstants::DefaultChamberZ(7); 
-  SetTransformation(10, TGeoTranslation(0., -delta_y, -delta_z+zpos1), st345inclination );
-  SetTransformation(11, TGeoTranslation(0.,  delta_y,  delta_z+zpos1), st345inclination );
+  SetTransformation(10, TGeoTranslation(0., 0., zpos1), st345inclination );
+  SetTransformation(11, TGeoTranslation(0., 0., zpos1), st345inclination );
 
   zpos1 = - AliMUONConstants::DefaultChamberZ(8); 
-  SetTransformation(12, TGeoTranslation(0., -delta_y, -delta_z+zpos1), st345inclination);
-  SetTransformation(13, TGeoTranslation(0.,  delta_y,  delta_z+zpos1), st345inclination);
+  SetTransformation(12, TGeoTranslation(0., 0., zpos1), st345inclination);
+  SetTransformation(13, TGeoTranslation(0., 0., zpos1), st345inclination);
 
   zpos1 = - AliMUONConstants::DefaultChamberZ(9); 
-  SetTransformation(14, TGeoTranslation(0., -delta_y, -delta_z+zpos1), st345inclination);
-  SetTransformation(15, TGeoTranslation(0.,  delta_y,  delta_z+zpos1), st345inclination);
+  SetTransformation(14, TGeoTranslation(0., 0., zpos1), st345inclination);
+  SetTransformation(15, TGeoTranslation(0., 0., zpos1), st345inclination);
 
 }
 
diff --git a/MUON/AliMUONTrackExtrap.cxx b/MUON/AliMUONTrackExtrap.cxx
index 2565ba14fa2..3cd838124b5 100644
--- a/MUON/AliMUONTrackExtrap.cxx
+++ b/MUON/AliMUONTrackExtrap.cxx
@@ -360,42 +360,42 @@ void AliMUONTrackExtrap::ExtrapToVertexUncorrected(AliMUONTrackParam* trackParam
     cout<<"E-AliMUONTrackExtrap::ExtrapToVertexUncorrected: failed to get absorber node"<GetVolume()->GetShape()->GetAxisRange(3,kZAbsBeg,kZAbsEnd);
+  Double_t zAbsBeg, zAbsEnd;
+  absNode->GetVolume()->GetShape()->GetAxisRange(3,zAbsBeg,zAbsEnd);
   const Double_t *absPos = absNode->GetMatrix()->GetTranslation();
-  kZAbsBeg = absPos[2] - kZAbsBeg; // spectro. (z<0)
-  kZAbsEnd = absPos[2] - kZAbsEnd; // spectro. (z<0)
+  zAbsBeg = absPos[2] - zAbsBeg; // spectro. (z<0)
+  zAbsEnd = absPos[2] - zAbsEnd; // spectro. (z<0)
 */
-  static const Double_t kZAbsBeg = -90.;
-  static const Double_t kZAbsEnd = -505.;
+  static const Double_t zAbsBeg = -90.;
+  static const Double_t zAbsEnd = -505.;
     
   // Check the vertex position relatively to the absorber
-  if (zVtx < kZAbsBeg && zVtx > kZAbsEnd) { // spectro. (z<0)
+  if (zVtx < zAbsBeg && zVtx > zAbsEnd) { // spectro. (z<0)
     cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Ending Z ("<GetZ() > kZAbsBeg) { // spectro. (z<0)
+  if (trackParam->GetZ() > zAbsBeg) { // spectro. (z<0)
     cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<GetZ()
-    	<<") upstream the front absorber (zAbsorberBegin = "<GetZ() > kZAbsEnd) { // spectro. (z<0)
+  } else if (trackParam->GetZ() > zAbsEnd) { // spectro. (z<0)
     cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<GetZ()
-    	<<") inside the front absorber ("<GetVolume()->GetShape()->GetAxisRange(3,kZAbsBeg,kZAbsEnd);
+  Double_t zAbsBeg, zAbsEnd;
+  absNode->GetVolume()->GetShape()->GetAxisRange(3,zAbsBeg,zAbsEnd);
   const Double_t *absPos = absNode->GetMatrix()->GetTranslation();
-  kZAbsBeg = absPos[2] - kZAbsBeg; // spectro. (z<0)
-  kZAbsEnd = absPos[2] - kZAbsEnd; // spectro. (z<0)
+  zAbsBeg = absPos[2] - zAbsBeg; // spectro. (z<0)
+  zAbsEnd = absPos[2] - zAbsEnd; // spectro. (z<0)
 */
-  static const Double_t kZAbsBeg = -90.;
-  static const Double_t kZAbsEnd = -505.;
+  static const Double_t zAbsBeg = -90.;
+  static const Double_t zAbsEnd = -505.;
   
   // Check the vertex position relatively to the absorber
-  if (zVtx < kZAbsBeg && zVtx > kZAbsEnd) { // spectro. (z<0)
+  if (zVtx < zAbsBeg && zVtx > zAbsEnd) { // spectro. (z<0)
     cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Ending Z ("<GetZ() > kZAbsBeg) { // spectro. (z<0)
+  if (trackParam->GetZ() > zAbsBeg) { // spectro. (z<0)
     cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<GetZ()
-    	<<") upstream the front absorber (zAbsorberBegin = "<GetZ() > kZAbsEnd) { // spectro. (z<0)
+  } else if (trackParam->GetZ() > zAbsEnd) { // spectro. (z<0)
     cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<GetZ()
-    	<<") inside the front absorber ("<GetBendingCoor();
   trackXYZOut[2] = trackParam->GetZ();
   Double_t trackXYZIn[3];
-  trackXYZIn[2] = TMath::Min(zVtx, kZAbsBeg); // spectro. (z<0)
+  trackXYZIn[2] = TMath::Min(zVtx, zAbsBeg); // spectro. (z<0)
   trackXYZIn[0] = trackXYZOut[0] + (xVtx - trackXYZOut[0]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
   trackXYZIn[1] = trackXYZOut[1] + (yVtx - trackXYZOut[1]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
   Double_t pathLength = 0.;
diff --git a/MUON/AliMUONTrackHitPattern.cxx b/MUON/AliMUONTrackHitPattern.cxx
index 97c96deac80..230cd82659d 100644
--- a/MUON/AliMUONTrackHitPattern.cxx
+++ b/MUON/AliMUONTrackHitPattern.cxx
@@ -38,7 +38,7 @@
 
 
 #include "AliMUONTrackHitPattern.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONTrack.h"
 #include "AliMUONTrackParam.h"
 #include "AliMUONTrackExtrap.h"
@@ -71,7 +71,7 @@ ClassImp(AliMUONTrackHitPattern) // Class implementation in ROOT context
 
 
 //______________________________________________________________________________
-AliMUONTrackHitPattern::AliMUONTrackHitPattern(AliMUONRecData *data)
+AliMUONTrackHitPattern::AliMUONTrackHitPattern(AliMUONData *data)
     : TObject(),
       fMUONData(data),
       fTransformer(new AliMUONGeometryTransformer(kTRUE)),
@@ -120,7 +120,7 @@ void AliMUONTrackHitPattern::GetHitPattern(TClonesArray *recTracksPtr)
     /// and searches for matching digits
     //
     
-    const Int_t kMask[2][4]={{0x80, 0x40, 0x20, 0x10},
+    const Int_t mask[2][4]={{0x80, 0x40, 0x20, 0x10},
 			    {0x08, 0x04, 0x02, 0x01}};
     Bool_t isMatch[2];
     UShort_t pattern=0;
@@ -134,7 +134,7 @@ void AliMUONTrackHitPattern::GetHitPattern(TClonesArray *recTracksPtr)
 	    AliMUONTrackExtrap::ExtrapToZCov(trackParam, AliMUONConstants::DefaultChamberZ(10+ch));
 	    FindPadMatchingTrack(trackParam, isMatch, ch);
 	    for(Int_t cath=0; cath<2; cath++){
-		if(isMatch[cath]) pattern |= kMask[cath][ch];
+		if(isMatch[cath]) pattern |= mask[cath][ch];
 	    }
 	}
 	muonTrack->SetHitsPatternInTrigCh(pattern);
@@ -221,14 +221,14 @@ void AliMUONTrackHitPattern::GetPosUncertainty(AliMUONTrackParam *trackParam, Fl
     /// Takes into account Branson plane corrections in the iron wall.
     //
 
-    const Float_t kAlpha = 0.1123; // GeV/c
+    const Float_t alpha = 0.1123; // GeV/c
     
     // Find a better way to get such parameters ???
     const Float_t kZFilterIn = 1471.; // From STRUCT/SHILConst2.h
     const Float_t kZFilterOut = kZFilterIn + 120.; // From STRUCT/SHILConst2.h
     
-    const Float_t kZBranson = - (kZFilterIn + (kZFilterOut - kZFilterIn)*2./3. ); // - sign because distance are positive
-    Float_t zDistFromWall = TMath::Abs(zChamber - kZBranson);
+    const Float_t zBranson = - (kZFilterIn + (kZFilterOut - kZFilterIn)*2./3. ); // - sign because distance are positive
+    Float_t zDistFromWall = TMath::Abs(zChamber - zBranson);
     Float_t zDistFromLastTrackCh = TMath::Abs(zChamber - AliMUONConstants::DefaultChamberZ(9));
 
     TMatrixD *covParam = trackParam->GetCovariances();
@@ -242,7 +242,7 @@ void AliMUONTrackHitPattern::GetPosUncertainty(AliMUONTrackParam *trackParam, Fl
     if (sigmaY==0.)sigmaY = 0.004 * zDistFromLastTrackCh;
 
     Float_t p = trackParam->P();
-    Float_t thetaMS = kAlpha/p;
+    Float_t thetaMS = alpha/p;
     sigmaMS = zDistFromWall * TMath::Tan(thetaMS);
 
     return;
diff --git a/MUON/AliMUONTrackHitPattern.h b/MUON/AliMUONTrackHitPattern.h
index 4e9df7a3f0d..c728f3f6f0b 100644
--- a/MUON/AliMUONTrackHitPattern.h
+++ b/MUON/AliMUONTrackHitPattern.h
@@ -12,7 +12,7 @@
 #include 
 #include 
 
-class AliMUONRecData;
+class AliMUONData;
 class AliMUONLocalStruct;
 class AliMUONLocalTriggerBoard;
 class AliMUONTrackParam;
@@ -25,7 +25,7 @@ class TClonesArray;
 
 class AliMUONTrackHitPattern : public TObject {
 public:
-    AliMUONTrackHitPattern(AliMUONRecData *MUONData); // Default Constructor
+    AliMUONTrackHitPattern(AliMUONData *MUONData); // Default Constructor
     virtual ~AliMUONTrackHitPattern(); // Destructor
     
     void GetHitPattern(TClonesArray *recTracksArray);
@@ -39,12 +39,7 @@ class AliMUONTrackHitPattern : public TObject {
     Bool_t TriggerDigits();
 
 private:
-    /// Not implemented
-    AliMUONTrackHitPattern(const AliMUONTrackHitPattern& rhs);
-    /// Not implemented
-    AliMUONTrackHitPattern& operator = (const AliMUONTrackHitPattern& rhs);
-
-    AliMUONRecData *fMUONData; ///< Data container for MUON subsystem
+    AliMUONData *fMUONData; ///< Data container for MUON subsystem
     TList fTriggerDigitsList[4]; ///< List of trigger digits, one per chamber
     AliMUONGeometryTransformer *fTransformer; //!< pointer to transformation
     AliMUONTriggerCrateStore *fCrateManager; ///< pointer to crate manager
diff --git a/MUON/AliMUONTrackK.cxx b/MUON/AliMUONTrackK.cxx
index 4a824f6338d..3d624198201 100644
--- a/MUON/AliMUONTrackK.cxx
+++ b/MUON/AliMUONTrackK.cxx
@@ -23,7 +23,7 @@
 // Author: Alexander Zinchenko, JINR Dubna
 
 #include "AliMUONTrackK.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONConstants.h"
 
 #include "AliMUONTrackReconstructorK.h"
diff --git a/MUON/AliMUONTrackReconstructor.cxx b/MUON/AliMUONTrackReconstructor.cxx
index 5e6937d507e..7cd149004bf 100644
--- a/MUON/AliMUONTrackReconstructor.cxx
+++ b/MUON/AliMUONTrackReconstructor.cxx
@@ -26,7 +26,7 @@
 ///
 
 #include "AliMUONTrackReconstructor.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONConstants.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONHitForRec.h"
@@ -56,7 +56,7 @@ const Double_t AliMUONTrackReconstructor::fgkMaxNormChi2 = 100.0;
 const Bool_t AliMUONTrackReconstructor::fgkTrackAllTracks = kFALSE;
 
 //__________________________________________________________________________
-AliMUONTrackReconstructor::AliMUONTrackReconstructor(AliMUONRecData* data)
+AliMUONTrackReconstructor::AliMUONTrackReconstructor(AliMUONData* data)
   : AliMUONVTrackReconstructor(data)
 {
   /// Constructor for class AliMUONTrackReconstructor
diff --git a/MUON/AliMUONTrackReconstructor.h b/MUON/AliMUONTrackReconstructor.h
index 1c8d00172d5..1f5f381a345 100644
--- a/MUON/AliMUONTrackReconstructor.h
+++ b/MUON/AliMUONTrackReconstructor.h
@@ -16,7 +16,7 @@ class AliMUONTrack;
 class AliMUONTrackReconstructor : public AliMUONVTrackReconstructor {
 
  public:
-  AliMUONTrackReconstructor(AliMUONRecData* data); // default Constructor
+  AliMUONTrackReconstructor(AliMUONData* data); // default Constructor
   virtual ~AliMUONTrackReconstructor(); // Destructor
 
   virtual void EventDump(void);  // dump reconstructed event
diff --git a/MUON/AliMUONTrackReconstructorK.cxx b/MUON/AliMUONTrackReconstructorK.cxx
index 261b6ea1f53..3e0a554c9d7 100644
--- a/MUON/AliMUONTrackReconstructorK.cxx
+++ b/MUON/AliMUONTrackReconstructorK.cxx
@@ -29,7 +29,7 @@
 ////////////////////////////////////
 
 #include "AliMUONTrackReconstructorK.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONConstants.h"
 #include "AliMUONHitForRec.h"
 #include "AliMUONObjectPair.h"
@@ -46,7 +46,7 @@ ClassImp(AliMUONConstants)
 /// \endcond
 
 //__________________________________________________________________________
-AliMUONTrackReconstructorK::AliMUONTrackReconstructorK(AliMUONRecData* data, const Option_t* TrackMethod)
+AliMUONTrackReconstructorK::AliMUONTrackReconstructorK(AliMUONData* data, const Option_t* TrackMethod)
   : AliMUONVTrackReconstructor(data),
     fTrackMethod(2), //tracking method (2-Kalman 3-Combination-Kalman/Clustering)
     fMuons(0)
diff --git a/MUON/AliMUONTrackReconstructorK.h b/MUON/AliMUONTrackReconstructorK.h
index 3b39f721f65..ddb2f9f975e 100644
--- a/MUON/AliMUONTrackReconstructorK.h
+++ b/MUON/AliMUONTrackReconstructorK.h
@@ -18,7 +18,7 @@
 class AliMUONTrackReconstructorK : public AliMUONVTrackReconstructor {
 
  public:
-  AliMUONTrackReconstructorK(AliMUONRecData* data, const Option_t* TrackMethod); // default Constructor
+  AliMUONTrackReconstructorK(AliMUONData* data, const Option_t* TrackMethod); // default Constructor
   virtual ~AliMUONTrackReconstructorK(); // Destructor
 
           /// Return track method
diff --git a/MUON/AliMUONTracker.cxx b/MUON/AliMUONTracker.cxx
index 99eaf844b21..6f192fb6680 100644
--- a/MUON/AliMUONTracker.cxx
+++ b/MUON/AliMUONTracker.cxx
@@ -13,16 +13,11 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/// \class AliMUONTracker
-/// Interface class for use of global tracking framework;
-/// reconstruct tracks from recpoints
-///
-/// \author Christian Finck, SUBATECH Nantes
 
 #include "AliMUONTracker.h"
 #include "AliMUONTrackReconstructorK.h"
 #include "AliMUONTrackReconstructor.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliLog.h"
 
 //_____________________________________________________________________________
diff --git a/MUON/AliMUONTracker.h b/MUON/AliMUONTracker.h
index fd25db5ee4f..a4b28d6c055 100644
--- a/MUON/AliMUONTracker.h
+++ b/MUON/AliMUONTracker.h
@@ -4,16 +4,14 @@
  * See cxx source for full Copyright notice                               */
 
 
-/// \ingroup rec
+/// \ingroup base
 /// \class AliMUONTracker
 /// \brief MUON base Tracker
-///
-//  Author: Christian Finck, SUBATECH Nantes
 
 #include "AliTracker.h"
 class AliESD;
 class AliCluster;
-class AliMUONRecData;
+class AliMUONData;
 class TClonesArray;
 class AliMUONVTrackReconstructor;
 
@@ -40,7 +38,7 @@ class AliMUONTracker : public AliTracker
   /// Set trigger circuit
   void SetTriggerCircuit(TClonesArray* circuit) {fTriggerCircuit = circuit;}
   /// Set pointer to data container
-  void SetMUONData(AliMUONRecData* data) {fMUONData = data;}
+  void SetMUONData(AliMUONData* data) {fMUONData = data;}
   /// Set option
   void SetOption(Option_t* opt);
 
@@ -51,7 +49,7 @@ class AliMUONTracker : public AliTracker
   AliMUONTracker& operator=(const AliMUONTracker& rhs);
     
   TClonesArray* fTriggerCircuit;                //!< trigger circuit
-  AliMUONRecData*  fMUONData;                   //!< pointer to container
+  AliMUONData*  fMUONData;                      //!< pointer to container
   AliMUONVTrackReconstructor* fTrackReco;       //!< track reconstructor
 
   ClassDef(AliMUONTracker,0)  //tracker base class for MUON
diff --git a/MUON/AliMUONTrigger.cxx b/MUON/AliMUONTrigger.cxx
index 2d0bd7d6ef2..150f3c9c16d 100644
--- a/MUON/AliMUONTrigger.cxx
+++ b/MUON/AliMUONTrigger.cxx
@@ -23,7 +23,7 @@
 #include "AliTriggerInput.h"
 
 #include "AliMUON.h"
-#include "AliMUONSimLoader.h"
+#include "AliMUONLoader.h"
 #include "AliMUONData.h"
 #include "AliMUONDigit.h"
 #include "AliMUONGlobalTrigger.h"
diff --git a/MUON/AliMUONTriggerBoard.h b/MUON/AliMUONTriggerBoard.h
index d0cd6453fa9..d874e30c9b1 100644
--- a/MUON/AliMUONTriggerBoard.h
+++ b/MUON/AliMUONTriggerBoard.h
@@ -5,7 +5,7 @@
 
 /* $Id$ */
 
-/// \ingroup trigger
+/// \ingroup sim
 /// \class AliMUONTriggerBoard
 /// \brief TRIGGER BOARD BASE CLASS
 ///
diff --git a/MUON/AliMUONTriggerChamberEff.cxx b/MUON/AliMUONTriggerChamberEff.cxx
index 4b6d6c844b1..72e00788318 100644
--- a/MUON/AliMUONTriggerChamberEff.cxx
+++ b/MUON/AliMUONTriggerChamberEff.cxx
@@ -29,7 +29,7 @@
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONSegmentation.h"
 #include "AliMUON.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONTriggerTrack.h"
 
 #include "AliMpVSegmentation.h"
@@ -126,7 +126,7 @@ void AliMUONTriggerChamberEff::SetGaliceFile(const char *galiceFile)
 	AliLoader* loader = fRunLoader->GetLoader("MUONLoader");
 	if ( loader )
 	{
-	    fData = new AliMUONRecData(loader,"MUON","MUON");
+	    fData = new AliMUONData(loader,"MUON","MUON");
 	    loader->LoadTracks("READ");
 	    loader->LoadDigits("READ");
 	}
diff --git a/MUON/AliMUONTriggerChamberEff.h b/MUON/AliMUONTriggerChamberEff.h
index a445adb5d25..e1161663fd2 100644
--- a/MUON/AliMUONTriggerChamberEff.h
+++ b/MUON/AliMUONTriggerChamberEff.h
@@ -14,7 +14,7 @@
 #include "AliMUONGeometryTransformer.h"
 
 class AliRunLoader;
-class AliMUONRecData;
+class AliMUONData;
 class AliMUON;
 class AliMUONGlobalTrigger;
 class TString;
@@ -53,7 +53,7 @@ class AliMUONTriggerChamberEff : public TObject
     Int_t   fFirstRun; //!< First run to consider
     Int_t   fLastRun;  //!< Last run to consider
     AliRunLoader* fRunLoader; //!< AliRunLoader pointer
-    AliMUONRecData*  fData; //!< AliMUONData pointer (to access containers)
+    AliMUONData*  fData; //!< AliMUONData pointer (to access containers)
     Bool_t fReproduceTrigResponse;//!< Reproduce trigger response
     Bool_t fPrintInfo;//!< Print informations on event
     AliMUON *fMUON; //!< AliMUON pointer
diff --git a/MUON/AliMUONTriggerCircuit.cxx b/MUON/AliMUONTriggerCircuit.cxx
index 55b763350f8..8475f164e50 100644
--- a/MUON/AliMUONTriggerCircuit.cxx
+++ b/MUON/AliMUONTriggerCircuit.cxx
@@ -24,6 +24,8 @@
 /// \author Philippe Crochet (LPCCFd)
 
 #include "AliMUONTriggerCircuit.h"
+#include "AliMUON.h"
+#include "AliMUONConstants.h"
 #include "AliMUONLocalTriggerBoard.h"
 #include "AliMUONTriggerCrateStore.h"
 #include "AliMUONTriggerCrate.h"
@@ -41,7 +43,6 @@
 #include "AliLog.h"
 
 #include 
-#include 
 
 /// \cond CLASSIMP
 ClassImp(AliMUONTriggerCircuit)
diff --git a/MUON/AliMUONTriggerCircuit.h b/MUON/AliMUONTriggerCircuit.h
index 7239dbb602b..e905075965a 100644
--- a/MUON/AliMUONTriggerCircuit.h
+++ b/MUON/AliMUONTriggerCircuit.h
@@ -6,7 +6,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 //
-/// \ingroup trigger
+/// \ingroup base
 /// \class AliMUONTriggerCircuit
 /// \brief MUON Trigger circuit
 ///
diff --git a/MUON/AliMUONTriggerCrate.h b/MUON/AliMUONTriggerCrate.h
index 43becc5b91e..3161947d474 100644
--- a/MUON/AliMUONTriggerCrate.h
+++ b/MUON/AliMUONTriggerCrate.h
@@ -5,7 +5,7 @@
 
 /* $Id$ */
 
-/// \ingroup trigger
+/// \ingroup sim
 /// \class AliMUONTriggerCrate
 /// \brief Trigger Crate
 ///
diff --git a/MUON/AliMUONTriggerCrateStore.h b/MUON/AliMUONTriggerCrateStore.h
index 0d8f1ab3fc6..3b7a06faf9c 100644
--- a/MUON/AliMUONTriggerCrateStore.h
+++ b/MUON/AliMUONTriggerCrateStore.h
@@ -6,7 +6,7 @@
 
 // $Id$
 
-/// \ingroup trigger
+/// \ingroup base
 /// \class AliMUONTriggerCrateStore
 /// \brief A container for AliMUONTriggerCrate objects.
 /// 
diff --git a/MUON/AliMUONTriggerElectronics.cxx b/MUON/AliMUONTriggerElectronics.cxx
index b8ec4431046..be3346f6e93 100644
--- a/MUON/AliMUONTriggerElectronics.cxx
+++ b/MUON/AliMUONTriggerElectronics.cxx
@@ -24,6 +24,7 @@
 #include "AliMUONTriggerElectronics.h"
 #include "AliMUONTriggerCrate.h"
 #include "AliMUONTriggerCrateStore.h"
+#include "AliMUONConstants.h"
 #include "AliMUONLocalTriggerBoard.h"
 #include "AliMUONRegionalTriggerBoard.h"
 #include "AliMUONGlobalTriggerBoard.h"
diff --git a/MUON/AliMUONVTrackReconstructor.cxx b/MUON/AliMUONVTrackReconstructor.cxx
index f615a2ca53f..50dd89ffec0 100644
--- a/MUON/AliMUONVTrackReconstructor.cxx
+++ b/MUON/AliMUONVTrackReconstructor.cxx
@@ -34,7 +34,7 @@
 ////////////////////////////////////
 
 #include "AliMUONVTrackReconstructor.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONConstants.h"
 #include "AliMUONHitForRec.h"
 #include "AliMUONObjectPair.h"
@@ -68,7 +68,7 @@ const Double_t AliMUONVTrackReconstructor::fgkDefaultNonBendingVertexDispersion
 const Double_t AliMUONVTrackReconstructor::fgkDefaultMaxNormChi2MatchTrigger = 16.0;
 
 //__________________________________________________________________________
-AliMUONVTrackReconstructor::AliMUONVTrackReconstructor(AliMUONRecData* data)
+AliMUONVTrackReconstructor::AliMUONVTrackReconstructor(AliMUONData* data)
   : TObject(),
     fMinBendingMomentum(fgkDefaultMinBendingMomentum),
     fMaxBendingMomentum(fgkDefaultMaxBendingMomentum),
diff --git a/MUON/AliMUONVTrackReconstructor.h b/MUON/AliMUONVTrackReconstructor.h
index 7daf14050f4..1d258cbf7e8 100644
--- a/MUON/AliMUONVTrackReconstructor.h
+++ b/MUON/AliMUONVTrackReconstructor.h
@@ -14,14 +14,14 @@
 #include 
 
 class TClonesArray;
-class AliMUONRecData;
+class AliMUONData;
 class AliMUONTriggerTrack;
 class AliMUONTrackHitPattern;
 
 class AliMUONVTrackReconstructor : public TObject {
 
  public:
-  AliMUONVTrackReconstructor(AliMUONRecData* data); // default Constructor
+  AliMUONVTrackReconstructor(AliMUONData* data); // default Constructor
   virtual ~AliMUONVTrackReconstructor(); // Destructor
 
   // Parameters for track reconstruction: public methods
@@ -48,9 +48,9 @@ class AliMUONVTrackReconstructor : public TObject {
   void EventDumpTrigger(void);  // dump reconstructed trigger event
   
           /// Return MUON data
-  AliMUONRecData*  GetMUONData() {return fMUONData;}
+  AliMUONData*  GetMUONData() {return fMUONData;}
           /// Set MUON data
-  void SetMUONData(AliMUONRecData* data) {fMUONData = data;}
+  void SetMUONData(AliMUONData* data) {fMUONData = data;}
 
           /// Set trigger circuit
   void SetTriggerCircuit(TClonesArray* circuit) {fTriggerCircuit = circuit;}
@@ -86,7 +86,7 @@ class AliMUONVTrackReconstructor : public TObject {
   Int_t fNRecTracks; ///< number of reconstructed tracks
 
   // data container
-  AliMUONRecData* fMUONData; ///< Data container for MUON subsystem 
+  AliMUONData* fMUONData; ///< Data container for MUON subsystem 
 
   // Functions
   AliMUONVTrackReconstructor (const AliMUONVTrackReconstructor& rhs); ///< copy constructor
diff --git a/MUON/AliMUONv1.h b/MUON/AliMUONv1.h
index 5d71d1ec472..adaef52ebf8 100644
--- a/MUON/AliMUONv1.h
+++ b/MUON/AliMUONv1.h
@@ -6,7 +6,7 @@
 /* $Id$ */
 // Revision of includes 07/05/2004
 
-/// \ingroup sim
+/// \ingroup base
 /// \class AliMUONv1
 /// \brief AliDetector class for MUON subsystem which implements
 /// functions for simulation 
diff --git a/MUON/AlirootRun_MUONtest.sh b/MUON/AlirootRun_MUONtest.sh
index b3b74d3ee20..e2ffec3bb36 100755
--- a/MUON/AlirootRun_MUONtest.sh
+++ b/MUON/AlirootRun_MUONtest.sh
@@ -1,6 +1,5 @@
 #!/bin/sh
 # $Id$
-# with galice.root, galice_sim.root 
 
 CURDIR=`pwd`
 OUTDIR=test_out
@@ -27,7 +26,6 @@ gRandom->SetSeed($SEED);
 AliCDBManager::Instance()->SetRun($RUN);
 AliSimulation MuonSim("$ALICE_ROOT/MUON/Config.C");
 MuonSim.SetMakeTrigger("MUON");
-// MuonSim.SetWriteRawData("MUON","raw.root");
 MuonSim.SetWriteRawData("MUON");
 MuonSim.Run($NEVENTS);
 .q
@@ -36,7 +34,6 @@ EOF
 echo "Removing Digits files ..."
 mkdir MUON.Digits
 mv MUON.Digits*.root MUON.Digits/ 
-mv galice.root MUON.Digits/ 
 
 echo "Running reconstruction  ..."
 
@@ -52,7 +49,6 @@ MuonRec.SetRunLocalReconstruction("MUON");
 MuonRec.SetRunTracking("MUON");
 MuonRec.SetFillESD("MUON");
 MuonRec.SetLoadAlignData("MUON");
-MuonRec.SetNumberOfEventsPerFile($NEVENTS);
 // Uncoment following line to run reconstruction with the orginal tracking method
 // instead of the kalman one (default)
 //MuonRec.SetOption("MUON","Original");
@@ -73,12 +69,11 @@ if [ ! -e MUON.Digits.root ]; then
     echo "Moving Digits files back ..."
     mv MUON.Digits/MUON.Digits.root .
 fi 
-mv MUON.Digits/galice.root ./galice_sim.root 
 
 echo "Running Trigger efficiency  ..."
 aliroot -b >& testTriggerResults.out << EOF
 .L $ALICE_ROOT/MUON/MUONTriggerEfficiency.C+
-MUONTriggerEfficiency("galice_sim.root", "galice.root", 1);
+MUONTriggerEfficiency("galice.root",1);
 .q
 EOF
 
@@ -87,7 +82,7 @@ echo "Running efficiency  ..."
 aliroot -b >& testResults.out << EOF
 .L $ALICE_ROOT/MUON/MUONefficiency.C+
 // no argument assumes Upsilon but MUONefficiency(443) works on Jpsi
-MUONefficiency("galice_sim.root");
+MUONefficiency();
 .q
 EOF
 
@@ -96,23 +91,20 @@ echo "Running check ..."
 aliroot -b >& testCheck.out << EOF
 gSystem->Load("libMUONevaluation");
 .L $ALICE_ROOT/MUON/MUONCheck.C+
-MUONCheck(0, 9, "galice_sim.root", "galice.root", "AliESDs.root"); 
+MUONCheck(0, 9, "galice.root","AliESDs.root"); 
 .q
 EOF
 
 echo "Running dumps for selected event (5) ..."
 
-aliroot -b  << EOF
-AliMUONSimData simData("galice_sim.root");
-simData.DumpKine(5);       > dump.kine
-simData.DumpHits(5);       > dump.hits
-simData.DumpDigits(5);     > dump.digits
-simData.DumpSDigits(5);    > dump.sdigits
-
-AliMUONRecData recData("galice.root");
-recData.DumpRecPoints(5);  > dump.recpoints
-recData.DumpTracks(5);     > dump.tracks
-recData.DumpRecTrigger(5); > dump.rectrigger
+aliroot -b << EOF
+AliMUONData data("galice.root");
+data.DumpKine(5);       > dump.kine
+data.DumpHits(5);       > dump.hits
+data.DumpDigits(5);     > dump.digits
+data.DumpSDigits(5);    > dump.sdigits
+data.DumpRecPoints(5);  > dump.recpoints
+data.DumpRecTrigger(5); > dump.rectrigger
 .q
 EOF
 
diff --git a/MUON/DecodeRecoCocktail.C b/MUON/DecodeRecoCocktail.C
index 3c5f6aa63be..b47557b6725 100644
--- a/MUON/DecodeRecoCocktail.C
+++ b/MUON/DecodeRecoCocktail.C
@@ -100,16 +100,15 @@ void DecodeRecoCocktail(char* dirname=".", char* outFileName = "MuonLight.root",
   // set the magnetic field for track extrapolations
   AliMUONTrackExtrap::SetField(AliTracker::GetFieldMap());
 
-  AliMUONRecoCheck *rc = new AliMUONRecoCheck("galice.root", "galice_sim.root");
+  AliMUONRecoCheck *rc = new AliMUONRecoCheck("galice.root");
   AliRunLoader *runLoader = rc->GetRunLoader();
-  AliRunLoader *runLoaderSim = rc->GetRunLoaderSim();
   
-  runLoaderSim->LoadKinematics("READ");
-  Int_t nev = runLoaderSim->GetNumberOfEvents(); 
+  runLoader->LoadKinematics("READ");
+  Int_t nev = runLoader->GetNumberOfEvents(); 
 //   nevent = nevent +nev;  
 //     printf(" number of files and events = %d - %d \n",irun,nevent);
     
-  AliITSLoader* ITSloader =  (AliITSLoader*) runLoaderSim->GetLoader("ITSLoader");
+  AliITSLoader* ITSloader =  (AliITSLoader*) runLoader->GetLoader("ITSLoader");
   AliITSVertexerPPZ *dovert = 0; 
   if (ITSloader) { 
     dovert = new AliITSVertexerPPZ("default",0,0);
@@ -122,15 +121,14 @@ void DecodeRecoCocktail(char* dirname=".", char* outFileName = "MuonLight.root",
   TLorentzVector v; 
   
   for(Int_t ievent = 0; ievent < nev; ievent++){ // loop over events 
-    runLoaderSim->GetHeader();
+    runLoader->GetHeader();
     if (ITSloader) { 
       vert = dovert->FindVertexForCurrentEvent(ievent);
     }
-    //printf ("Event %d of %d\n",ievent,nev);
+    // printf ("Event %d of %d\n",ievent,nev);
     muonArray->Clear();     // clean muon and dimuon arrays 
     dimuonArray->Clear(); 
     runLoader->GetEvent(ievent);
-    runLoaderSim->GetEvent(ievent);
     treeESD->GetEvent(ievent);
     rc->ResetTracks();
     rc->MakeTrackRef(); // make reconstructable tracks
@@ -145,16 +143,15 @@ void DecodeRecoCocktail(char* dirname=".", char* outFileName = "MuonLight.root",
       // assign parameters concerning the reconstructed tracks
       AliMUONTrackLight muLight;
       AliMUONTrack *trackReco = (AliMUONTrack *)trackRecoArray->At(itrRec);
-      
       muLight.FillFromESD(esd->GetMuonTrack(itrRec));
       // 	muLight.FillFromAliMUONTrack(trackReco);
       
       // find the reference track and store further information	
-      TParticle *part = muLight.FindRefTrack(trackReco,trackRefArray,runLoaderSim); 
+      TParticle *part = muLight.FindRefTrack(trackReco,trackRefArray,runLoader); 
       if (part) { 
 	v.SetPxPyPzE(part->Px(), part->Py(), part->Pz(), part->Energy());
 	muLight.SetPGen(v); 
-	muLight.FillMuonHistory(runLoaderSim, part);
+	muLight.FillMuonHistory(runLoader, part);
 	// 	  muLight.PrintInfo("A");
 	//store the referenced track in the muonArray:
 	TClonesArray &muons = *muonArray;
diff --git a/MUON/Doxyfile b/MUON/Doxyfile
index 56655554c32..4d9fd1b7335 100644
--- a/MUON/Doxyfile
+++ b/MUON/Doxyfile
@@ -474,7 +474,7 @@ EXAMPLE_RECURSIVE      = NO
 # directories that contain image that are included in the documentation (see 
 # the \image command).
 
-IMAGE_PATH             = .
+IMAGE_PATH             = 
 
 # The INPUT_FILTER tag can be used to specify a program that doxygen should 
 # invoke to filter for each input file. Doxygen will invoke the filter program 
diff --git a/MUON/Doxymodules.h b/MUON/Doxymodules.h
index 240e64ba4d9..9aac92da28d 100644
--- a/MUON/Doxymodules.h
+++ b/MUON/Doxymodules.h
@@ -1,63 +1,54 @@
 // $Id$
 // The class categories definitions for Doxygen
 
-/** @defgroup MUON MUON
- *  \brief See library hierarchy too
- *  Category of MUON classes
- * \image html muon_libs.jpg
- *  @{
- */
-
-/** @defgroup mapping mapping
+/** @defgroup mapping MUON_mapping
  *  Category of mapping classes
- * \image html mapping_libs.jpg
- *  @ingroup MUON
  *  @{
  */
 
-/** @defgroup basic mp_basic
+/** @defgroup basic MUON_mapping_basic
  *  @ingroup mapping
  *  Category of basic classes in mapping
  *  @{
  */
 /** @} */
 
-/** @defgroup motif mp_motif
+/** @defgroup motif MUON_mapping_motif
  *  @ingroup mapping
  *  Category of motif classes in mapping
  *  @{
  */
 /** @} */
 
-/** @defgroup sector mp_sector
+/** @defgroup sector MUON_mapping_sector
  *  @ingroup mapping
  *  Category of classes for quadrants in mapping
  *  @{
  */
 /** @} */
 
-/** @defgroup slat mp_slat
+/** @defgroup slat MUON_mapping_slat
  *  @ingroup mapping
  *  Category of classes for slats in mapping
  *  @{
  */
 /** @} */
 
-/** @defgroup mptrigger mp_trigger
+/** @defgroup trigger MUON_mapping_trigger
  *  @ingroup mapping
  *  Category of classes for slats in mapping
  *  @{
  */
 /** @} */
 
-/** @defgroup management mp_management
+/** @defgroup management MUON_mapping_management
  *  @ingroup mapping
  *  Category of classes for management in mapping
  *  @{
  */
 /** @} */
 
-/** @defgroup graphics mp_graphics
+/** @defgroup graphics MUON_mapping_graphics
  *  @ingroup mapping
  *  Category of classes for visualization in mapping
  *  @{
@@ -66,70 +57,54 @@
 
 /** @} */
 
-/** @defgroup raw raw
- *  Category of classes for raw data
- *  @ingroup MUON
+/** @defgroup geometry MUON_geometry
+ *  Category of geometry framework classes
  *  @{
  */
 /** @} */
 
-/** @defgroup calib calib
- *  Category of basic classes for calibration
- *  @ingroup MUON
+/** @defgroup raw MUON_raw
+ *  Category of classes for raw data
  *  @{
  */
 /** @} */
 
-/** @defgroup geometry geometry
- *  Category of geometry framework classes
- *  @ingroup MUON
+/** @defgroup calib MUON_calib
+ *  Category of basic classes for calibration
  *  @{
  */
 /** @} */
 
-/** @defgroup trigger trigger
- *  Category of classes for trigger
- *  @ingroup MUON
+/** @defgroup shuttle MUON_shuttle
+ *  Category of classes for shuttle
  *  @{
  */
 /** @} */
 
-/** @defgroup base base
+/** @defgroup base MUON_base
  *  Category of basic classes
- *  @ingroup MUON
- *  @{
- */
-/** @} */
-
-/** @defgroup shuttle shuttle
- *  Category of classes for shuttle
- *  @ingroup MUON
  *  @{
  */
 /** @} */
 
-/** @defgroup sim sim
+/** @defgroup sim MUON_sim
  *  Category of classes for simulation
- *  @ingroup MUON
  *  @{
  */
 /** @} */
 
-/** @defgroup rec rec
+/** @defgroup rec MUON_rec
  *  Category of classes for reconstruction
- *  @ingroup MUON
  *  @{
  */
 /** @} */
 
-/** @defgroup evaluation evaluation
+/** @defgroup evaluation MUON_evaluation
  *  Category of classes for evaluation
- *  @ingroup MUON
  *  @{
  */
 /** @} */
 
-/** @} */
 
 
 
diff --git a/MUON/Doxymodules_STEER.h b/MUON/Doxymodules_STEER.h
index 86bca3f754f..daa6d8983d5 100644
--- a/MUON/Doxymodules_STEER.h
+++ b/MUON/Doxymodules_STEER.h
@@ -5,13 +5,7 @@
  *  Category of AliRoot steering classes
  *  @{
  */
-
-/** @defgroup STEER0 STEER0
- *  Category of AliRoot steering classes
- *  @ingroup STEER
- *  @{
- */
-// From STEERLinkDef.h revision 1.99
+// From STEERLinkDef.h revision 1.95
 
     class AliPDG {};
 
@@ -29,11 +23,7 @@
     class AliMagFC {};
     class AliMagFCM {};
     class AliMagFMaps {};
-    class AliMagFMapsV1 {};
     class AliMagFDM {};
-    class AliMagFCheb {};
-    class AliCheb3DCalc {};
-    class AliCheb3D {};
     class AliLego {};
     class AliLegoGenerator {};
     class AliLegoGeneratorXYZ {};
@@ -74,6 +64,8 @@
     class AliReconstruction {};
     class AliVertexGenFile {};
     class AliVertexer {};
+    class AliVertexerTracks {};
+    class AliStrLine {};
     class AliV0vertexer {};
     class AliCascadeVertexer {};
 
@@ -93,7 +85,6 @@
 
     class AliTrackFitter {};
     class AliTrackFitterRieman {};
-    class AliTrackFitterKalman {};
     class AliTrackFitterStraight {};
     class AliTrackResiduals {};
     class AliTrackResidualsChi2 {};
@@ -120,6 +111,7 @@
     class AliSignalProcesor {};
     class  AliHelix {};
     class  AliCluster {};
+    class  AliClusterTGeo {};
     class  AliTracker {};
     class  AliV0 {};
     class  AliKink {};
@@ -131,12 +123,11 @@
 
 /** @} */
 
-/** @defgroup ESD ESD
+/** @defgroup STEER_ESD STEER_ESD
  *  Category of AliRoot event sumary data classes
- *  @ingroup STEER
  *  @{
  */
-// From ESDLinkDef.h revision 1.32
+// From ESDLinkDef.h revision 1.29
 
     enum  AliLog::EType_t {};
 
@@ -159,8 +150,6 @@
 
     class  AliKalmanTrack {};
     class  AliExternalTrackParam {};
-    class  AliVertexerTracks {};
-    class  AliStrLine {};
     class  AliLog {};
     class  AliPID {};
     class  AliTrackPointArray {};
@@ -173,7 +162,6 @@
 
     class AliTagCreator {};
     class AliRunTagCuts {};
-    class AliLHCTagCuts {};
     class AliEventTagCuts {};
 
     class AliTrackPointArray {};
@@ -194,12 +182,11 @@
 
 /** @} */
 
-/** @defgroup CDB CDB
+/** @defgroup STEER_CDB STEER_CDB
  *  Category of AliRoot Conditions database classes
- *  @ingroup STEER
  *  @{
  */
-// From CDBLinkDef.h revision 1.9
+// From CDBLinkDef.h revision 1.5
 
     class AliCDBPath {};
     class AliCDBRunRange {};
@@ -221,8 +208,6 @@
     class AliCDBGridParam {};
 
     class AliDCSValue {};
-    class AliDCSSensor {};
-    class AliDCSSensorArray {};
 
     class AliPreprocessor {};
 
@@ -233,9 +218,8 @@
 
 /** @} */
 
-/** @defgroup AOD AOD
+/** @defgroup STEER_AOD STEER_AOD
  *  Category of AliRoot AOD classes
- *  @ingroup STEER
  *  @{
  */
 // From AODLinkDef.h revision 1.5
diff --git a/MUON/MUONCheck.C b/MUON/MUONCheck.C
index baf35c6f36e..5edf302c4e8 100644
--- a/MUON/MUONCheck.C
+++ b/MUON/MUONCheck.C
@@ -28,7 +28,6 @@
 #endif
 
 void MUONCheck(Int_t firstEvent, Int_t lastEvent,
-               TString fileNameSim="$ALICE_ROOT/MUON/test_out/galice_sim.root",
                TString fileName="$ALICE_ROOT/MUON/test_out/galice.root",
                TString esdsFileName="$ALICE_ROOT/MUON/test_out/AliESDs.root",
                TString outDir="$ALICE_ROOT/MUON/test_out/DataQualityControl")
@@ -36,7 +35,7 @@ void MUONCheck(Int_t firstEvent, Int_t lastEvent,
    gSystem->Load("libMUONevaluation");
 
    AliMUONCheck* check
-     = new AliMUONCheck(fileName.Data(), fileNameSim.Data(), esdsFileName.Data(),
+     = new AliMUONCheck(fileName.Data(), esdsFileName.Data(),
                         firstEvent, lastEvent, outDir.Data());
       
    check->CheckESD();
diff --git a/MUON/MUONRecoCheck.C b/MUON/MUONRecoCheck.C
index 2f2f6d2e451..db64db33132 100644
--- a/MUON/MUONRecoCheck.C
+++ b/MUON/MUONRecoCheck.C
@@ -27,21 +27,19 @@
 #include "AliStack.h"
 #include "AliRunLoader.h"
 #include "AliMagFMaps.h"
-#include "AliTracker.h"
 
 // MUON includes
+#include "AliMUON.h"
 #include "AliMUONConstants.h"
 #include "AliMUONTrack.h"
 #include "AliMUONRecoCheck.h"
 #include "AliMUONTrackParam.h"
 #include "AliMUONTrackExtrap.h"
-#include "AliMUONRecData.h"
-#include "AliMUONSimData.h"
+#include "AliTracker.h"
 
 Int_t TrackCheck( Bool_t *compTrack);
 
-void MUONRecoCheck (Int_t nEvent = 1, char* geoFilename = "geometry.root", 
-                    char * filenameSim="galice_sim.root", char * filename="galice.root"){
+void MUONRecoCheck (Int_t nEvent = 1, char* geoFilename = "geometry.root", char * filename="galice.root"){
 
   // Utility macro to check the muon reconstruction. Reconstructed tracks are compared
   // to reference tracks. The reference tracks are built from AliTrackReference for the
@@ -96,18 +94,15 @@ void MUONRecoCheck (Int_t nEvent = 1, char* geoFilename = "geometry.root",
   // set the magnetic field for track extrapolations
   AliMUONTrackExtrap::SetField(AliTracker::GetFieldMap());
 
-  AliRunLoader* runLoaderSim = AliRunLoader::Open(filenameSim, "MUONFolderSim", "read");
-  AliRunLoader* runLoader = AliRunLoader::Open(filename, "MUONFolder", "read");
+  AliRunLoader* runLoader = AliRunLoader::Open(filename,"read");
   AliLoader * MUONLoader = runLoader->GetLoader("MUONLoader");
-  AliLoader * MUONLoaderSim = runLoaderSim->GetLoader("MUONLoader");
-  AliMUONRecData * MUONData = new AliMUONRecData(MUONLoader,"MUON","MUON");
-  AliMUONSimData * MUONDataSim = new AliMUONSimData(MUONLoaderSim,"MUON","MUON");
+  AliMUONData * MUONData = new AliMUONData(MUONLoader,"MUON","MUON");
 
-  runLoaderSim->LoadKinematics("READ");
-  runLoaderSim->LoadTrackRefs("READ");
+  runLoader->LoadKinematics("READ");
+  runLoader->LoadTrackRefs("READ");
   MUONLoader->LoadTracks("READ");
   
-  AliMUONRecoCheck rc(runLoader, MUONData, runLoaderSim, MUONDataSim);
+  AliMUONRecoCheck rc(runLoader,MUONData);
     
   Int_t nevents = runLoader->GetNumberOfEvents();
   
@@ -120,9 +115,7 @@ void MUONRecoCheck (Int_t nEvent = 1, char* geoFilename = "geometry.root",
 
   for (ievent=0; ieventGetEvent(ievent);
     runLoader->GetEvent(ievent);
-
     rc.ResetTracks();
     rc.MakeTrackRef(); // make reconstructible tracks
 //     rc.PrintEvent();
@@ -173,7 +166,7 @@ void MUONRecoCheck (Int_t nEvent = 1, char* geoFilename = "geometry.root",
       if (testTrack == 4) {     // tracking requirements verified, track is found
 	nReconstructibleTracksCheck++;
 	hNHitComp->Fill(nHitOK);
-	particle = runLoaderSim->GetHeader()->Stack()->Particle(trackID);
+	particle = runLoader->GetHeader()->Stack()->Particle(trackID);
 // 	printf(" trackID: %d , PDG code: %d \n",trackID,particle->GetPdgCode());
 	trackParam = trackRef->GetTrackParamAtVertex();
 	x1 = trackParam->GetNonBendingCoor();
@@ -225,17 +218,15 @@ void MUONRecoCheck (Int_t nEvent = 1, char* geoFilename = "geometry.root",
 	       
       }
     } // end loop track ref.
-    
+
   } // end loop on event  
 
   MUONLoader->UnloadTracks();
-  runLoaderSim->UnloadKinematics();
+  runLoader->UnloadKinematics();
   runLoader->UnloadTrackRefs();
   delete runLoader;
-  delete runLoaderSim;
   delete field;
   delete MUONData;
-  delete MUONDataSim;
 
   printf(" nb of reconstructible tracks: %d \n", nReconstructibleTracks);
   printf(" nb of reconstructed tracks: %d \n", nReconstructedTracks);
diff --git a/MUON/MUONTrigger.C b/MUON/MUONTrigger.C
index 339dc307728..60297e67c46 100644
--- a/MUON/MUONTrigger.C
+++ b/MUON/MUONTrigger.C
@@ -31,7 +31,7 @@
 #include "AliCDBManager.h"
 #include 
 #endif
-void MUONTrigger(char * FileNameSim="galice_sim.root", char * FileName="galice.root")
+void MUONTrigger(char * FileName="galice.root")
 {
     // Creating Run Loader and openning file containing Digits 
     AliRunLoader * RunLoader = AliRunLoader::Open(FileName,"MUONLoader","UPDATE");
diff --git a/MUON/MUONTriggerEfficiency.C b/MUON/MUONTriggerEfficiency.C
index e16828ecf6d..660fc78bf18 100644
--- a/MUON/MUONTriggerEfficiency.C
+++ b/MUON/MUONTriggerEfficiency.C
@@ -41,8 +41,7 @@
 
 // MUON includes
 #include "AliMUON.h"
-#include "AliMUONSimData.h"
-#include "AliMUONRecData.h"
+#include "AliMUONData.h"
 #include "AliMUONHit.h"
 #include "AliMUONConstants.h"
 #include "AliMUONDigit.h"
@@ -55,9 +54,7 @@
 // Upsilon(1S)
 
 
-void MUONTriggerEfficiency (char filenameSim[10]="galice_sim.root", 
-                            char filenameRec[10]="galice.root",  
-                            Bool_t readFromRP = 0){
+void MUONTriggerEfficiency (char filename[10]="galice.root",  Bool_t readFromRP = 0){
  
 // output file
   char digitdat[100];
@@ -74,38 +71,28 @@ void MUONTriggerEfficiency (char filenameSim[10]="galice_sim.root",
  
 // Initialise AliRoot
    // Creating Run Loader and openning file containing Hits
-   AliRunLoader * RunLoaderSim = AliRunLoader::Open(filenameSim,"MUONFolderSim","READ");
+   AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
     
-   if (RunLoaderSim ==0x0) {
+   if (RunLoader ==0x0) {
        printf(">>> Error : Error Opening %s file \n",currentfile);
        return;
    }
              
-   AliRunLoader * RunLoaderRec = AliRunLoader::Open(filenameRec,"MUONFolder","READ");
-    
-   if (RunLoaderRec ==0x0) {
-       printf(">>> Error : Error Opening %s file \n",currentfile);
-       return;
-   }
-             
-   nevents = RunLoaderSim->GetNumberOfEvents();          
+   nevents = RunLoader->GetNumberOfEvents();          
      
  
-   AliLoader * MUONLoaderSim = RunLoaderSim->GetLoader("MUONLoader");
-   AliLoader * MUONLoaderRec = RunLoaderRec->GetLoader("MUONLoader");
-   
+   AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
    if (!readFromRP) {
        cout << " reading from digits \n";
-       MUONLoaderSim->LoadDigits("READ");
+       MUONLoader->LoadDigits("READ");
    } else {
        cout << " reading from RecPoints \n";
-       MUONLoaderRec->LoadRecPoints("READ");
+       MUONLoader->LoadRecPoints("READ");
    }
-   MUONLoaderSim->LoadHits("READ");
+   MUONLoader->LoadHits("READ");
    
-   // Creating MUON data containers
-   AliMUONSimData muondataSim(MUONLoaderSim,"MUON","MUON");
-   AliMUONRecData muondataRec(MUONLoaderRec,"MUON","MUON");
+   // Creating MUON data container
+   AliMUONData muondata(MUONLoader,"MUON","MUON");
 
    TClonesArray * globalTrigger;
    AliMUONGlobalTrigger * gloTrg; 
@@ -114,13 +101,12 @@ void MUONTriggerEfficiency (char filenameSim[10]="galice_sim.root",
    for (Int_t ievent=0; ieventGetEvent(ievent);
-       RunLoaderRec->GetEvent(ievent);
+       RunLoader->GetEvent(ievent);
          
      if (ievent%1000==0) printf("\t Event = %d\n",ievent);    
 
 // Hits
-     muondataSim.SetTreeAddress("H");    
+     muondata.SetTreeAddress("H");    
         
     Int_t itrack, ntracks, NbHits[2][4];
     Int_t SumNbHits;
@@ -129,16 +115,15 @@ void MUONTriggerEfficiency (char filenameSim[10]="galice_sim.root",
       NbHits[j][jj]=0;
      }
     } 
-    ntracks = (Int_t) muondataSim.GetNtracks();      
+    ntracks = (Int_t) muondata.GetNtracks();      
     for (itrack=0; itrackGetEntriesFast();   
+      nhits = (Int_t) muondata.Hits()->GetEntriesFast();   
       AliMUONHit* mHit;
       for(ihit=0; ihit(muondataSim.Hits()->At(ihit));
+        mHit = static_cast(muondata.Hits()->At(ihit));
         Int_t Nch        = mHit->Chamber(); 
         Int_t hittrack   = mHit->Track();
         Float_t IdPart     = mHit->Particle();
@@ -152,7 +137,7 @@ void MUONTriggerEfficiency (char filenameSim[10]="galice_sim.root",
         }
        }
        
-      muondataSim.ResetHits();
+      muondata.ResetHits();
       
     } // end track loop     
     
@@ -167,39 +152,35 @@ void MUONTriggerEfficiency (char filenameSim[10]="galice_sim.root",
            
 // Trigger
     if (!readFromRP) {
-	muondataSim.SetTreeAddress("D,GLT"); 
-	muondataSim.GetTriggerD();
-        globalTrigger = muondataSim.GlobalTrigger();
+	muondata.SetTreeAddress("D,GLT"); 
+	muondata.GetTriggerD();
     } else {    
-	muondataRec.SetTreeAddress("RC,TC"); 
-	muondataRec.GetTrigger();
-        globalTrigger = muondataRec.GlobalTrigger();
+	muondata.SetTreeAddress("RC,TC"); 
+	muondata.GetTrigger();
     }
    
+    globalTrigger = muondata.GlobalTrigger();
+
     Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1
 
     for (Int_t iglobal=0; iglobal(globalTrigger->At(iglobal));
-            
+      
        if (gloTrg->PairUnlikeLpt()>=1) muonlpt++;
        if (gloTrg->PairUnlikeHpt()>=1) muonhpt++;
                                
     } // end of loop on Global Trigger         
     
-    //if (!readFromRP) 
-      muondataSim.ResetTrigger();  
-    //else    
-      muondataRec.ResetTrigger();  
+    muondata.ResetTrigger();    
 
   } // end loop on event  
 
-   MUONLoaderSim->UnloadHits();
+   MUONLoader->UnloadHits();
 
   if (!readFromRP) {
-      MUONLoaderSim->UnloadDigits();  
+      MUONLoader->UnloadDigits();  
   } else {    
-      MUONLoaderRec->UnloadRecPoints();
+      MUONLoader->UnloadRecPoints();
   }  
  
   // calculate efficiency with as a ref. at least 3/4 planes fired
diff --git a/MUON/MUONTriggerEfficiencyPt.C b/MUON/MUONTriggerEfficiencyPt.C
index 74114e21349..8dd22c6535b 100644
--- a/MUON/MUONTriggerEfficiencyPt.C
+++ b/MUON/MUONTriggerEfficiencyPt.C
@@ -34,20 +34,26 @@
 #include "TStyle.h"
 #include "TCanvas.h"
 #include "TLegend.h"
-#include "Riostream.h"
+
 
 // STEER includes
 #include "AliRun.h"
+#include "AliDetector.h"
 #include "AliRunLoader.h"
 #include "AliHeader.h"
 #include "AliLoader.h"
 #include "AliStack.h"
+#include "AliSegmentation.h"
+#include "AliMC.h"
 
 // MUON includes
-#include "AliMUONSimData.h"
-#include "AliMUONRecData.h"
+#include "AliMUON.h"
+#include "AliMUONData.h"
 #include "AliMUONHit.h"
+#include "AliMUONChamber.h"
+#include "AliMUONConstants.h"
 #include "AliMUONDigit.h"
+#include "AliMUONRawCluster.h"
 #include "AliMUONGlobalTrigger.h"
 #include "AliMUONLocalTrigger.h"
 #include "AliMUONTrack.h"
@@ -65,9 +71,7 @@ Double_t fitArch(Double_t *x,Double_t *par)
   return h0*TMath::TanH(h1)+par[3];
 }
 
-void MUONTriggerEfficiencyPt(char filenameSim[10]="galice.root",  
-                             char filenameRec[10]="galice.root",
-                             Bool_t readFromRP = 0)
+void MUONTriggerEfficiencyPt(char filename[10]="galice.root",  Bool_t readFromRP = 0)
 {
 
 // define style
@@ -105,7 +109,6 @@ void MUONTriggerEfficiencyPt(char filenameSim[10]="galice.root",
     TParticle *particle;
     AliStack* stack; 
     
-    Int_t nevents;
     Double_t coincmuon=0;
     Double_t lptmuon=0;
     Double_t hptmuon=0;
@@ -113,59 +116,43 @@ void MUONTriggerEfficiencyPt(char filenameSim[10]="galice.root",
 
 // output file
     char digitdat[100];
-    char currentfile[100];
     sprintf(digitdat,"MUONTriggerEfficiencyPt.out");  
     FILE *fdat=fopen(digitdat,"w");
-    
-// Initialise AliRoot
+
 // Creating Run Loader and openning file containing Hits
-    AliRunLoader * RunLoaderSim = AliRunLoader::Open(filenameSim,"MUONFolderSim","READ");
-    
-    if (RunLoaderSim ==0x0) {
-	printf(">>> Error : Error Opening %s file \n",currentfile);
-	return;
-    }
+    AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
     
-    AliRunLoader * RunLoaderRec = AliRunLoader::Open(filenameRec,"MUONFolder","READ");
-    
-    if (RunLoaderRec ==0x0) {
-	printf(">>> Error : Error Opening %s file \n",currentfile);
+    if (RunLoader ==0x0) {
+	printf(">>> Error : Error Opening %s file \n",filename);
 	return;
     }
     
-    nevents = RunLoaderSim->GetNumberOfEvents();
+    Int_t nevents = RunLoader->GetNumberOfEvents();
     
-    AliLoader * MUONLoaderSim = RunLoaderSim->GetLoader("MUONLoader");
-    AliLoader * MUONLoaderRec = RunLoaderRec->GetLoader("MUONLoader");
+// loading hits
+    AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");     
+    MUONLoader->LoadHits("READ");
+    AliMUONData data_hits(MUONLoader,"MUON","MUON");
     
-    if (!readFromRP) {
-	cout << " reading from digits \n";
-	MUONLoaderSim->LoadDigits("READ");
-    } else {
-	cout << " reading from RecPoints \n";
-	MUONLoaderRec->LoadRecPoints("READ");
-   }
-    MUONLoaderSim->LoadHits("READ");
-    RunLoaderSim->LoadKinematics("READ");
-
-
-// Creating MUON data containers
-    AliMUONSimData muondataSim(MUONLoaderSim,"MUON","MUON");
-    AliMUONRecData muondataRec(MUONLoaderRec,"MUON","MUON");
-
     TClonesArray * globalTrigger;
     AliMUONGlobalTrigger * gloTrg;
 
+// loading trigger
+    MUONLoader->LoadDigits("READ");  
+    AliMUONData muondata(MUONLoader,"MUON","MUON");
+
+// Loading kine
+    RunLoader->LoadKinematics("READ");
+    
     for (Int_t ievent=0; ieventGetEvent(ievent);
-	RunLoaderRec->GetEvent(ievent);
+	RunLoader->GetEvent(ievent);
 	
 	if (ievent%500==0) printf("ievent = %d \n",ievent);
 
 // kine
 	Int_t iparticle, nparticles;
-	stack = RunLoaderSim->Stack();
+	stack = RunLoader->Stack();
 	nparticles = (Int_t) stack->GetNtrack();        
 	for (iparticle=0; iparticleParticle(iparticle);   
@@ -176,15 +163,14 @@ void MUONTriggerEfficiencyPt(char filenameSim[10]="galice.root",
 
 // trigger 
 	if (!readFromRP) {
-	    muondataSim.SetTreeAddress("D,GLT"); 
-	    muondataSim.GetTriggerD();
-	    globalTrigger = muondataSim.GlobalTrigger();
+	    muondata.SetTreeAddress("D,GLT"); 
+	    muondata.GetTriggerD();
 	} else {    
-	    muondataRec.SetTreeAddress("RC,TC"); 
-	    muondataRec.GetTrigger();
-	    globalTrigger = muondataRec.GlobalTrigger();
-
+	    muondata.SetTreeAddress("RC,TC"); 
+	    muondata.GetTrigger();
 	}
+    
+        globalTrigger = muondata.GlobalTrigger();
 
         Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1 
         for (Int_t iglobal=0; iglobalFill(ptmu);
 	    }
         } // end of loop on Global Trigger      
-        muondataSim.ResetTrigger();  
-        muondataRec.ResetTrigger();  
+        muondata.ResetTrigger();  
 
 // Hits
-	muondataSim.SetTreeAddress("H");    
-
+        RunLoader->GetEvent(ievent);  
+        data_hits.SetTreeAddress("H");    
+        
         Int_t itrack, ntracks, NbHits[4];
         Int_t SumNbHits;
 
         for (Int_t j=0; j<4; j++) NbHits[j]=0;
  
-	ntracks = (Int_t) muondataSim.GetNtracks();
-   
+        ntracks = (Int_t) data_hits.GetNtracks();      
+     
         for (itrack=0; itrackGetEntriesFast();
+         nhits = (Int_t) data_hits.Hits()->GetEntriesFast();   
          AliMUONHit* mHit;
+
     
           for (ihit=0; ihit(muondataSim.Hits()->At(ihit));
+            mHit = static_cast(data_hits.Hits()->At(ihit));
             Int_t Nch        = mHit->Chamber(); 
             Int_t hittrack   = mHit->Track();
             Float_t IdPart   = mHit->Particle();	    
@@ -232,7 +219,7 @@ void MUONTriggerEfficiencyPt(char filenameSim[10]="galice.root",
 		}               
             }    
           }
-	  muondataSim.ResetHits();
+          data_hits.ResetHits();
         } // end track loop
 
 // 3/4 coincidence 
@@ -243,25 +230,19 @@ void MUONTriggerEfficiencyPt(char filenameSim[10]="galice.root",
             ptcoinc->Fill(ptmu);
         }            
                 
-    } // end loop on event
-    
-    if (coincmuon==0) {
-	cout << " >>>  coincmuon = 0 after event loop " << "\n";
-	cout << " >>> this probably means that input does not contain one (and only one) " << "\n";
-        cout << " >>> muon track per event as it should " << "\n";
-	cout << " >>> see README for further information " << "\n";
-	cout << " >>> exiting now ! " << "\n";
-	return;
-    }
-
+      } // end loop on event
       
-       MUONLoaderSim->UnloadHits();
-       if (!readFromRP) {
-	   MUONLoaderSim->UnloadDigits();  
-       } else {    
-	   MUONLoaderRec->UnloadRecPoints();
-       }
-       RunLoaderSim->UnloadKinematics();
+      MUONLoader->UnloadHits();
+      if (!readFromRP) {
+	  muondata.SetTreeAddress("D,GLT"); 
+	  muondata.GetTriggerD();
+      } else {    
+	  muondata.SetTreeAddress("RC,TC"); 
+	  muondata.GetTrigger();
+      }
+      RunLoader->UnloadKinematics();   
+
+      delete RunLoader;
      
       fprintf(fdat,"\n");    
       fprintf(fdat,"\n");
@@ -309,7 +290,8 @@ void MUONTriggerEfficiencyPt(char filenameSim[10]="galice.root",
 	      pthpt->SetBinContent(i+1,0.);
 	      pthpt->SetBinError(i+1,0.);     
 	  }              
-      }      
+      }
+      
       
       TF1 *fitlpt = new TF1("fitlpt",fitArc,0.,5.,4); 
       TF1 *fithpt = new TF1("fithpt",fitArc,0.,5.,4);      
diff --git a/MUON/MUONbaseLinkDef.h b/MUON/MUONbaseLinkDef.h
index 4cfd4bafe76..f3f8fb5c84a 100644
--- a/MUON/MUONbaseLinkDef.h
+++ b/MUON/MUONbaseLinkDef.h
@@ -1,13 +1,11 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
+#pragma link C++ class AliMUON+; 
+#pragma link C++ class AliMUONv1+; 
+
 // segmentation (change in progress)
 #pragma link C++ class AliMUONSegFactory+;
 #pragma link C++ class AliMUONSt12QuadrantSegmentation+; 
@@ -19,24 +17,33 @@
 
 // info classes 
 #pragma link C++ class AliMUONConstants+; 
+#pragma link C++ class AliMUONDataInterface+; 
+#pragma link C++ class AliMUONLoader+; 
+#pragma link C++ class AliMUONChamber+; 
+#pragma link C++ class AliMUONChamberTrigger+; 
+#pragma link C++ class AliMUONTriggerCircuit+; 
+#pragma link C++ class AliMUONTriggerCrateStore+; 
 #pragma link C++ class AliMUONLogger+;
 
 // containers
 #pragma link C++ class AliMUONData+; 
 #pragma link C++ class AliMUONDataIterator+; 
 #pragma link C++ class AliMUONDataDigitIterator+; 
+#pragma link C++ class AliMUONPoints+; 
+#pragma link C++ class AliMUONHit+; 
 #pragma link C++ class AliMUONRawCluster+;
 #pragma link C++ class AliMUONDigit+; 
-#pragma link C++ class AliMUONHitMapA1+; 
+#pragma link C++ class AliMUONGlobalTrigger+; 
+#pragma link C++ class AliMUONRegionalTrigger+; 
+#pragma link C++ class AliMUONLocalTrigger+; 
+#pragma link C++ class AliMUONTriggerChamberEff+;
 
 // raw data
 #pragma link C++ class AliMUONDigitMaker+;
-#pragma link C++ class AliMUONRawWriter+;
 
 // calibration access
 #pragma link C++ class AliMUONCalibrationData+;
 #pragma link C++ class AliMUONCDB+;
-#pragma link C++ class AliMUONHVNamer+;
 
 #endif
 
diff --git a/MUON/MUONcalibLinkDef.h b/MUON/MUONcalibLinkDef.h
index 6de8d2ddb56..462d9eaea52 100644
--- a/MUON/MUONcalibLinkDef.h
+++ b/MUON/MUONcalibLinkDef.h
@@ -1,8 +1,3 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 #pragma link off all globals;
 #pragma link off all classes;
diff --git a/MUON/MUONdisplay.C b/MUON/MUONdisplay.C
index bfd8cb167b7..4b219f4c358 100644
--- a/MUON/MUONdisplay.C
+++ b/MUON/MUONdisplay.C
@@ -35,47 +35,36 @@
 
 
 
-void MUONdisplay (Int_t nevent=0, 
-                  TString fileName="galice.root",
-                  TString fileNameSim="galice_sim.root") {
+void MUONdisplay (Int_t nevent=0, TString fileName="galice.root") {
 
   // set off mag field 
   AliMagF::SetReadField(kFALSE);
  
   // Getting runloader 
-  AliRunLoader * RunLoaderSim = AliRunLoader::Open(fileNameSim.Data(),"MUONFolderSim","READ");
-  if (RunLoaderSim == 0x0) {
+  AliRunLoader * RunLoader = AliRunLoader::Open(fileName.Data(),"MUONFolder","READ");
+  if (RunLoader == 0x0) {
     Error("MUONdisplay","Inut file %s error!",fileName.Data());
     return;   
   }
-  RunLoaderSim->LoadHeader();
-  RunLoaderSim->LoadKinematics("READ");
+  RunLoader->LoadHeader();
+  RunLoader->LoadKinematics("READ");
 
   //  if (RunLoader->GetAliRun() == 0x0) 
-  RunLoaderSim->LoadgAlice();
-  gAlice = RunLoaderSim->GetAliRun();
+  RunLoader->LoadgAlice();
+  gAlice = RunLoader->GetAliRun();
 
   // Getting MUONloader 
-  AliLoader * MUONLoaderSim  = RunLoaderSim->GetLoader("MUONLoader");
-  MUONLoaderSim->LoadHits("READ");
-  MUONLoaderSim->LoadDigits("READ");
-  
-  // Getting runloader 
-  AliRunLoader * RunLoaderRec = AliRunLoader::Open(fileName.Data(),"MUONFolder","READ");
-  if (RunLoaderRec == 0x0) {
-    Error("MUONdisplay","Inut file %s error!",fileName.Data());
-    return;   
-  }
-  AliLoader * MUONLoaderRec  = RunLoaderRec->GetLoader("MUONLoader");
-  MUONLoaderRec->LoadRecPoints("READ");
-  MUONLoaderRec->LoadTracks("READ");
+  AliLoader * MUONLoader  = RunLoader->GetLoader("MUONLoader");
+  MUONLoader->LoadHits("READ");
+  MUONLoader->LoadDigits("READ");
+  MUONLoader->LoadRecPoints("READ");
+  MUONLoader->LoadTracks("READ");
 
 
   // Create Event Display object
-  AliMUONDisplay *muondisplay = new AliMUONDisplay(750, MUONLoaderSim, MUONLoaderRec);
+  AliMUONDisplay *muondisplay = new AliMUONDisplay(750, MUONLoader);
 
   // Display first event
-  RunLoaderSim->GetEvent(nevent);
-  RunLoaderRec->GetEvent(nevent);
+  RunLoader->GetEvent(nevent);
   muondisplay->ShowNextEvent(0);
 }
diff --git a/MUON/MUONefficiency.C b/MUON/MUONefficiency.C
index 21c3e50d7df..609b1ac1b59 100644
--- a/MUON/MUONefficiency.C
+++ b/MUON/MUONefficiency.C
@@ -77,8 +77,8 @@
 //   ResType (default 553)
 //      553 for Upsilon, anything else for J/Psi
 
-Bool_t MUONefficiency( char* filename = "galice.root", char* geoFilename = "geometry.root", char* esdFileName = "AliESDs.root",
-                       Int_t ExtrapToVertex = -1, Int_t ResType = 553, Int_t FirstEvent = 0, Int_t LastEvent = 1000000 )
+Bool_t MUONefficiency( Int_t ExtrapToVertex = -1, Int_t ResType = 553, Int_t FirstEvent = 0, Int_t LastEvent = 1000000,
+		       char* geoFilename = "geometry.root", char* esdFileName = "AliESDs.root", char* filename = "galice.root")
 { // MUONefficiency starts
 
   Double_t MUON_MASS = 0.105658369;
diff --git a/MUON/MUONevaluationLinkDef.h b/MUON/MUONevaluationLinkDef.h
index 20778336f3c..4d979446e6c 100644
--- a/MUON/MUONevaluationLinkDef.h
+++ b/MUON/MUONevaluationLinkDef.h
@@ -1,8 +1,3 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 #pragma link off all globals;
 #pragma link off all classes;
@@ -11,10 +6,6 @@
 #pragma link C++ class AliMUONPairLight+;
 #pragma link C++ class AliMUONTrackLight+;
 #pragma link C++ class AliMUONCheck+;
-#pragma link C++ class AliMUONRecoCheck+;
-#pragma link C++ class AliMUONPoints+;
-#pragma link C++ class AliMUONDisplay+;
-#pragma link C++ class AliMUONDataInterface+;
 
 #endif
 
diff --git a/MUON/MUONgeometryLinkDef.h b/MUON/MUONgeometryLinkDef.h
index bb6a572f9c1..366524f9bb4 100644
--- a/MUON/MUONgeometryLinkDef.h
+++ b/MUON/MUONgeometryLinkDef.h
@@ -1,8 +1,3 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
diff --git a/MUON/MUONmappingLinkDef.h b/MUON/MUONmappingLinkDef.h
index 5de701de107..ca30826389c 100644
--- a/MUON/MUONmappingLinkDef.h
+++ b/MUON/MUONmappingLinkDef.h
@@ -1,7 +1,6 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-// $Id $
 // $MpId: basicLinkDefIn.h,v 1.8 2006/01/11 10:09:18 ivana Exp $ 
 
 #pragma link C++ nestedclasses;
@@ -111,8 +110,6 @@
 #pragma link C++ class  AliMpDEIterator+;
 #pragma link C++ class  AliMpDEManager+;
 #pragma link C++ class  AliMpBusPatch+;
-#pragma link C++ class  AliMpTriggerCrate+;
-#pragma link C++ class  AliMpLocalBoard+;
 #pragma link C++ class  AliMpDDL+;
 #pragma link C++ class  AliMpDDLStore+;
 
diff --git a/MUON/MUONmassPlot_ESD.C b/MUON/MUONmassPlot_ESD.C
index e2a5979954d..830d86537ce 100644
--- a/MUON/MUONmassPlot_ESD.C
+++ b/MUON/MUONmassPlot_ESD.C
@@ -63,7 +63,7 @@
 
 // Add parameters and histograms for analysis 
 
-Bool_t MUONmassPlot(char* filename = "galice_sim.root", Int_t ExtrapToVertex = -1, char* geoFilename = "geometry.root", 
+Bool_t MUONmassPlot(Int_t ExtrapToVertex = -1, char* geoFilename = "geometry.root", char* filename = "galice.root",
 		  Int_t FirstEvent = 0, Int_t LastEvent = 10000, char* esdFileName = "AliESDs.root", Int_t ResType = 553, 
                   Float_t Chi2Cut = 100., Float_t PtCutMin = 1., Float_t PtCutMax = 10000.,
                   Float_t massMin = 9.17,Float_t massMax = 9.77)
@@ -152,13 +152,12 @@ Bool_t MUONmassPlot(char* filename = "galice_sim.root", Int_t ExtrapToVertex = -
     Error("MUONmass_ESD", "getting run loader from file %s failed", filename);
     return kFALSE;
   }
-/*  
-  runLoader->LoadgAlice();
+
   if (!gAlice) {
     Error("MUONmass_ESD", "no galice object found");
     return kFALSE;
   }
-*/  
+  
 
   // open the ESD file
   TFile* esdFile = TFile::Open(esdFileName);
diff --git a/MUON/MUONplotefficiency.C b/MUON/MUONplotefficiency.C
index ae4727ea221..ccfd2f021f0 100644
--- a/MUON/MUONplotefficiency.C
+++ b/MUON/MUONplotefficiency.C
@@ -83,10 +83,10 @@ Int_t MUONplotefficiency(Int_t ResType = 553, Int_t fittype = 1){
   Int_t SAVE=1;
   Int_t WRITE=1;
   
-  //Double_t MUON_MASS = 0.105658369;
+  Double_t MUON_MASS = 0.105658369;
   Double_t UPSILON_MASS = 9.4603 ;
   Double_t JPSI_MASS = 3.096916;
-  //Double_t PI = 3.14159265358979312; 
+  Double_t PI = 3.14159265358979312; 
   Double_t RESONANCE_MASS = 0.; 
 
   if (ResType==553)  
@@ -156,10 +156,10 @@ Int_t MUONplotefficiency(Int_t ResType = 553, Int_t fittype = 1){
   // Histograms limits and binning
   Float_t ptmin = 0.0;      Float_t ptmax =  20.0;     Int_t ptbins = 10; 
   Float_t ymin = -4.5;       Float_t ymax =  -2.;       Int_t ybins = 10;
-  // Float_t thetamin = 165.;  Float_t thetamax = 180.;   Int_t thetabins = 100;  
+  Float_t thetamin = 165.;  Float_t thetamax = 180.;   Int_t thetabins = 100;  
   
-  // Float_t etacutmin = -4.04813 ;
-  // Float_t etacutmax = -2.54209 ;
+  Float_t etacutmin = -4.04813 ;
+  Float_t etacutmax = -2.54209 ;
 
   Float_t invMassMin = .0 ;   Float_t invMassMax = 15.0 ;   Int_t   invMassBins = 100 ;
 
@@ -175,8 +175,8 @@ Int_t MUONplotefficiency(Int_t ResType = 553, Int_t fittype = 1){
   /*********************************/
   // Values used to define the acceptance
   //
-  // Float_t thetacutmin = 171.0;  
-  // Float_t thetacutmax = 178.;
+  Float_t thetacutmin = 171.0;  
+  Float_t thetacutmax = 178.;
   
   Float_t ptcutmin = 0.;
   Float_t ptcutmax = 20.;
@@ -613,8 +613,8 @@ Int_t MUONplotefficiency(Int_t ResType = 553, Int_t fittype = 1){
   /*******************************************/
 
 
-  // Float_t triggerChi2Min = 0.; 
-  // Float_t triggerChi2Max = 7.5;
+  Float_t triggerChi2Min = 0.; 
+  Float_t triggerChi2Max = 7.5;
 
   //TString m1Rec(BckgdCutResonanceESD);
   //TString m2Rec(ResonanceAccCutESD);
@@ -753,7 +753,7 @@ Int_t MUONplotefficiency(Int_t ResType = 553, Int_t fittype = 1){
   Char_t  theCut[100];
   
   
-  TF1 *fitFunc = 0;  
+  TF1 *fitFunc ;  
   TString FitFuncName;
 
   if (fitfunc==0 || fitfunc==1){
diff --git a/MUON/MUONrawLinkDef.h b/MUON/MUONrawLinkDef.h
index f8ba8c21a4c..4698e825b5a 100644
--- a/MUON/MUONrawLinkDef.h
+++ b/MUON/MUONrawLinkDef.h
@@ -1,8 +1,3 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 #pragma link off all globals;
 #pragma link off all classes;
diff --git a/MUON/MUONrecLinkDef.h b/MUON/MUONrecLinkDef.h
index 7722f47ff53..84ef5007a99 100644
--- a/MUON/MUONrecLinkDef.h
+++ b/MUON/MUONrecLinkDef.h
@@ -1,16 +1,9 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
 // reconstruction
-#pragma link C++ class AliMUONRecData+; 
-#pragma link C++ class AliMUONRecLoader+; 
 #pragma link C++ class AliMUONClusterReconstructor+; 
 #pragma link C++ class AliMUONClusterFinderVS+; 
 #pragma link C++ class AliMUONClusterFinderAZ+; 
@@ -46,7 +39,14 @@
 
 // calibration
 #pragma link C++ class AliMUONDigitCalibrator+;
+#pragma link C++ class AliMUONHVNamer+;
 #pragma link C++ class AliMUONPadStatusMaker+;
 #pragma link C++ class AliMUONPadStatusMapMaker+;
 
+// display
+#pragma link C++ class AliMUONDisplay+; 
+#pragma link C++ class AliMUONRecoCheck+;
+
 #endif
+
+
diff --git a/MUON/MUONshuttleLinkDef.h b/MUON/MUONshuttleLinkDef.h
index 5b67be3af80..c505415aaad 100644
--- a/MUON/MUONshuttleLinkDef.h
+++ b/MUON/MUONshuttleLinkDef.h
@@ -1,8 +1,3 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 
 #pragma link C++ class AliMUONPreprocessor+;
diff --git a/MUON/MUONsimLinkDef.h b/MUON/MUONsimLinkDef.h
index 66e802190ff..82609f08b1d 100644
--- a/MUON/MUONsimLinkDef.h
+++ b/MUON/MUONsimLinkDef.h
@@ -1,20 +1,8 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id $
-
 #ifdef __CINT__
 #pragma link off all globals;
 #pragma link off all classes;
 #pragma link off all functions;
 
-
-#pragma link C++ class AliMUON+; 
-#pragma link C++ class AliMUONv1+; 
-#pragma link C++ class AliMUONSimLoader+; 
-#pragma link C++ class AliMUONSimData+; 
-#pragma link C++ class AliMUONHit+; 
-
 // geometry 
 #pragma link C++ class AliMUONCommonGeometryBuilder+;
 #pragma link C++ class AliMUONSt1SpecialMotif+; 
@@ -25,22 +13,33 @@
 #pragma link C++ class AliMUONSlatGeometryBuilder+; 
 #pragma link C++ class AliMUONTriggerGeometryBuilder+; 
 
+// builder
+#pragma link C++ class AliMUONResponseFactory+;  
+
 // digitizer
+#pragma link C++ class AliMUONHitMapA1+; 
 #pragma link C++ class AliMUONDigitizerV3+; 
 #pragma link C++ class AliMUONSDigitizerV2+;  
 
 // response
-#pragma link C++ class AliMUONChamber+; 
 #pragma link C++ class AliMUONResponse+; 
 #pragma link C++ class AliMUONResponseV0+;
 #pragma link C++ class AliMUONResponseTrigger+; 
 #pragma link C++ class AliMUONResponseTriggerV1+;
-#pragma link C++ class AliMUONResponseFactory+;  
 
 // trigger
+
 #pragma link C++ class AliMUONTrigger+;
-#pragma link C++ class AliMUONChamberTrigger+; 
+#pragma link C++ class AliMUONLocalTriggerBoard+;
+#pragma link C++ class AliMUONRegionalTriggerBoard+;
+#pragma link C++ class AliMUONTriggerBoard+;
+#pragma link C++ class AliMUONTriggerCrate+;
 #pragma link C++ class AliMUONTriggerElectronics+;
+#pragma link C++ class AliMUONGlobalTriggerBoard+;
+
+// raw
+
+#pragma link C++ class AliMUONRawWriter+;
 
 #endif
 
diff --git a/MUON/MUONtriggerLinkDef.h b/MUON/MUONtriggerLinkDef.h
deleted file mode 100644
index 7bca492f568..00000000000
--- a/MUON/MUONtriggerLinkDef.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id$
-
-#ifdef __CINT__
-
-#pragma link C++ class AliMUONLocalTrigger+;
-#pragma link C++ class AliMUONRegionalTrigger+;
-#pragma link C++ class AliMUONGlobalTrigger+;
-#pragma link C++ class AliMUONTriggerBoard+;
-#pragma link C++ class AliMUONLocalTriggerBoard+;
-#pragma link C++ class AliMUONRegionalTriggerBoard+;
-#pragma link C++ class AliMUONGlobalTriggerBoard+;
-#pragma link C++ class AliMUONTriggerCrate+;
-#pragma link C++ class AliMUONTriggerCrateStore+;
-#pragma link C++ class AliMUONTriggerCircuit+;
-
-#endif
-
-
diff --git a/MUON/READMEfast b/MUON/READMEfast
deleted file mode 100644
index 73535c57bcc..00000000000
--- a/MUON/READMEfast
+++ /dev/null
@@ -1,27 +0,0 @@
-$Id$
-
-How to test the fast simulation for MUON.
-
-The macro "fastMUONGen.C" allows to generate events using the 
-AliGenMUONCocktailpp generator. In the current implementation, the 
-generator is set up in order to force all generated particles to decay
-within Pythia, including the muonic decay of pions and kaons:
-gener->SetDecayModePythia(kAllMuonic); 
-By changing the argument from "kAllMuonic" back to "kAll" one can
-leave it up to GEANT to do these decays. 
-In addition, we require that the "trigger muons" - whose number 
-(single- or dimuon trigger or MB trigger),
-specified as the third argument of fastMUONGen.C - must have their origin
-before the hadron absorber in order to "simulate" GEANT:
-gener->SetMuonOriginCut(-130.);
-
-The output of this generation ("galice.root" and "Kinematic.root")
-can then be processed by the macro "fastMUONSim.C" that produces a
-root file, called "fastSim_pp.root". It uses the "fast generator" to
-simulate the detector response.  The output file contains
-TClonesArrays holding AliMUONTrackLight and AliMUONPairLight objects
-that are built on the basis of the surviving muons.
-
-Both macros can be run from fastSim.sh test script.
-
-
diff --git a/MUON/data/transform.dat b/MUON/data/transform.dat
index 4fb60ba3510..6bdadfabb28 100644
--- a/MUON/data/transform.dat
+++ b/MUON/data/transform.dat
@@ -2,18 +2,18 @@ GM    0   pos:     0.0000      0.0000   -526.1600   rot:  90.0000    0.0000   90
 GM    1   pos:     0.0000      0.0000   -545.2400   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 GM    2   pos:     0.0000      0.0000   -676.4000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 GM    3   pos:     0.0000      0.0000   -695.4000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-GM    4   pos:     0.0000     -0.1663   -967.4988   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM    5   pos:     0.0000      0.1663   -967.5012   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM    6   pos:     0.0000     -0.1663   -998.4988   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM    7   pos:     0.0000      0.1663   -998.5012   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM    8   pos:     0.0000     -0.1663  -1276.4988   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM    9   pos:     0.0000      0.1663  -1276.5012   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM   10   pos:     0.0000     -0.1663  -1307.4988   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM   11   pos:     0.0000      0.1663  -1307.5012   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM   12   pos:     0.0000     -0.1663  -1406.5988   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM   13   pos:     0.0000      0.1663  -1406.6011   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM   14   pos:     0.0000     -0.1663  -1437.5988   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
-GM   15   pos:     0.0000      0.1663  -1437.6011   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM    4   pos:     0.0000      0.0000   -967.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM    5   pos:     0.0000      0.0000   -967.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM    6   pos:     0.0000      0.0000   -998.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM    7   pos:     0.0000      0.0000   -998.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM    8   pos:     0.0000      0.0000  -1276.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM    9   pos:     0.0000      0.0000  -1276.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM   10   pos:     0.0000      0.0000  -1307.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM   11   pos:     0.0000      0.0000  -1307.5000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM   12   pos:     0.0000      0.0000  -1406.6000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM   13   pos:     0.0000      0.0000  -1406.6000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM   14   pos:     0.0000      0.0000  -1437.6000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
+GM   15   pos:     0.0000      0.0000  -1437.6000   rot:  90.0000    0.0000   90.7940   90.0000    0.7940   90.0000  
 GM   16   pos:     0.0000      0.0000  -1603.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 GM   17   pos:     0.0000      0.0000  -1620.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 GM   18   pos:     0.0000      0.0000  -1703.5000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
@@ -243,10 +243,10 @@ DE 1315   pos:   137.5756   -217.2091     -3.6000   rot:  90.0000    0.0000   90
 DE 1303   pos:   137.5756    217.2091     -3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 DE 1312   pos:  -137.5756   -216.2360      3.6000   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
 DE 1306   pos:  -137.5756    216.2360      3.6000   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
-DE 1314   pos:   137.5756   -288.3146      3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-DE 1304   pos:   137.5756    288.3146      3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
-DE 1313   pos:  -137.5756   -289.6121     -3.6000   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
-DE 1305   pos:  -137.5756    289.6121     -3.6000   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
+DE 1314   pos:   137.5756   -288.3147      3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+DE 1304   pos:   137.5756    288.3147      3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
+DE 1313   pos:  -137.5756   -289.6122     -3.6000   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
+DE 1305   pos:  -137.5756    289.6122     -3.6000   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
 
 DE 1400   pos:   166.3088      0.0000      3.6000   rot:  90.0000    0.0000   90.0000   90.0000    0.0000    0.0000  
 DE 1409   pos:  -166.3088      0.0000     -3.6000   rot:  90.0000  180.0000   90.0000   90.0000  180.0000    0.0000  
diff --git a/MUON/fastMUONGen.C b/MUON/fastMUONGen.C
deleted file mode 100644
index f31a8861c15..00000000000
--- a/MUON/fastMUONGen.C
+++ /dev/null
@@ -1,151 +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: */
-
-//H. Woehri,  A. De Falco, INFN Cagliari, April 2007
-//an example how to use the AliGenMUONCocktailpp generator
-//without GEANT simulation of the detector
-//The macro switches on all decay modes for the resonances,
-//while for the minimum bias Pythia event we additionally
-//switch on the muonic decays of pions and Kaons
-//Its outcome can be further processed by the macro
-//"fastMUONSim.C
-
-#if !defined(__CINT__) || defined(__MAKECINT__)
-#include "AliGenerator.h"
-#include "AliRunLoader.h"
-#include "AliRun.h"
-#include "AliHeader.h"
-#include "AliStack.h"
-#include "AliGenCocktail.h"
-#include "AliDecayerPythia.h"
-#include "AliPDG.h"
-#include "AliGenMUONCocktailpp.h"
-
-#include "TParticle.h"
-#endif
-
-AliGenerator*  CreateGeneratorMC(Int_t mult);
-Int_t SetupOutputDirectory();
-
-//the third argument "mult" allows to select at a "pre-trigger" level
-//events with "mult" muons in the MUON detector's phase space
-//window, which is defined in the method "CreateGeneratorMC(Int_t mult)"
-//note that in this routine also a cut on the muon's origin
-//should be placed in order not to trigger on muons from pi/K decays
-//that were decayed by Pythia way inside the absorber or in the muon
-//spectrometer itself
-void fastMUONGen(Int_t nev = 1, char* filename = "galice.root", Int_t mult = 2)
-{
-  Int_t runNumber = SetupOutputDirectory();
-  gAlice->SetRunNumber(runNumber);
-  printf("\n\n\n\nsetting run number to %d\n\n\n\n", runNumber);
-
-  //  Update data base
-  AliPDG::AddParticlesToPdgDataBase();
-  //
-  AliRunLoader* rl = AliRunLoader::Open(filename,"FASTRUN","recreate");
-  rl->SetCompressionLevel(2);
-  rl->SetNumberOfEventsPerFile(10000);
-  rl->LoadKinematics("RECREATE");
-  rl->MakeTree("E");
-  gAlice->SetRunLoader(rl);
-  //
-  rl->MakeStack();
-  AliStack* stack      = rl->Stack();
-  AliHeader* header = rl->GetHeader();
-  //
-  //  Create and Initialize Generator
-  AliGenerator *gener = CreateGeneratorMC(mult);
-  gener->SetStack(stack);
-  gener->Init();
-  //
-  for (int iev = 0; iev < nev; iev++) {
-
-    if(iev%1000 == 0) printf("Event %d\n", iev);
-    //  Initialize event
-    header->Reset(0,iev);
-    rl->SetEventNumber(iev);
-    stack->Reset();
-    rl->MakeTree("K");
-    
-    gener->Generate();
-/*
-    // Printing
-    Int_t npart = stack->GetNprimary();
-    for (Int_t part=0; partParticle(part);
-      Int_t mpart  = MPart->GetPdgCode();
-      printf("Particle %5d %5d  %5d\n", part, mpart, MPart->GetFirstMother());
-    }
-*/
-      
-    //  Finish event
-    header->SetNprimary(stack->GetNprimary());
-    header->SetNtrack(stack->GetNtrack());  
-    //      I/O
-    // 
-    stack->FinishEvent();
-    header->SetStack(stack);
-    rl->TreeE()->Fill();
-    rl->WriteKinematics("OVERWRITE");
-  } // event loop
-  
-  gener->FinishRun();
-  stack->FinishRun();
-  rl->WriteHeader("OVERWRITE");
-  gener->Write();
-  rl->Write();  
-}
-//===============================================
-AliGenerator*  CreateGeneratorMC(Int_t mult)
-{
-    AliGenMUONCocktailpp* gener = new AliGenMUONCocktailpp();
-    gener->SetPtRange(0.,100.);
-    gener->SetYRange(-4.,-2.4);
-    gener->SetPhiRange(0., 360.);
-    gener->SetMuonMultiplicity(mult);
-    gener->SetMuonPtCut(0.5);
-    gener->SetMuonThetaRange(171.,178.);      
-    gener->SetOrigin(0.,0.,0.); 
-    gener->SetSigma(0.,0.,5.);
-    gener->SetVertexSmear(kPerEvent);
-    //for resonances: "kAll" all decay modes are openend
-    gener->SetDecayModeResonance(kAll);  
-    //for MC Pythia events: all decays, including muonic decays from pion and Kaons are opened
-    gener->SetDecayModePythia(kAllMuonic); 
-    gener->SetMuonOriginCut(-130.); //prevent the trigger muon(s) from decaying after 130 cm
-    AliDecayerPythia* decayer = new AliDecayerPythia();
-    gener->SetDecayer(decayer);
-    return gener;
-}
-//===============================================
-Int_t SetupOutputDirectory(){
-
-  //Setting up the name for the output directory:
-  static Int_t sseed = 0; // Set 0 to use the current time
-  gRandom->SetSeed(sseed);
-  UInt_t theSeed = gRandom->GetSeed();
-  Int_t labIndex = 5; //1 subatech, 2 clermont, 3 Torino, 4 Orsay
-                      // 5 Cagliari, etc...
-  Int_t runNumber = (theSeed%100000000 + 100000000*labIndex);
-
-  Char_t name[100];
-  sprintf(name, "touch run_%d", runNumber);
-  gSystem->Exec(name);
-
-  return runNumber;
-}
diff --git a/MUON/fastMUONSim.C b/MUON/fastMUONSim.C
deleted file mode 100644
index 4260a8bacd7..00000000000
--- a/MUON/fastMUONSim.C
+++ /dev/null
@@ -1,206 +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: */
-
-//A. De Falco, H. Woehri, INFN Cagliari, April 2007
-//an example how to do the fast simulation and storing
-//the muons that survive the reconstruction in 
-//AliMUONTrackLight and AliMUONPairLight objects for
-//further analysis. Should be used together with the
-//macro "fastMUONGen.C
-
-#if !defined(__CINT__) || defined(__MAKECINT__)
-//STEER includes
-#include "AliStack.h"
-#include "AliRun.h"
-#include "AliHeader.h"
-
-//FASTSIM includes
-#include "AliFastMuonTriggerEff.h"
-#include "AliFastMuonTrackingAcc.h"
-#include "AliFastMuonTrackingEff.h"
-#include "AliFastMuonTrackingRes.h"
-#include "AliFastDetector.h"
-
-//MUON includes
-#include "AliMUONTrackLight.h"
-#include "AliMUONPairLight.h"
-
-//ROOT includes
-#include "TParticle.h"
-#include "TRandom.h"
-#include "TFile.h"
-#include "TClonesArray.h"
-#include "TTree.h"
-
-#endif
-
-Float_t fThetaMin = 171., fThetaMax = 178.;
-//====================================================
-void fastMUONSim(Float_t bkg=0, char* outFileName = "fastSim_pp.root"){
-
-  //setting up the fast simulator
-  AliFastMuonTriggerEff *trigeff = new AliFastMuonTriggerEff();
-  AliFastMuonTrackingAcc *acc = new AliFastMuonTrackingAcc();
-  AliFastMuonTrackingEff *eff = new AliFastMuonTrackingEff();
-  AliFastMuonTrackingRes *res = new AliFastMuonTrackingRes();
-  acc->SetBackground(bkg);
-  eff->SetBackground(bkg);
-  res->SetBackground(bkg);  
-  acc->Init(); 
-  eff->Init(); 
-  res->Init(); 
-  trigeff->Init();
-
-  trigeff->SetCut(0); // 0... trigger pt cut at 1 GeV
-                      // 1... trigger pt cut at 2 GeV
-
-  //prepare the arrays to store the generated/simulated muons
-  TClonesArray *muonArray   = new TClonesArray("AliMUONTrackLight",100); 
-  TClonesArray *dimuonArray = new TClonesArray("AliMUONPairLight",100); 
-  TTree *treeOut = new TTree("tree","tree"); 
-  TFile *fout = new TFile(outFileName,"recreate"); 
-  fout->cd(); 
-  treeOut->Branch("muons",&muonArray); 
-  treeOut->Branch("dimuons",&dimuonArray); 
-  //
-  // Stack of particle for each event
-  AliStack* stack;
-  // Creating Run Loader and opening file containing Hits
-  // AliRunLoader * RunLoader = AliRunLoader::Open("galice.root","MUONFolder","READ");
-  AliRunLoader *RunLoader = AliRunLoader::Open("galice.root");
-  if (RunLoader == 0x0) {
-    printf(">>> Error : Error Opening %s file \n", "galice.root");
-    return;
-  }
-
-  RunLoader->LoadKinematics("READ");
-  Int_t nevents = RunLoader->GetNumberOfEvents();
-  printf("nevents %d\n", nevents);
-
-  TParticle *part = 0, *partMother=0;
-  AliMUONTrackLight *muon = 0;
-  Double_t radeg =  180./TMath::Pi(); 
-  for(int iev = 0; iev < nevents; iev++){
-
-    if(iev%1000==0) printf("Event %d\n", iev);
-    RunLoader->GetEvent(iev); 
-    stack = RunLoader->Stack();
-    //stack->DumpPStack();
-
-    //reset muon info
-    Int_t nMuons = 0;
-    muonArray->Clear();     // clean muon and dimuon arrays 
-    dimuonArray->Clear(); 
-    //
-    Int_t nMuonsStored = 0; 
-    Int_t nPart = stack->GetNtrack();
-    for(int iPart = 0; iPart < nPart; iPart++){
-
-      part = stack->Particle(iPart);
-      if(fabs(part->GetPdgCode()) == 13){ //muon found
-
-	nMuons++;
-	Double_t xyz[3] = {part->Vx(),part->Vy(),part->Vz()};
-	// do not take muons that were decayed after the absorber
-	if(xyz[2] < -(90.+ 40.)) continue; //decay muons after 90cm + 1 int. length
-	Int_t charge = (part->GetPdgCode() > 0) ? -1 : +1;
-	Double_t px = part->Px();
-	Double_t py = part->Py();
-	Double_t pz = part->Pz();
-	Double_t E = part->Energy();
-	TLorentzVector pGen(px,py,pz,E);
-	//
-	//fast simulation code
-	res->SetCharge(charge);
-	eff->SetCharge(charge);
-	acc->SetCharge(charge);
-	Float_t p = (Float_t) pGen.P();
-	Float_t pt = (Float_t) pGen.Pt();
-	Float_t theta = (Float_t) radeg*pGen.Theta();
-	Float_t phi = (Float_t) radeg*pGen.Phi(); 
-	
-	//continue only if we have a muon within the MUON acceptance
-	if(theta < fThetaMin || theta > fThetaMax) continue;
-
-	theta = 180. - theta; // correct by hand the 'new' coordinates frame
-	phi   = 180. - phi; // correct by hand the 'new' coordinates frame
-	Float_t prec = 0, thetarec = 0, phirec = 0; 
-	res->Evaluate(p, theta ,phi, prec, thetarec, phirec);
-	Float_t precx = prec * TMath::Sin(thetarec/radeg) * TMath::Cos(phirec/radeg); 
-	Float_t precy = prec * TMath::Sin(thetarec/radeg) * TMath::Sin(phirec/radeg); 
-	Float_t precz = prec * TMath::Cos(thetarec/radeg);
-	precz = -precz; // correct by hand the 'new' coordinates frame
-	precx   = -precx; // correct by hand the 'new' coordinates frame
-
-  	Float_t trkeff = eff->Evaluate(charge, pt, theta, phi);
- 	Float_t accep  = acc->Evaluate(charge, pt, theta, phi);
- 	Float_t trgeff = trigeff->Evaluate(charge,pt,theta,phi);
-	if(trkeff > 1.) printf("tracking efficiency > 1\n");
-	if(accep > 1.) printf("acceptance efficiency > 1\n");
-	if(trgeff > 1.) printf("trigger efficiency > 1\n");
-	if (gRandom->Rndm() > trkeff || gRandom->Rndm() > accep) continue; 
-
-	//only if we have a muon in the acceptance, store it as an
-	//AliMUONTrackLight object and use it to form dimuons...
-	muon = new AliMUONTrackLight();
-	muon->SetCharge(charge);
-	muon->SetTrackPDGCode(part->GetPdgCode()); //must be set, otherwise -999
-	muon->SetTrackPythiaLine(iPart);//must be set, otherwise -999
-	muon->SetPGen(pGen);
-  	muon->FillMuonHistory(stack, part);
-	// set vertex to mother's vx,vy,vz to have the primary vertex
-
-	Int_t idMother = -1; 
-	Int_t id2 = 0; 
-	while (idMother < 0) idMother = muon->GetParentPythiaLine(id2++); 
-	partMother = stack->Particle(idMother);
-	Double_t xyzMother[3] = {partMother->Vx(),
-				 partMother->Vy(),
-				 partMother->Vz()};
-	muon->SetVertex(xyzMother);
-	if (gRandom->Rndm() > trgeff) muon->SetTriggered(kFALSE); 
-	else muon->SetTriggered(kTRUE);
-	muon->SetPxPyPz(precx,precy,precz);
-
-	//store the referenced track in the muonArray:
-	TClonesArray &muons = *muonArray;
-	new (muons[nMuonsStored++]) AliMUONTrackLight(*muon);
-	delete muon;
-      }
-
-    }//part
-
-    Int_t nmuons = muonArray->GetEntriesFast(); 
-    Int_t ndimuons = 0; 
-    for(Int_t nMu1 = 0; nMu1 < nmuons-1; nMu1++) { 
-      AliMUONTrackLight* mu1 = (AliMUONTrackLight*) muonArray->At(nMu1); 
-      for(Int_t nMu2 = nMu1+1; nMu2 < nmuons; nMu2++){
-	AliMUONTrackLight* mu2 = (AliMUONTrackLight*) muonArray->At(nMu2); 
-	AliMUONPairLight *dimuLight = new AliMUONPairLight(); 
-	dimuLight->SetMuons(*mu1, *mu2);
-	TClonesArray &dimuons = *dimuonArray;
-	new (dimuons[ndimuons++]) AliMUONPairLight(*dimuLight);
-      }
-    }// end dimuons
-    treeOut->Fill(); 
-    stack->Reset();
-  }//end of events
-
-  RunLoader->UnloadKinematics();
-  fout->cd(); 
-  treeOut->Write();
-}
diff --git a/MUON/fastSim.sh b/MUON/fastSim.sh
deleted file mode 100755
index 6c1f3952ed2..00000000000
--- a/MUON/fastSim.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# $Id$
-# A. De Falco, H. Woehri, INFN Cagliari, April 2007
-
-NEVENTS=1
-CURDIR=`pwd`
-
-declare -i time
-time=`date +%s` 
-SEED=$time 
-SEED2=$RANDOM 
-OUTDIR=fastOut_$SEED$SEED2
-
-rm -fr $OUTDIR
-mkdir $OUTDIR
-cp $ALICE_ROOT/MUON/.rootrc $ALICE_ROOT/MUON/rootlogon.C $OUTDIR
-cd $OUTDIR
-#echo current dircetory is $PWD
-  
-###############################
-#  Event Generation           #
-###############################
-echo 'Performing the fast generation now ...'
-aliroot -b > gen.out 2> gen.err << EOF  
-gSystem->Load("libFASTSIM");
-.L $ALICE_ROOT/MUON/fastMUONGen.C+
-fastMUONGen($NEVENTS, "galice.root", 2);
-.q
-EOF
-
-#####################################
-#  Event Simulation (Fast Tracking) #
-#####################################
-echo 'Performing the fast reconstruction now ...'
-aliroot -b > sim.out 2> sim.err << EOF  
-.L $ALICE_ROOT/MUON/fastMUONSim.C+
-fastMUONSim();
-.q
-EOF
diff --git a/MUON/libMUONbase.pkg b/MUON/libMUONbase.pkg
index 918ae08fffa..b77d1e1a77c 100644
--- a/MUON/libMUONbase.pkg
+++ b/MUON/libMUONbase.pkg
@@ -1,24 +1,34 @@
 # $Id$
 
 SRCS:=  AliMUONConstants.cxx \
+        AliMUON.cxx AliMUONv1.cxx \
         AliMUONMathieson.cxx \
+        AliMUONDataInterface.cxx \
+        AliMUONLoader.cxx \
+        AliMUONChamber.cxx \
+        AliMUONTriggerCrateStore.cxx \
+        AliMUONChamberTrigger.cxx \
+        AliMUONTriggerCircuit.cxx \
         AliMUONData.cxx \
         AliMUONDataIterator.cxx \
         AliMUONDataDigitIterator.cxx \
+        AliMUONPoints.cxx \
+        AliMUONHit.cxx \
         AliMUONDigit.cxx \
-        AliMUONHitMapA1.cxx \
         AliMUONRawCluster.cxx \
+        AliMUONGlobalTrigger.cxx  \
+        AliMUONRegionalTrigger.cxx \
+        AliMUONLocalTrigger.cxx \
         AliMUONSt12QuadrantSegmentation.cxx \
         AliMUONSt345SlatSegmentation.cxx \
         AliMUONTriggerSegmentation.cxx \
         AliMUONSegFactory.cxx \
         AliMUONCalibrationData.cxx \
         AliMUONDigitMaker.cxx \
-        AliMUONRawWriter.cxx \
+        AliMUONTriggerChamberEff.cxx \
         AliMUONLogger.cxx \
-        AliMUONCDB.cxx \
-        AliMUONHVNamer.cxx \
- 
+        AliMUONCDB.cxx
+
 HDRS:= $(SRCS:.cxx=.h)
 
 DHDR:= MUONbaseLinkDef.h
diff --git a/MUON/libMUONcalib.pkg b/MUON/libMUONcalib.pkg
index 2a4ecc76838..6c9af9e5b9d 100644
--- a/MUON/libMUONcalib.pkg
+++ b/MUON/libMUONcalib.pkg
@@ -16,10 +16,10 @@ SRCS:=  AliMUONVDataIterator.cxx \
         AliMUONTriggerEfficiencyCells.cxx\
         AliMUON2DStoreValidator.cxx \
         AliMUONCheckItem.cxx \
-        AliMUONCheckItemIterator.cxx \
+        AliMUONCheckItemIterator.cxx
 
 HDRS:= $(SRCS:.cxx=.h)
 
 DHDR:= MUONcalibLinkDef.h
 
-EINCLUDE:= MUON/mapping
+EINCLUDE:= MUON/mapping
\ No newline at end of file
diff --git a/MUON/libMUONevaluation.pkg b/MUON/libMUONevaluation.pkg
index a6f7f7add92..08575606676 100644
--- a/MUON/libMUONevaluation.pkg
+++ b/MUON/libMUONevaluation.pkg
@@ -2,11 +2,7 @@
 
 SRCS:= AliMUONPairLight.cxx \
        AliMUONTrackLight.cxx \
-       AliMUONCheck.cxx \
-       AliMUONRecoCheck.cxx \
-       AliMUONPoints.cxx \
-       AliMUONDisplay.cxx \
-       AliMUONDataInterface.cxx \
+       AliMUONCheck.cxx
             
 HDRS:= $(SRCS:.cxx=.h)
 
diff --git a/MUON/libMUONmapping.pkg b/MUON/libMUONmapping.pkg
index 09220a02c2d..e04e6e8dd70 100644
--- a/MUON/libMUONmapping.pkg
+++ b/MUON/libMUONmapping.pkg
@@ -88,8 +88,6 @@ SRCS +=  \
 	 mapping/AliMpDEIterator.cxx  \
 	 mapping/AliMpDEManager.cxx  \
          mapping/AliMpBusPatch.cxx \
-         mapping/AliMpTriggerCrate.cxx \
-         mapping/AliMpLocalBoard.cxx \
          mapping/AliMpDDL.cxx \
 	 mapping/AliMpDDLStore.cxx
 	 
diff --git a/MUON/libMUONraw.pkg b/MUON/libMUONraw.pkg
index 357a651368e..9269ba45000 100644
--- a/MUON/libMUONraw.pkg
+++ b/MUON/libMUONraw.pkg
@@ -11,7 +11,7 @@ SRCS:= AliMUONDDLTrigger.cxx \
        AliMUONBusStruct.cxx \
        AliMUONPayloadTracker.cxx \
        AliMUONRawStreamTrigger.cxx \
-       AliMUONRawStreamTracker.cxx  \
+       AliMUONRawStreamTracker.cxx
  
 
 HDRS:= $(SRCS:.cxx=.h)
diff --git a/MUON/libMUONrec.pkg b/MUON/libMUONrec.pkg
index 2e40140e5ce..11c4924bb3c 100644
--- a/MUON/libMUONrec.pkg
+++ b/MUON/libMUONrec.pkg
@@ -1,8 +1,6 @@
 # $Id$
 
-SRCS:= AliMUONRecData.cxx \
-       AliMUONRecLoader.cxx \
-       AliMUONClusterReconstructor.cxx \
+SRCS:= AliMUONClusterReconstructor.cxx \
        AliMUONDigitMapA1.cxx \
        AliMUONClusterFinderVS.cxx \
        AliMUONClusterFinderAZ.cxx \
@@ -26,6 +24,8 @@ SRCS:= AliMUONRecData.cxx \
        AliMUONDigitCalibrator.cxx \
        AliMillepede.cxx \
        AliMUONAlignment.cxx \
+       AliMUONDisplay.cxx \
+       AliMUONRecoCheck.cxx \
        AliMUONVClusterFinder.cxx \
        AliMUONPreClusterFinder.cxx \
        AliMUONClusterFinderMLEM.cxx \
@@ -36,8 +36,9 @@ SRCS:= AliMUONRecData.cxx \
        AliMUONCluster.cxx \
        AliMUONPadStatusMaker.cxx \
        AliMUONPadStatusMapMaker.cxx \
-       AliMUONTrackHitPattern.cxx \
-
+       AliMUONHVNamer.cxx \
+       AliMUONTrackHitPattern.cxx
+       
 HDRS:= $(SRCS:.cxx=.h)
 
 DHDR:= MUONrecLinkDef.h
diff --git a/MUON/libMUONsim.pkg b/MUON/libMUONsim.pkg
index bab37e29308..f3bd23a5c00 100644
--- a/MUON/libMUONsim.pkg
+++ b/MUON/libMUONsim.pkg
@@ -1,11 +1,6 @@
 # $Id$
 
-SRCS:= AliMUON.cxx \
-       AliMUONv1.cxx \
-       AliMUONSimLoader.cxx \
-       AliMUONSimData.cxx \
-       AliMUONHit.cxx \
-       AliMUONCommonGeometryBuilder.cxx \
+SRCS:= AliMUONCommonGeometryBuilder.cxx \
        AliMUONSt1GeometryBuilder.cxx \
        AliMUONSt1GeometryBuilderV2.cxx \
        AliMUONSt1SpecialMotif.cxx \
@@ -14,8 +9,7 @@ SRCS:= AliMUON.cxx \
        AliMUONSlatGeometryBuilder.cxx \
        AliMUONTriggerGeometryBuilder.cxx \
        AliMUONResponseFactory.cxx \
-       AliMUONChamber.cxx \
-       AliMUONChamberTrigger.cxx \
+       AliMUONHitMapA1.cxx \
        AliMUONResponse.cxx \
        AliMUONResponseV0.cxx \
        AliMUONResponseTrigger.cxx \
@@ -23,8 +17,14 @@ SRCS:= AliMUON.cxx \
        AliMUONTrigger.cxx \
        AliMUONSDigitizerV2.cxx \
        AliMUONDigitizerV3.cxx \
+       AliMUONLocalTriggerBoard.cxx \
+       AliMUONRegionalTriggerBoard.cxx \
+       AliMUONTriggerBoard.cxx \
+       AliMUONTriggerCrate.cxx \
        AliMUONTriggerElectronics.cxx \
-                           
+       AliMUONGlobalTriggerBoard.cxx \
+       AliMUONRawWriter.cxx
+                            
 HDRS:= $(SRCS:.cxx=.h)
 
 DHDR:= MUONsimLinkDef.h
diff --git a/MUON/libMUONtrigger.pkg b/MUON/libMUONtrigger.pkg
deleted file mode 100644
index 580fb3efab7..00000000000
--- a/MUON/libMUONtrigger.pkg
+++ /dev/null
@@ -1,18 +0,0 @@
-# $Id$
-
-SRCS:=  AliMUONLocalTrigger.cxx \
-        AliMUONRegionalTrigger.cxx \
-        AliMUONGlobalTrigger.cxx \
-        AliMUONTriggerBoard.cxx \
-        AliMUONLocalTriggerBoard.cxx \
-        AliMUONRegionalTriggerBoard.cxx \
-        AliMUONGlobalTriggerBoard.cxx \
-        AliMUONTriggerCrate.cxx \
-        AliMUONTriggerCrateStore.cxx \
-        AliMUONTriggerCircuit.cxx
- 
-HDRS:= $(SRCS:.cxx=.h)
-
-DHDR:= MUONtriggerLinkDef.h
-
-EINCLUDE := MUON/mapping
diff --git a/MUON/loadlibcalib.C b/MUON/loadlibcalib.C
index 29ddf7ca1c7..b0cd2d1b686 100644
--- a/MUON/loadlibcalib.C
+++ b/MUON/loadlibcalib.C
@@ -20,13 +20,16 @@
 
 void loadlibcalib () 
 {
-  gSystem->Load("libMatrix");
+  gSystem->Load("libVMC");
+  gSystem->Load("libMinuit");
   gSystem->Load("libTree");
-  gSystem->Load("libGeom");
+  
   gSystem->Load("libESD");
+  gSystem->Load("libSTEER"); 
   
-  gSystem->Load("libGui");
   gSystem->Load("libPhysics");
+
   gSystem->Load("libMUONmapping");
   gSystem->Load("libMUONcalib");
+
 }
diff --git a/MUON/loadlibs.C b/MUON/loadlibs.C
index a45b029d327..87975a32348 100644
--- a/MUON/loadlibs.C
+++ b/MUON/loadlibs.C
@@ -35,13 +35,11 @@ void loadlibs ()
   gSystem->Load("libMUONmapping");
   gSystem->Load("libMUONcalib");
   gSystem->Load("libMUONgeometry");
-  gSystem->Load("libMUONtrigger");
-  
-  gSystem->Load("libRAWDatabase");
-  gSystem->Load("libMUONraw");
-    
   gSystem->Load("libMUONbase");
 
+  gSystem->Load("libRAWDatabase");
+  gSystem->Load("libMUONraw");
+  
   gSystem->Load("libMUONshuttle");
 
   gSystem->Load("libRAWDatarec");
@@ -49,6 +47,4 @@ void loadlibs ()
   
   gSystem->Load("libRAWDatasim");
   gSystem->Load("libMUONsim");
-  
-  gSystem->Load("libMUONevaluation");
 }
diff --git a/MUON/loadmacros.C b/MUON/loadmacros.C
index 2d09a00701b..ef49bbf2917 100644
--- a/MUON/loadmacros.C
+++ b/MUON/loadmacros.C
@@ -17,8 +17,6 @@
 
 // Macro which loads and compiles the MUON macros:
 //
-// fastMuonGen.C                 - ok, comp,  x;      Hermine, Alessandro
-// fastMuonSim.C                 - ok, comp,  x;      Hermine, Alessandro
 // DecodeRecoCocktail.C          - ok, comp,  README; Hermine, Alessandro
 // ReadRecoCocktail.C            - ok, comp,  README; Hermine, Alessandro
 // MergeMuonLight.C              - x,  comp,  README; Hermine, Alessandro
@@ -79,8 +77,6 @@ void loadmacros ()
   //
   TString includePath = "-I${ALICE_ROOT}/include ";
   includePath        += "-I${ALICE_ROOT}/RAW ";
-  includePath        += "-I${ALICE_ROOT}/FASTSIM ";
-  includePath        += "-I${ALICE_ROOT}/EVGEN ";
   includePath        += "-I${ALICE_ROOT}/SHUTTLE/TestShuttle ";
   includePath        += "-I${ALICE_ROOT}/ITS ";
   includePath        += "-I${ALICE_ROOT}/MUON ";
@@ -95,9 +91,6 @@ void loadmacros ()
 
   // Load macros
   //
-  gROOT->LoadMacro("$ALICE_ROOT/MUON/fastMUONGen.C++");      
-  gROOT->LoadMacro("$ALICE_ROOT/MUON/fastMUONSim.C++");      
-/*
   gROOT->LoadMacro("$ALICE_ROOT/MUON/DecodeRecoCocktail.C++");      
   gROOT->LoadMacro("$ALICE_ROOT/MUON/ReadRecoCocktail.C++");     
   gROOT->LoadMacro("$ALICE_ROOT/MUON/MergeMuonLight.C++");       
@@ -118,11 +111,10 @@ void loadmacros ()
   gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONRawStreamTracker.C++");    
   gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONRawStreamTrigger.C++");    
   gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONRecoCheck.C++");           
-  // gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONResoEffChamber.C++"); 
+  gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONResoEffChamber.C++"); 
   gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONStatusMap.C++");        
-  // gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONTrigger.C++");        
+  gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONTrigger.C++");        
   gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONTriggerEfficiency.C++");   
   gROOT->LoadMacro("$ALICE_ROOT/MUON/MUONTriggerEfficiencyPt.C++"); 
   gROOT->LoadMacro("$ALICE_ROOT/MUON/TestMUONPreprocessor.C++");    
-*/
 }
diff --git a/MUON/mapping/AliMpBusPatch.cxx b/MUON/mapping/AliMpBusPatch.cxx
index 0e41dfe8c58..c120a111cf4 100644
--- a/MUON/mapping/AliMpBusPatch.cxx
+++ b/MUON/mapping/AliMpBusPatch.cxx
@@ -193,9 +193,7 @@ Bool_t AliMpBusPatch::SetNofManusPerModule()
     //vec[vec.GetSize()-1] = manuPerPcb+1;
     fNofManusPerModule.Add(manuPerPcb+1);
     return true;  
-  } 
-  
-  return false; 
+  }  
 }     
 
 //______________________________________________________________________________
diff --git a/MUON/mapping/AliMpConstants.cxx b/MUON/mapping/AliMpConstants.cxx
index 2968636af67..99fb489d0ef 100755
--- a/MUON/mapping/AliMpConstants.cxx
+++ b/MUON/mapping/AliMpConstants.cxx
@@ -39,7 +39,6 @@ const Int_t    AliMpConstants::fgkStartPadIndex = 1;
 const Int_t    AliMpConstants::fgkNofChambers = 14;
 const Int_t    AliMpConstants::fgkNofTrackingChambers = 10;
 const Int_t    AliMpConstants::fgkNofGeomModules = 20;
-const Int_t    AliMpConstants::fgkNofLocalBoards = 234;
 const Int_t AliMpConstants::fgkNonBendingManuMask(1<<10);
 
 //_____________________________________________________________________________
@@ -74,17 +73,10 @@ Bool_t  AliMpConstants::IsEqual(const TVector2& v1, const TVector2& v2)
 }
 
 //_____________________________________________________________________________
-Int_t AliMpConstants::ManuMask(AliMp::PlaneType planeType)
+Int_t
+AliMpConstants::ManuMask(AliMp::PlaneType planeType)
 {
 /// The manuIDs get an offset if they are in the non-bending plane
 
   return ( planeType == AliMp::kNonBendingPlane ) ? fgkNonBendingManuMask : 0;
 }
-
-//_____________________________________________________________________________
-Int_t AliMpConstants::NofTriggerChambers() 
-{ 
-/// Return number of trigger chambers
-
-  return fgkNofChambers - fgkNofTrackingChambers;
-}
diff --git a/MUON/mapping/AliMpConstants.h b/MUON/mapping/AliMpConstants.h
index 8da2959ae10..5226d4d3260 100755
--- a/MUON/mapping/AliMpConstants.h
+++ b/MUON/mapping/AliMpConstants.h
@@ -34,11 +34,9 @@ class AliMpConstants : public TObject
   static Int_t    StartPadIndex();
   static Int_t    NofChambers();
   static Int_t    NofTrackingChambers();
-  static Int_t    NofTriggerChambers();
   static Int_t    NofGeomModules();
   static Int_t    ManuMask(AliMp::PlaneType planeType);
-  static Int_t    NofLocalBoards();
-
+  
  private:
                   /// unused derived functions
   virtual Bool_t  IsEqual(const TObject*) const { return true; }
@@ -52,9 +50,8 @@ class AliMpConstants : public TObject
   static const Int_t     fgkNofTrackingChambers; ///< number of tracking chambers
   static const Int_t     fgkNofGeomModules; ///< number of geometry modules
   static const Int_t     fgkNonBendingManuMask; ///< bit to set to indicate a manu located in non-bending plane
-  static const Int_t     fgkNofLocalBoards;  ///< number of notified trigger local boards 
-
-  ClassDef(AliMpConstants,5) //Class for globally used constants definition
+  
+  ClassDef(AliMpConstants,4) //Class for globally used constants definition
 };
 
 // inline functions
@@ -71,8 +68,6 @@ inline Int_t    AliMpConstants::NofChambers()     { return fgkNofChambers;}
 inline Int_t    AliMpConstants::NofTrackingChambers() { return fgkNofTrackingChambers;}
                 /// Return number of geometry modules
 inline Int_t    AliMpConstants::NofGeomModules()  { return fgkNofGeomModules;}
-                /// Return number of trigger local boards
-inline Int_t    AliMpConstants::NofLocalBoards()  { return fgkNofLocalBoards;}
 
 #endif //ALI_MP_CONSTANTS_H
 
diff --git a/MUON/mapping/AliMpDDL.cxx b/MUON/mapping/AliMpDDL.cxx
index 1426477a48b..6ec17643337 100644
--- a/MUON/mapping/AliMpDDL.cxx
+++ b/MUON/mapping/AliMpDDL.cxx
@@ -41,9 +41,7 @@ AliMpDDL::AliMpDDL(Int_t id)
   : TObject(),
     fId(id),
     fDEIds(),
-    fBusPatchIds(),
-    fTriggerCrateIds(false)
-
+    fBusPatchIds()
 {
 /// Standard constructor
 }
@@ -53,8 +51,7 @@ AliMpDDL::AliMpDDL(TRootIOCtor* /*ioCtor*/)
   : TObject(),
     fId(0),
     fDEIds(),
-    fBusPatchIds(),
-    fTriggerCrateIds()
+    fBusPatchIds()
 {
 /// Root IO constructor
 }
@@ -108,24 +105,6 @@ Bool_t AliMpDDL::AddDE(Int_t detElemId)
   return true;
 }   
 
-//______________________________________________________________________________
-Bool_t AliMpDDL::AddTriggerCrate(Int_t crateId)
-{
-/// Add trigger crate with given crateId.
-/// Return true if the trigger crate was added
-
-  if ( HasTriggerCrateId(crateId) ) {
-    AliWarningStream() 
-	<< "Trigger crate Id = " << crateId << " already present."
-	<< endl;
-    return false;
-  }    
-  
-  fTriggerCrateIds.Add(crateId);
-
-  return true;
-}      
-
 //______________________________________________________________________________
 Int_t AliMpDDL::GetNofDEs() const
 {  
@@ -174,30 +153,6 @@ Bool_t  AliMpDDL::HasBusPatchId(Int_t busPatchId) const
   return fBusPatchIds.HasValue(busPatchId);; 
 }
 
-//______________________________________________________________________________
-Int_t AliMpDDL::GetNofTriggerCrates() const
-{  
-/// Return the number of trigger crate connected to this DDL
-
-  return fTriggerCrateIds.GetSize(); 
-}
-
-//______________________________________________________________________________
-Int_t  AliMpDDL::GetTriggerCrateId(Int_t index) const
-{  
-/// Return the trigger crate by index (in loop)
-
-  return fTriggerCrateIds.GetValue(index); 
-}
-
-//______________________________________________________________________________
-Bool_t  AliMpDDL::HasTriggerCrateId(Int_t triggerCrateId) const
-{  
-/// Return true if the trigger crate Id is present
-
-  return fTriggerCrateIds.HasValue(triggerCrateId);
-}
-
 //____________________________________________________________________
 Int_t AliMpDDL::GetMaxDsp() const
 {
diff --git a/MUON/mapping/AliMpDDL.h b/MUON/mapping/AliMpDDL.h
index e5190fca5ce..238ec598de5 100644
--- a/MUON/mapping/AliMpDDL.h
+++ b/MUON/mapping/AliMpDDL.h
@@ -26,8 +26,6 @@ class AliMpDDL : public  TObject {
 
     // methods 
     Bool_t AddDE(Int_t detElemId);
-    Bool_t AddTriggerCrate(Int_t crateId);
-
     void   FillBusPatchIds();
 
     // get methods
@@ -42,11 +40,6 @@ class AliMpDDL : public  TObject {
     Int_t  GetNofBusPatches() const;
     Int_t  GetBusPatchId(Int_t index) const;
     Bool_t HasBusPatchId(Int_t busPatchId) const;
-
-    // Trigger crates
-    Int_t  GetNofTriggerCrates() const;
-    Int_t  GetTriggerCrateId(Int_t index) const;
-    Bool_t HasTriggerCrateId(Int_t crateId) const;
     
     // Dsp info
     Int_t  GetMaxDsp() const;
@@ -61,11 +54,10 @@ class AliMpDDL : public  TObject {
     AliMpDDL& operator=(const AliMpDDL& rhs);
 
     // data members	
-    Int_t       fId;            ///< Identifier (unique)
-    AliMpArrayI fDEIds;         ///< Detection element Ids connected to this DDL
-    AliMpArrayI fBusPatchIds;   ///< Bus patch Ids connected to this DDL
-    AliMpArrayI fTriggerCrateIds; ///< Trigger crate Ids connected to this DDL
-
+    Int_t       fId;          ///< Identifier (unique)
+    AliMpArrayI fDEIds;       ///< Detection element Ids connected to this DDL
+    AliMpArrayI fBusPatchIds; ///< Bus patch Ids connected to this DDL
+    
      
   ClassDef(AliMpDDL,1)  // The class collectiong electronics properties of DDL
 };
diff --git a/MUON/mapping/AliMpDDLStore.cxx b/MUON/mapping/AliMpDDLStore.cxx
index c38cccef05d..eaa735abafb 100644
--- a/MUON/mapping/AliMpDDLStore.cxx
+++ b/MUON/mapping/AliMpDDLStore.cxx
@@ -9,7 +9,7 @@
  * 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          *Crate
+ * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
@@ -24,9 +24,8 @@
 // via various characteristics.
 // Authors: Ivana Hrivnacova, IPN Orsay
 //          Christian Finck, SUBATECH Nantes
-
-#include "AliMpDDLStore.h"
 #include "AliMpConstants.h"
+#include "AliMpDDLStore.h"
 #include "AliMpDEStore.h"
 #include "AliMpDDL.h"
 #include "AliMpFiles.h"
@@ -34,8 +33,6 @@
 #include "AliMpDEManager.h"
 #include "AliMpDetElement.h"
 #include "AliMpBusPatch.h"
-#include "AliMpTriggerCrate.h"
-#include "AliMpLocalBoard.h"
 #include "AliMpSegmentation.h"
 #include "AliMpVSegmentation.h"
 
@@ -43,9 +40,6 @@
 
 #include 
 #include 
-#include 
-#include 
-#include 
 
 /// \cond CLASSIMP
 ClassImp(AliMpDDLStore)
@@ -53,7 +47,6 @@ ClassImp(AliMpDDLStore)
 
 AliMpDDLStore* AliMpDDLStore::fgInstance = 0;
 const Int_t    AliMpDDLStore::fgkNofDDLs = 20;
-const Int_t    AliMpDDLStore::fgkNofTriggerDDLs = 2;
 
 //
 // static methods
@@ -78,11 +71,9 @@ AliMpDDLStore* AliMpDDLStore::Instance()
 //______________________________________________________________________________
 AliMpDDLStore::AliMpDDLStore()
 : TObject(),
-  fDDLs(fgkNofDDLs+fgkNofTriggerDDLs), // FIXEME
+  fDDLs(fgkNofDDLs),
   fDetElements(AliMpDEStore::Instance()),
   fBusPatches(true),
-  fTriggerCrates(true),
-  fLocalBoards(true),
   fManuList12()
 {  
 /// Standard constructor
@@ -92,15 +83,8 @@ AliMpDDLStore::AliMpDDLStore()
   fBusPatches.SetOwner(true);
   fBusPatches.SetSize(900);
 
-  fTriggerCrates.SetOwner(true);
-  fTriggerCrates.SetSize(16);
-
-  fLocalBoards.SetOwner(true);
-  fLocalBoards.SetSize(242); // included non-identied board
-
   // Create all detection elements
   ReadDDLs();
-  ReadTriggerDDLs();
   SetManus();
   SetPatchModules();
 }
@@ -265,159 +249,6 @@ Bool_t AliMpDDLStore::ReadDDLs()
    in.close();
    return true;
 }
-
-//______________________________________________________________________________
-Bool_t  AliMpDDLStore::ReadTriggerDDLs()
-{
-/// create trigger DDL object ddl<->Crate<->local board
-  
-    Int_t nonNotified = 0;
-
-    Int_t iDDL = -1;
-
-    TString infile = AliMpFiles::LocalTriggerBoardMapping();
-  
-    ifstream in(infile, ios::in);
-    
-    if (!in) {
-      AliError(Form("Local Trigger Board Mapping File %s not found", infile.Data()));
-      return kFALSE;
-    }
-  
-    AliMpLocalBoard* board = 0x0;
-    AliMpTriggerCrate* crate = 0x0;
-
-    TString localNumber;
-    Int_t localNumberId = 0;
-    TArrayI list;
-
-    char line[255];
-    while (in.getline(line, 255))
-    {
-
-      // files contains lines with some blank caracters ???
-      if (line[0] == ' ' && strlen(line) < 12) continue;
-
-      TString tmp(AliMpHelper::Normalize(line));
-      if (tmp.IsNull()) continue; // Ignore empty lines
- 
-      if (tmp.Contains("Board")) 
-      {
-	// extract id, name, slot & crate name
-	TObjArray* stringList = tmp.Tokenize(TString(" "));
-  
-	TString localNumber = ((TObjString*)stringList->At(1))->GetString();
-
-	if (localNumber.CompareTo("nn") != 0) // Notified cards
-	    localNumberId = localNumber.Atoi();
-	else 
-	    localNumberId = AliMpConstants::NofLocalBoards()  + (++nonNotified);
-
-	TString localName = ((TObjString*)stringList->At(4))->GetString();
-	TString slotName  = ((TObjString*)stringList->At(10))->GetString();
-
-	AliDebug(3, Form("%d %s %d\n", localNumberId, localName.Data(), slotName.Atoi()));
-
-	board = new AliMpLocalBoard(localNumberId, localName.Data(), slotName.Atoi());
-
-	// not notified board
-	if (localNumber.CompareTo("nn") == 0)
-	    board->SetNotified(false);
-
-	// compose name with number and side (Right or Left)
-	TString crateNumber = ((TObjString*)stringList->At(6))->GetString();
-	TString crateSide = ((TObjString*)stringList->At(7))->GetString();
-	TString crateName = crateNumber + crateSide;
-
-	// set crate name
-	board->SetCrate(crateName);
-
-	// determine ddl number vs crate side
-	if (crateName.Contains("R")) 
-	    iDDL = fgkNofDDLs; // starts where tracker ends
-	else 
-	    iDDL = fgkNofDDLs + 1;
-	
-	AliMpDDL* ddl = GetDDL(iDDL, false);
-	if ( !ddl) {
-	  ddl = new AliMpDDL(iDDL);
-	  fDDLs.AddAt(ddl, iDDL);
-	}  
-	
-	Int_t crateId; 
-	if (crateNumber.CompareTo("2-3") != 0)
-	    crateId = crateNumber.Atoi();
-	else
-	    crateId = 23;
-
-	// add trigger crate number for given ddl if not present
-	if ( !ddl->HasTriggerCrateId(crateId) )
-	    ddl->AddTriggerCrate(crateId);
-
-	// if crate not existing then creating
-	if (!GetTriggerCrate(crateName, false)) {
-	    crate = new AliMpTriggerCrate(crateName.Data(), iDDL);
-	    fTriggerCrates.Add(crateName.Data(), crate);
-	}
-
-	// create list of local board in this crate
-	crate->AddLocalBoard(localNumberId);
-
-	delete stringList;
-      }
-
-      if (tmp.Contains("DetElemId")) 
-      {
-	list.Reset();
-	AliMpDDL* ddl = GetDDL(iDDL, true);
-
-	// add  DE for local board and DDL
-	TString detElem = &tmp[tmp.First(" ")+1];
-	AliMpHelper::DecodeName(detElem,' ',list);
-	for (Int_t i = 0; i < list.GetSize(); ++i) {
-	    board->AddDE(list[i]);
-	    if(!ddl->HasDEId(list[i]))
-		ddl->AddDE(list[i]);
-	}
-      }
-
-      if (tmp.Contains("transv")) 
-      {
-	// set transverse connector
-	Int_t blankPos = tmp.Last(' ');
-
-	TString transv(tmp(blankPos+1, tmp.Length()-blankPos));
-	transv.ToUpper();
-	if (transv.CompareTo("NONE") == 0)
-	    board->SetTC(false);
-      }
-
-      if (tmp.Contains("Switch")) 
-      {
-	list.Reset();
-	in.getline(line, 255);// skip one line
-
-	in.getline(line, 255);
-	TString tmp(AliMpHelper::Normalize(line));
-
-	// decode switches
-	AliMpHelper::DecodeName(tmp,' ',list);
-
-	// store switches
-	AliMpArrayI switches;
-
-	for (Int_t i = 0; i < list.GetSize(); ++i)
-	    board->AddSwitch(list[i]);
-
-	// add local board into map
-	fLocalBoards.Add(board->GetId(), board);
-
-      }
-    }
-
-    return kTRUE;
-}
-
 //______________________________________________________________________________
 Bool_t AliMpDDLStore::SetManus()
 {
@@ -543,25 +374,6 @@ Bool_t AliMpDDLStore::SetPatchModules()
   return result;
 }
 
-//________________________________________________________________
-Int_t AliMpDDLStore::GetLocalBoardId(TString name) const
-{
-/// return the first board with a given side and line
-
-   TExMapIter i = fLocalBoards.GetIterator();
-    Long_t key, value;
-    while ( i.Next(key, value) ) {
-      AliMpLocalBoard* local = (AliMpLocalBoard*)value;
-
-      TString tmp(&local->GetName()[4], 2);
-      if (name.Contains(tmp))
-	  if (name[0] == local->GetName()[0])
-	      return local->GetId();
-    }
-
-    return 0;
-
-}
 
 //
 // public methods
@@ -608,57 +420,6 @@ AliMpBusPatch* AliMpDDLStore::GetBusPatch(Int_t busPatchId, Bool_t warn) const
   return busPatch;
 }    
 
-//______________________________________________________________________________
-AliMpLocalBoard* AliMpDDLStore::GetLocalBoard(Int_t localBoardId, Bool_t warn) const
-{
-/// Return bus patch with given Id
-
-  AliMpLocalBoard* localBoard
-    = (AliMpLocalBoard*) fLocalBoards.GetValue(localBoardId);
-    
-  if ( ! localBoard && warn ) {  
-    AliErrorStream() 
-        << "Local board with Id = " << localBoardId << " not defined." << endl;
-  }	
-
-  return localBoard;
-}    
-
-//______________________________________________________________________________
-AliMpTriggerCrate* AliMpDDLStore::GetTriggerCrate(TString name, Bool_t warn) const
-{
-/// Return trigger crate with given name
-
-  AliMpTriggerCrate* crate
-     = (AliMpTriggerCrate*) fTriggerCrates.GetValue(name.Data());
-    
-  if ( ! crate && warn ) {  
-    AliErrorStream() 
-        << "Trigger crate with name = " << name.Data() << " not defined." << endl;
-  }	
-
-  return crate;
-}  
-
-//______________________________________________________________________________
-AliMpTriggerCrate* AliMpDDLStore::GetTriggerCrate(Int_t ddlId, Int_t index, Bool_t warn) const
-{
-/// Return trigger crate with given ddl and index crate
-
-  AliMpDDL* ddl = GetDDL(ddlId, warn);
-  if ( ! ddl ) return 0; 
-  
-  if ( index >= ddl->GetNofTriggerCrates() ) {
-      AliError(Form("crate id %d greater than array[%d]", index, ddl->GetNofTriggerCrates()));
-      return 0;
-  }    
-   
-  Int_t crateId = ddl->GetTriggerCrateId(index);
-  TString name = AliMpTriggerCrate::GenerateName(crateId, ddlId, fgkNofDDLs);
-  
-  return GetTriggerCrate(name, warn);
-}  
-
 //______________________________________________________________________________
 Int_t  AliMpDDLStore::GetDEfromBus(Int_t busPatchId) const
 {
@@ -675,22 +436,6 @@ Int_t  AliMpDDLStore::GetDEfromBus(Int_t busPatchId) const
   return busPatch->GetDEId();
 }  
 
-//______________________________________________________________________________
-Int_t  AliMpDDLStore::GetDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const
-{
-/// Return detElemId for local board Id and chamber id.
-
-  AliMpLocalBoard* localBoard = GetLocalBoard(localBoardId);
-  
-  if ( ! localBoard ) {
-    AliErrorStream() 
-        << "Loacl board with Id = " << localBoardId << " not defined." << endl;
-    return 0;    
-  }	
-
-   return localBoard->GetDEIdByChamber(chamberId);
-}
-
 //______________________________________________________________________________
 Int_t  AliMpDDLStore::GetDDLfromBus(Int_t busPatchId) const
 {
@@ -770,48 +515,4 @@ void AliMpDDLStore::PrintAllManu() const
   }
 }  
 
-//________________________________________________________________
-Int_t  AliMpDDLStore::GetNextDEfromLocalBoard(Int_t localBoardId, Int_t chamberId ) const
-{
-/// return the next detection element in line
-
-    AliMpLocalBoard* localBoard  =  GetLocalBoard(localBoardId);
-
-    TString name(localBoard->GetName());
-
-    Int_t line = localBoard->GetPosition().GetFirst();
-    ++line;
-    
-    name.Replace(4,1,Form("%d", line));
-
-   Int_t nextLocalId;
-    if ((nextLocalId = GetLocalBoardId(name)))
-	return GetDEfromLocalBoard(nextLocalId, chamberId);
-    else
-	return 0;
-
-    return 0;
-}
-
-//________________________________________________________________
-Int_t  AliMpDDLStore::GetPreviousDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const
-{
-/// return the previous detection element in line
-
-    AliMpLocalBoard* localBoard  =  GetLocalBoard(localBoardId);
-
-    TString name(localBoard->GetName());
-
-    Int_t line = localBoard->GetPosition().GetFirst();
-    --line;
-    
-    name.Replace(4,1,Form("%d", line));
-
-    Int_t prevLocalId;
-    if ((prevLocalId = GetLocalBoardId(name)))
-	return GetDEfromLocalBoard(prevLocalId, chamberId);
-    else
-	return 0;
-
-}
 
diff --git a/MUON/mapping/AliMpDDLStore.h b/MUON/mapping/AliMpDDLStore.h
index 79915c32315..68b888ae981 100644
--- a/MUON/mapping/AliMpDDLStore.h
+++ b/MUON/mapping/AliMpDDLStore.h
@@ -17,19 +17,16 @@
 #ifndef ALI_MP_DDL_STORE_H
 #define ALI_MP_DDL_STORE_H
 
-#include "AliMpExMap.h"
-#include "AliMpIntPair.h"
-
 #include 
 #include 
 #include 
 
+#include "AliMpExMap.h"
+#include "AliMpIntPair.h"
 
 class AliMpDDL;
 class AliMpDetElement;
 class AliMpBusPatch;
-class AliMpLocalBoard;
-class AliMpTriggerCrate;
 class AliMpDEStore;
 class TArrayI;
 
@@ -43,22 +40,14 @@ class AliMpDDLStore : public  TObject {
     static AliMpDDLStore* Instance(); 
     
     // methods
-    AliMpDDL*          GetDDL(Int_t ddlId, Bool_t warn = true) const;
-    AliMpDetElement*   GetDetElement(Int_t detElemId, Bool_t warn = true) const;
-    AliMpBusPatch*     GetBusPatch(Int_t busPatchId, Bool_t warn = true) const;
-    AliMpLocalBoard*   GetLocalBoard(Int_t localBoardId, Bool_t warn = true) const;
-    AliMpTriggerCrate* GetTriggerCrate(TString crateName, Bool_t warn = true) const;
-    AliMpTriggerCrate* GetTriggerCrate(Int_t ddlId, Int_t index, Bool_t warn = true) const;
+    AliMpDDL*         GetDDL(Int_t ddlId, Bool_t warn = true) const;
+    AliMpDetElement*  GetDetElement(Int_t detElemId, Bool_t warn = true) const;
+    AliMpBusPatch*    GetBusPatch(Int_t busPatchId, Bool_t warn = true) const;
 
     Int_t  GetDEfromBus(Int_t busPatchId) const;
-    Int_t  GetDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const;
-    Int_t  GetNextDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const;
-    Int_t  GetPreviousDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const;
-
     Int_t  GetDDLfromBus(Int_t busPatchId) const;
     Int_t  GetBusPatchId(Int_t detElemId, Int_t manuId) const;
     
-
     AliMpIntPair  GetDetElemIdManu(Int_t manuSerial) const;
 
     void PrintAllManu() const;
@@ -74,25 +63,20 @@ class AliMpDDLStore : public  TObject {
     Int_t  GetManuListIndex(Int_t detElemId) const;
     Int_t  GetBusPatchIndex(Int_t detElemId, Int_t manuId) const;
     Bool_t ReadDDLs();
-    Bool_t ReadTriggerDDLs();
     Bool_t SetManus();
     Bool_t SetPatchModules();
-    Int_t  GetLocalBoardId(TString name) const;
 
     // static data members	
     static AliMpDDLStore* fgInstance; ///< Singleton instance
     static const Int_t    fgkNofDDLs; ///< Total number of DDLs
-    static const Int_t    fgkNofTriggerDDLs; ///< Total number of trigger DDLs
 
     // data members	
     TObjArray     fDDLs;           ///< Array of DDL objects
     AliMpDEStore* fDetElements;    ///< Detection element store
     AliMpExMap    fBusPatches;     ///< The map of bus patches per their IDs
-    AliMpExMap    fTriggerCrates;  ///< The map of trigger crate per their ID
-    AliMpExMap    fLocalBoards;    ///< The map of local board per their ID
     TArrayI       fManuList12[16]; ///< Arrays of 1st manu in bus
 
-  ClassDef(AliMpDDLStore,2)  // The manager class for definition of detection element types
+  ClassDef(AliMpDDLStore,1)  // The manager class for definition of detection element types
 };
 
 #endif //ALI_MP_DDL_STORE_H
diff --git a/MUON/mapping/AliMpDEVisu.cxx b/MUON/mapping/AliMpDEVisu.cxx
index c1de220b1b4..4d5ebfcd1fd 100644
--- a/MUON/mapping/AliMpDEVisu.cxx
+++ b/MUON/mapping/AliMpDEVisu.cxx
@@ -160,7 +160,7 @@ AliMpDEVisu::AliMpDEVisu(UInt_t w, UInt_t h)
   fCurrentDEName = detElem->GetDEName();
   fNameDECombo = new  TGComboBox(hframe, kDEName);
 
-  UpdateNameView(kTRUE);
+  UpdateNameView();
   fNameDECombo->Resize(160, 20);
   fNameDECombo->Select(0);
   fNameDECombo->Associate(this);
@@ -367,10 +367,6 @@ void AliMpDEVisu::DrawDE(Bool_t info)
   fEcanvas->GetCanvas()->cd();
   fEcanvas->GetCanvas()->SetEditable(kTRUE);
   
-  fNameDECombo->Select(fDEOccurrence[fCurrentDetElem]);
-  TGLBEntry* entry = fNameDECombo->GetSelectedEntry();
-  entry->SetBackgroundColor(0xDDDDDD);
-
   if (AliMpDEManager::GetStationType(fCurrentDetElem) == AliMp::kStation345 ) {
     
     DrawSlat("PMCI");
@@ -609,7 +605,7 @@ Bool_t AliMpDEVisu::ProcessMessage(Long_t msg, Long_t parm1, Long_t /*parm2*/)
           {
             case kChamberCombo: 
               UpdateComboDE();
-              UpdateNameView(kTRUE);
+              UpdateNameView();
               break;
               
             case kDECombo:
@@ -680,13 +676,13 @@ void AliMpDEVisu::UpdateComboCH()
 
     AliMpDetElement* detElem = AliMpDEManager::GetDetElement(fCurrentDEName);
 
-    Int_t idx =  AliMpDEManager::GetChamberId(detElem->GetId());
-    fChamberCombo->Select(idx);
+    Int_t Idx =  AliMpDEManager::GetChamberId(detElem->GetId());
+    fChamberCombo->Select(Idx);
 
     UpdateComboDE();
 
-    idx = detElem->GetId() % 100;
-    fDECombo->Select(idx);
+    Idx = detElem->GetId() % 100;
+    fDECombo->Select(Idx);
 
     fCurrentDetElem = fDEComboIdx[fDECombo->GetSelected()];
 
@@ -713,7 +709,7 @@ void AliMpDEVisu::UpdateComboDE()
 }
 
 //__________________________________________________________
-void AliMpDEVisu::UpdateNameView(Bool_t firstTime)
+void AliMpDEVisu::UpdateNameView()
 {
   /// update DE name in respect to selected DE id.
     
@@ -723,21 +719,11 @@ void AliMpDEVisu::UpdateNameView(Bool_t firstTime)
 
   fCurrentDEName = detElem->GetDEName();
 
-  if (firstTime) {
-    AliMpDEIterator it;
- 
-    fNameDECombo->RemoveAll();
-  
-    for ( it.First(fChamberCombo->GetSelected()); !it.IsDone(); it.Next() ) {
-
-      Int_t detElemId = it.CurrentDE()->GetId();
-      TString deName  = it.CurrentDE()->GetDEName();
-
-      Int_t idx = fNameDECombo->GetNumberOfEntries();
-      fNameDECombo->AddEntry(deName.Data(), idx);
-      fNameDEComboIdx[idx]   = deName;
-      fDEOccurrence[detElemId] = idx;
-    }
+  Int_t entry = fNameDECombo->GetNumberOfEntries();
+  if (fDEOccurrence[fCurrentDetElem] == -1) {
+      fNameDECombo->AddEntry(fCurrentDEName.Data(), entry);
+      fNameDEComboIdx[entry] = fCurrentDEName;
+      fDEOccurrence[fCurrentDetElem] = entry;
   }
 
   fNameDECombo->Select(fDEOccurrence[fCurrentDetElem]);
diff --git a/MUON/mapping/AliMpDEVisu.h b/MUON/mapping/AliMpDEVisu.h
index 93a3e0c55ed..53bf514b1cf 100644
--- a/MUON/mapping/AliMpDEVisu.h
+++ b/MUON/mapping/AliMpDEVisu.h
@@ -53,7 +53,7 @@ class AliMpDEVisu : public TGFrame
     void   DrawSlat(Option_t* option, Bool_t popup = kFALSE);
 
     void   ResetManu();
-    void   UpdateNameView(Bool_t firstTime = kFALSE);
+    void   UpdateNameView();
     void   PopUpManuMotif(AliMpSlat* slat);
     void   PopUpManuMotif(AliMpSector* sector);
     void   PopUpZoom(Int_t ix0, Int_t iy0, Int_t ix1, Int_t iy1);
diff --git a/MUON/mapping/AliMpLocalBoard.cxx b/MUON/mapping/AliMpLocalBoard.cxx
deleted file mode 100644
index 3dc0e5aa465..00000000000
--- a/MUON/mapping/AliMpLocalBoard.cxx
+++ /dev/null
@@ -1,202 +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.                  *
- **************************************************************************/
-
-
-//
-// --------------------
-// Class AliMpLocalBoard
-// --------------------
-// The class defines the properties of local board
-// Author: Ch. Finck, Subatech Nantes
-
-#include "AliMpLocalBoard.h"
-#include "AliMpConstants.h"
-#include "AliMpIntPair.h"
-
-#include "AliLog.h"
-
-#include 
-#include 
-
-/// \cond CLASSIMP
-ClassImp(AliMpLocalBoard)
-/// \endcond
-
-
-//_____________________________________________________________________________
-AliMpLocalBoard::AliMpLocalBoard(Int_t id, const Char_t* name, Int_t slot)
-    : TNamed(name, "mapping trigger local board"),
-      fId(id),
-      fSlot(slot),
-      fTC(true),
-      fCrate(),
-      fSwitches(false),
-      fNotified(true),
-      fDEId(false)
-
-{
-/// Default constructor
-}
-
-//______________________________________________________________________________
-AliMpLocalBoard::AliMpLocalBoard(TRootIOCtor* /*ioCtor*/)
-    : TNamed(),
-      fId(),
-      fSlot(),
-      fTC(),
-      fCrate(),
-      fSwitches(),
-      fNotified(),
-      fDEId()
-{
-/// Root IO constructor
-}
-
-
-//_____________________________________________________________________________
-AliMpLocalBoard::~AliMpLocalBoard() 
-{
-/// Destructor
-
-}
-
-//_____________________________________________________________________________
-Int_t AliMpLocalBoard::GetIndex(Int_t chamberId) const
-{
-/// Return the index from chamver Id.
-/// chamberId could range from 10-13 in absolute value
-/// chamberId could also range from 0-3 in relative value
-
-   Int_t index = chamberId;
-   
-   if ( chamberId >= AliMpConstants::NofTrackingChambers() && 
-        chamberId <  AliMpConstants::NofChambers() )
-   {
-       index -= AliMpConstants::NofTrackingChambers();
-   } 
-
-   if (index < 0 || index >=  AliMpConstants::NofTriggerChambers() ) 
-   {
-     AliError(Form("chamber# %d not a valid trigger chamber Id, [0-3] or [10-13]", chamberId));
-     return -1;
-   }
-
-   return index;
-}
-
-
-//______________________________________________________________________________
-Bool_t AliMpLocalBoard::AddDE(Int_t detElemId)
-{
-/// Add detection element with given detElemId.
-/// Return true if the detection element was added
-
- if ( HasDEId(detElemId) ) {
-    AliWarningStream() 
-      << "Detection element Id = " << detElemId << " already present."
-      << endl;
-    return false;
- }
-
-  fDEId.Add(detElemId);
-  return true;
-}   
-
-
-//______________________________________________________________________________
-Int_t AliMpLocalBoard::GetNofDEs() const
-{  
-/// Return the number of detection elements connected to this crate
-
-  return fDEId.GetSize(); 
-}
-
-//______________________________________________________________________________
-Int_t  AliMpLocalBoard::GetDEId(Int_t index) const
-{  
-/// Return the detection element by index (in loop)
-
-  return fDEId.GetValue(index); 
-}
-
-//______________________________________________________________________________
-Int_t  AliMpLocalBoard::GetDEIdByChamber(Int_t chamberId) const
-{  
-/// Return the detection element by index (in loop)
-
-  return fDEId.GetValue(GetIndex(chamberId)); 
-}
-
-//______________________________________________________________________________
-Bool_t  AliMpLocalBoard::HasDEId(Int_t detElemId) const
-{  
-/// Return true if the detection element Id is present
-
-  return fDEId.HasValue(detElemId); 
-}
-
-//______________________________________________________________________________
-Bool_t AliMpLocalBoard::AddSwitch(Int_t swit)
-{
-/// Add a swicth for the given local board
-/// Return true if switch was added
-
-    if ( swit > 1 ) {
-      AliWarningStream() 
-	  << "Invalid value for switch = " << swit 
-	  << endl;
-      return false;
-    }
-
-    fSwitches.Add(swit);
-    return true;
-}   
-
-
-//______________________________________________________________________________
-Int_t AliMpLocalBoard::GetNofSwitches() const
-{  
-/// Return the number switches in this local board
-
-  return fSwitches.GetSize(); 
-}
-
-//______________________________________________________________________________
-Int_t  AliMpLocalBoard::GetSwitch(Int_t index) const
-{
-/// Return switch by index (in loop)
-
-    if (index < fSwitches.GetSize())
-	return fSwitches.GetValue(index);
-    else 
-	AliWarning("Switch index too large");
-
-    return -1;
-}
-
-//______________________________________________________________________________
-AliMpIntPair AliMpLocalBoard::GetPosition() const
-{
-/// gives position of the local board in (line, col)
-
-    const Char_t* boardName = GetName();
-    Int_t iLine = boardName[4] - '0';
-    Int_t iCol = boardName[2] - '0';
-    if ( iLine == 5 ) --iCol;
-
-    return (AliMpIntPair(iLine, iCol));
-
-}
-
diff --git a/MUON/mapping/AliMpLocalBoard.h b/MUON/mapping/AliMpLocalBoard.h
deleted file mode 100644
index a8a6ebeb29a..00000000000
--- a/MUON/mapping/AliMpLocalBoard.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $Id$
-// $MpId: AliMpManuGeo.h,v 1.5 2006/05/24 13:58:16 ivana Exp $
-
-/// \ingroup management
-/// \class AliMpLocalBoard
-/// \brief Class that manages the properties of the local board
-///
-/// \author Ch. Finck; Subatech Nantes
-
-#ifndef ALI_MP_LOCAL_BOARD_H
-#define ALI_MP_LOCAL_BOARD_H
-
-#include 
-
-#include  "AliMpArrayI.h"
-
-class TString;
-
-class AliMpLocalBoard : public TNamed
-{
-
- public:
-    AliMpLocalBoard(Int_t id, const Char_t* name, Int_t slot);
-    AliMpLocalBoard(TRootIOCtor* /*ioCtor*/);
-    virtual ~AliMpLocalBoard();
-    
-    // detElem
-    Bool_t AddDE(Int_t detElemId);
-    Int_t  GetNofDEs() const;
-    Int_t  GetDEId(Int_t index) const;
-    Int_t  GetDEIdByChamber(Int_t chamberId) const;
-    Bool_t HasDEId(Int_t detElemId) const;
-
-    // get methods
-    //
-           /// Return the identifier (unique)
-    Int_t  GetId()   const {return fId;}
-           /// Return the slot Identifier in the given crate
-    Int_t  GetSlot() const {return fSlot;}
-
-    // Switches
-    //
-    Bool_t AddSwitch(Int_t swit);
-    Int_t  GetNofSwitches() const;
-    Int_t  GetSwitch(Int_t index) const;
-
-
-    // Transverse connector
-    //     
-             /// Set transverse connector
-    void     SetTC(Bool_t connect) {fTC = connect;}
-             /// Return transverse connector
-    Bool_t   GetTC() const {return fTC;}
-
-    // Crate name
-    //
-             /// Set crate name
-    void     SetCrate(TString name) {fCrate = name;}
-             /// Return crate name
-    TString  GetCrate() const {return fCrate;}
-
-    // Notify
-    //
-             /// Set notified flag (not copy card)
-    void     SetNotified(Bool_t notify) {fNotified = notify;}
-             /// Return notified flag (not copy card) 
-    Bool_t   IsNotified() const {return fNotified;}
-
-    // given position (line, col)
-    AliMpIntPair GetPosition() const;
-
-
- private:
-  /// Not implemented
-   AliMpLocalBoard();
-  /// Not implemented
-   AliMpLocalBoard(const AliMpLocalBoard& src);
-   /// Not implemented
-   AliMpLocalBoard& operator = (const AliMpLocalBoard& src) ;
-
-   Int_t GetIndex(Int_t chamberId) const;
-   
-   Int_t       fId;       ///< Identifier (unique)
-   Int_t       fSlot;     ///< Slot Identifier in the given crate 
-
-   Bool_t      fTC;       ///< Transverse connector
-   TString     fCrate;    ///< Crate name
-   AliMpArrayI fSwitches; ///< switches
-   Bool_t      fNotified; ///< notified flag (not copy card)
-   AliMpArrayI fDEId;    ///< list of Detection element to which this local board is connected
-
-  ClassDef(AliMpLocalBoard,1) //utility class for the motif type
-};
-
-
-#endif 
diff --git a/MUON/mapping/AliMpTrigger.h b/MUON/mapping/AliMpTrigger.h
index fddb28e6c2e..4f8d6622e29 100644
--- a/MUON/mapping/AliMpTrigger.h
+++ b/MUON/mapping/AliMpTrigger.h
@@ -4,7 +4,7 @@
 // $Id$
 // $MpId: AliMpTrigger.h,v 1.5 2006/05/24 13:58:27 ivana Exp $
 
-/// \ingroup mptrigger
+/// \ingroup trigger
 /// \class AliMpTrigger
 /// \brief A trigger slat
 ///
diff --git a/MUON/mapping/AliMpTriggerCrate.cxx b/MUON/mapping/AliMpTriggerCrate.cxx
deleted file mode 100644
index 30d86b3baa5..00000000000
--- a/MUON/mapping/AliMpTriggerCrate.cxx
+++ /dev/null
@@ -1,127 +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.                  *
- **************************************************************************/
-
-
-//
-// --------------------
-// Class AliMpTriggerCrate
-// --------------------
-// The class defines the properties of trigger crate
-// Author: Ch. Finck, Subatech Nantes
-
-#include "AliMpTriggerCrate.h"
-#include "AliMpDEManager.h"
-
-#include "AliLog.h"
-
-#include 
-
-/// \cond CLASSIMP
-ClassImp(AliMpTriggerCrate)
-/// \endcond
-
-
-//______________________________________________________________________________
-TString AliMpTriggerCrate::GenerateName(Int_t crateId, Int_t ddlId, Int_t nofDDLs)
-{
-/// Generate name
-
-  TString name;
-  // \todo parameterise this
-  if (crateId == 23)
-      name = "2-3";
-  else 
-      name = Form("%d", crateId);
- 
-  if (ddlId == nofDDLs)
-      name.Append("R");
-  else 
-      name.Append("L"); 
-
-  return name;
-}  
- 
-
-//______________________________________________________________________________
-AliMpTriggerCrate::AliMpTriggerCrate(const Char_t* name, Int_t ddlId)
-  : TNamed(name, "mapping trigger crate"),
-    fDdlId(ddlId),
-    fLocalBoard(false)
- 
-{
-/// Standard constructor
-}
-
-//______________________________________________________________________________
-AliMpTriggerCrate::AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/)
-  : TNamed(),
-    fDdlId(),
-    fLocalBoard()
-{
-/// Root IO constructor
-}
-
-//______________________________________________________________________________
-AliMpTriggerCrate::~AliMpTriggerCrate()
-{
-/// Destructor
-}
-
-//
-// public methods
-//
-
-//______________________________________________________________________________
-Bool_t AliMpTriggerCrate::AddLocalBoard(Int_t localBoardId)
-{
-/// Add detection element with given detElemId.
-/// Return true if the detection element was added
-
-  if ( HasLocalBoard(localBoardId) ) {
-    AliWarningStream() 
-      << "Local board with Id=" << localBoardId << " already present."
-      << endl;
-    return false;
-  }    
-
-  fLocalBoard.Add(localBoardId);
-  return true;
-}   
-
-
-//______________________________________________________________________________
-Int_t AliMpTriggerCrate::GetNofLocalBoards() const
-{  
-/// Return the number of local board in this crate
-
-  return fLocalBoard.GetSize(); 
-}
-
-//______________________________________________________________________________
-Int_t  AliMpTriggerCrate::GetLocalBoardId(Int_t index) const
-{  
-/// Return the local board by index (in loop)
-
-  return fLocalBoard.GetValue(index); 
-}
-
-//______________________________________________________________________________
-Bool_t  AliMpTriggerCrate::HasLocalBoard(Int_t localBoardId) const
-{  
-/// Return true if crate has local boardwith given localBoardId
-
-  return fLocalBoard.HasValue(localBoardId); 
-}
-
diff --git a/MUON/mapping/AliMpTriggerCrate.h b/MUON/mapping/AliMpTriggerCrate.h
deleted file mode 100644
index 49ae9eea9dd..00000000000
--- a/MUON/mapping/AliMpTriggerCrate.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-// $MpId: $ 
-
-/// \ingroup management
-/// \class AliMpTriggerCrate
-/// \brief The class defines the properties of trigger crate
-///
-/// \author Ch. Finck, Subatech Nantes
-
-#ifndef ALI_MP_TRIGGER_CRATE_H
-#define ALI_MP_TRIGGER_CRATE_H
-
-#include "AliMpArrayI.h"
-
-#include 
-#include 
-
-class AliMpTriggerCrate : public  TNamed {
-
-  public:
-    AliMpTriggerCrate(const Char_t* name, Int_t ddlId);
-    AliMpTriggerCrate(TRootIOCtor* /*ioCtor*/);
-    virtual ~AliMpTriggerCrate();
-    
-    static TString GenerateName(Int_t crateId, Int_t ddlId, Int_t nodDdls);
-
-    // methods 
-    Bool_t AddLocalBoard(Int_t localBoardId);
-
-    // get methods
-    Int_t  GetDdlId() const;
-
-    Int_t  GetNofLocalBoards() const;
-    Int_t  GetLocalBoardId(Int_t index) const;
-    Bool_t HasLocalBoard(Int_t localBoardId) const;
-    
-
-  private:
-    /// Not implemented
-    AliMpTriggerCrate();
-    /// Not implemented
-    AliMpTriggerCrate(const AliMpTriggerCrate& rhs);
-    /// Not implemented
-    AliMpTriggerCrate& operator=(const AliMpTriggerCrate& rhs);
-
-    // data members	
-    Int_t        fDdlId; ///< DDL to which this bus patch is connected
-    AliMpArrayI  fLocalBoard; ///< local board connected to this crate
-    
-  ClassDef(AliMpTriggerCrate,1)  // The class collectiong electronics properties of DDL
-};
-
-// inline functions
-
-
-/// Return the Ddl  Id
-inline Int_t AliMpTriggerCrate::GetDdlId() const
-{  return fDdlId; }
-
-#endif //ALI_BUS_PATCH_H
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/MUON/mapping/AliMpTriggerReader.h b/MUON/mapping/AliMpTriggerReader.h
index ed51ff16117..cccf7be338a 100644
--- a/MUON/mapping/AliMpTriggerReader.h
+++ b/MUON/mapping/AliMpTriggerReader.h
@@ -4,7 +4,7 @@
 // $Id$
 // $MpId: AliMpTriggerReader.h,v 1.5 2006/05/24 13:58:27 ivana Exp $
 
-/// \ingroup mptrigger
+/// \ingroup trigger
 /// \class AliMpTriggerReader
 /// \brief Read trigger slat ASCII files
 ///
diff --git a/MUON/mapping/AliMpTriggerSegmentation.h b/MUON/mapping/AliMpTriggerSegmentation.h
index 358f76350e3..16ff57e4686 100644
--- a/MUON/mapping/AliMpTriggerSegmentation.h
+++ b/MUON/mapping/AliMpTriggerSegmentation.h
@@ -4,7 +4,7 @@
 // $Id$
 // $MpId: AliMpTriggerSegmentation.h,v 1.8 2006/05/24 13:58:27 ivana Exp $
 
-/// \ingroup mptrigger
+/// \ingroup trigger
 /// \class AliMpTriggerSegmentation
 /// \brief Implementation of AliMpVSegmentation for trigger slats.
 ///
diff --git a/MUON/mapping/data/station1/denames.dat b/MUON/mapping/data/station1/denames.dat
index c88c7394438..36fc045d814 100644
--- a/MUON/mapping/data/station1/denames.dat
+++ b/MUON/mapping/data/station1/denames.dat
@@ -4,16 +4,16 @@ undefined  undefined
 
 # Station 1 - Chamber 1 
 
-100  st1_quadrant8  st1q_bp   st1q_nbp
-101  st1_quadrant6  st1q_nbp  st1q_bp
-102  st1_quadrant4  st1q_bp   st1q_nbp
-103  st1_quadrant1  st1q_nbp  st1q_bp 
+100  st1_quadrant1  st1q_bp   st1q_nbp
+101  st1_quadrant2  st1q_nbp  st1q_bp
+102  st1_quadrant3  st1q_bp   st1q_nbp
+103  st1_quadrant4  st1q_nbp  st1q_bp 
 
 # Station 1 - Chamber 2 
 
-200  st1_quadrant3  st1q_bp   st1q_nbp
-201  st1_quadrant2  st1q_nbp  st1q_bp
+200  st1_quadrant5  st1q_bp   st1q_nbp
+201  st1_quadrant6  st1q_nbp  st1q_bp
 202  st1_quadrant7  st1q_bp   st1q_nbp
-203  st1_quadrant5  st1q_nbp  st1q_bp 
+203  st1_quadrant8  st1q_nbp  st1q_bp 
 
 
diff --git a/MUON/mapping/data/station345/denames.dat b/MUON/mapping/data/station345/denames.dat
index 23058f370af..43d7b8551c3 100644
--- a/MUON/mapping/data/station345/denames.dat
+++ b/MUON/mapping/data/station345/denames.dat
@@ -30,16 +30,16 @@ bp  nbp
 602 122200N_SAC_01	122200N
 603 222000N_CAG_05	222000N
 604 220000N_GAT_05	220000N
-605 220000N_GAT_08	220000N
-606 222000N_CAG_03	222000N
-607 122200N_SAC_02	122200N
+605 220000N_GAT_06	220000N
+606 222000N_CAG_06	222000N
+607 122200N_NAN_01	122200N
 608 112200NR2_SAC_02	112200NR2
-609 122000NR1_NAN_03	122000NR1
+609 122000NR1_NAN_02	122000NR1
 610 112200NR2_SAC_03	112200NR2
-611 122200N_SAC_01	122200N
-612 222000N_CAG_06	222000N
-613 220000N_GAT_06	220000N
-614 220000N_GAT_58	220000N
+611 122200N_SAC_02	122200N
+612 222000N_CAG_07	222000N
+613 220000N_GAT_07	220000N
+614 220000N_GAT_08	220000N
 615 222000N_CAG_08	222000N
 616 122200N_NAN_02	122200N
 617 112200NR2_SAC_04	112200NR2
diff --git a/MUON/mapping/data/station345/manu_serial/122000NR1_NAN_03_manu.dat b/MUON/mapping/data/station345/manu_serial/122000NR1_NAN_03_manu.dat
deleted file mode 100644
index 621d05443ec..00000000000
--- a/MUON/mapping/data/station345/manu_serial/122000NR1_NAN_03_manu.dat
+++ /dev/null
@@ -1,81 +0,0 @@
-# Id serial
-  1  bp 21179
-  2  bp 18309
-  3  bp 21226
-  4 nbp 21158
-  5 nbp 21165
-  6  bp 21223
-  7  bp 21215
-  8  bp 21214
-  9  bp 21211
- 10  bp 21203
- 11  bp 21200
- 12  bp 21210
- 13  bp 21167
- 14  bp 21173
- 15  bp 21148
- 16 nbp 21164
- 17 nbp 21195
- 18 nbp 21193
- 19 nbp 19917
- 20 nbp 21206
- 21 nbp 21222
- 22 nbp 21180
-101 nbp 21198
-102 nbp 21187
-103 nbp 21166
-104  bp 21136
-105  bp 21128
-106  bp 21121
-107  bp 21142
-108  bp 21155
-109 nbp 21205
-110 nbp 21220
-111 nbp 21168
-112  bp 21199
-113  bp 21276
-114  bp 21213
-115  bp 21159
-116  bp 21153
-201  bp 21152
-202  bp 21123
-203  bp 21137
-204  bp 21129
-205  bp 21150
-206 nbp 21201
-207 nbp 21178
-208 nbp 21191
-209 nbp 21184
-210  bp 21170
-211  bp 16597
-212  bp 20929
-213  bp 21151
-214  bp 21146
-215 nbp 21160
-216 nbp 21229
-217 nbp 20070
-218 nbp 16534
-301 nbp 21253
-302 nbp 21227
-303 nbp 21235
-304  bp 21252
-305  bp 21236
-306  bp 21237
-307  bp 21250
-308 nbp 21244
-309 nbp 21251
-310 nbp 21228
-311 nbp 21212
-312 nbp 21202
-313 nbp 16812
-314 nbp 21219
-315  bp 21175
-316  bp 21182
-317  bp 16639
-318  bp 21188
-319  bp 21194
-320  bp 18249
-321  bp 20090
-322  bp 21161
-323  bp 16936
-324  bp 21242
diff --git a/MUON/mapping/data/station345/manu_serial/220000N_GAT_06_manu.dat b/MUON/mapping/data/station345/manu_serial/220000N_GAT_06_manu.dat
deleted file mode 100644
index adb7d8d8fdf..00000000000
--- a/MUON/mapping/data/station345/manu_serial/220000N_GAT_06_manu.dat
+++ /dev/null
@@ -1,35 +0,0 @@
-# Id serial
-  1 nbp 21196
-  2 nbp 18283
-  3 nbp 21192
-  4  bp 20703
-  5  bp 20640
-  6  bp 20705
-  7  bp 21270
-  8  bp 18602
-  9 nbp 21264
- 10 nbp 21254
- 11 nbp 21272
- 12  bp 20551
- 13  bp 20694
- 14  bp 20712
- 15  bp 20645
- 16  bp 20644
-101  bp 20637
-102  bp 21243
-103  bp 16458
-104  bp 21208
-105  bp 20726
-106 nbp 21207
-107 nbp 20721
-108 nbp 21260
-109 nbp 21197
-110  bp 21209
-111  bp 21248
-112  bp 20435
-113  bp 21241
-114  bp 21268
-115 nbp 21189
-116 nbp 21216
-117 nbp 20702
-118 nbp 20710
diff --git a/MUON/mapping/data/stationTrigger/crate.dat b/MUON/mapping/data/stationTrigger/crate.dat
index 0e289e8d370..b3b2097c846 100644
--- a/MUON/mapping/data/stationTrigger/crate.dat
+++ b/MUON/mapping/data/stationTrigger/crate.dat
@@ -1,8 +1,6 @@
 *********************************************
 Board  1     Board num  RC1L1B12     CRATE  1 R    Slot = 1
 
-DetElemId  1114  1214  1314  1414 
-
 X1input1 = 1RC1L1X1         X1input2 = 1RC1L1X2
 X2input1 = 2RC1L1X1         X2input2 = 2RC1L1X2
 X3input1 = 3RC1L1X1         X3input2 = 3RC1L1X2
@@ -22,8 +20,6 @@ Switch( RC1L1B12 )
 *********************************************
 Board  2     Board num  RC1L2B12     CRATE  1 R    Slot = 2
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC1L2X1         X1input2 = 1RC1L2X2
 X2input1 = 2RC1L2X1         X2input2 = 2RC1L2X2
 X3input1 = 3RC1L2X1         X3input2 = 3RC1L2X2
@@ -43,8 +39,6 @@ Switch( RC1L2B12 )
 *********************************************
 Board  3     Board num  RC1L2B34     CRATE  1 R    Slot = 3
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC1L2X3         X1input2 = 1RC1L2X4
 X2input1 = 2RC1L2X3         X2input2 = 2RC1L2X4
 X3input1 = 3RC1L2X3         X3input2 = 3RC1L2X4
@@ -64,8 +58,6 @@ Switch( RC1L2B34 )
 *********************************************
 Board  4     Board num  RC1L3B12     CRATE  1 R    Slot = 4
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC1L3X1         X1input2 = 1RC1L3X2
 X2input1 = 2RC1L3X1         X2input2 = 2RC1L3X2
 X3input1 = 3RC1L3X1         X3input2 = 3RC1L3X2
@@ -85,8 +77,6 @@ Switch( RC1L3B12 )
 *********************************************
 Board  5     Board num  RC1L3B34     CRATE  1 R    Slot = 5
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC1L3X3         X1input2 = 1RC1L3X4
 X2input1 = 2RC1L3X3         X2input2 = 2RC1L3X4
 X3input1 = 3RC1L3X3         X3input2 = 3RC1L3X4
@@ -106,8 +96,6 @@ Switch( RC1L3B34 )
 *********************************************
 Board  6     Board num  RC1L4B12     CRATE  1 R    Slot = 6
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC1L4X1         X1input2 = 1RC1L4X2
 X2input1 = 2RC1L4X1         X2input2 = 2RC1L4X2
 X3input1 = 3RC1L4X1         X3input2 = 3RC1L4X2
@@ -127,8 +115,6 @@ Switch( RC1L4B12 )
 *********************************************
 Board  7     Board num  RC1L4B34     CRATE  1 R    Slot = 7
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC1L4X3         X1input2 = 1RC1L4X4
 X2input1 = 2RC1L4X3         X2input2 = 2RC1L4X4
 X3input1 = 3RC1L4X3         X3input2 = 3RC1L4X4
@@ -148,8 +134,6 @@ Switch( RC1L4B34 )
 *********************************************
 Board  8     Board num  RC1L4B56     CRATE  1 R    Slot = 8
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC1L4X5         X1input2 = 1RC1L4X6
 X2input1 = 2RC1L4X5         X2input2 = 2RC1L4X6
 X3input1 = 3RC1L4X5         X3input2 = 3RC1L4X6
@@ -169,8 +153,6 @@ Switch( RC1L4B56 )
 ******************************************
 Board  9     Board num  RC1L6B12     CRATE  1 R    Slot = 9
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC1L6X1         X1input2 = 1RC1L6X2
 X2input1 = 2RC1L6X1         X2input2 = 2RC1L6X2
 X3input1 = 3RC1L6X1         X3input2 = 3RC1L6X2
@@ -190,8 +172,6 @@ Switch( RC1L6B12 )
 *********************************************
 Board  10     Board num  RC1L6B34     CRATE  1 R    Slot = 10
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC1L6X3         X1input2 = 1RC1L6X4
 X2input1 = 2RC1L6X3         X2input2 = 2RC1L6X4
 X3input1 = 3RC1L6X3         X3input2 = 3RC1L6X4
@@ -211,8 +191,6 @@ Switch( RC1L6B34 )
 **********************************************
 Board  11     Board num  RC1L6B56     CRATE  1 R    Slot = 11
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC1L6X5         X1input2 = 1RC1L6X6
 X2input1 = 2RC1L6X5         X2input2 = 2RC1L6X6
 X3input1 = 3RC1L6X5         X3input2 = 3RC1L6X6
@@ -232,8 +210,6 @@ Switch( RC1L6B56 )
 **********************************************
 Board  12     Board num  RC1L7B12     CRATE  1 R    Slot = 12
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC1L7X1         X1input2 = 1RC1L7X2
 X2input1 = 2RC1L7X1         X2input2 = 2RC1L7X2
 X3input1 = 3RC1L7X1         X3input2 = 3RC1L7X2
@@ -253,8 +229,6 @@ Switch( RC1L7B12 )
 **********************************************
 Board  13     Board num  RC1L7B34     CRATE  1 R    Slot = 13
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC1L7X3         X1input2 = 1RC1L7X4
 X2input1 = 2RC1L7X3         X2input2 = 2RC1L7X4
 X3input1 = 3RC1L7X3         X3input2 = 3RC1L7X4
@@ -274,8 +248,6 @@ Switch( RC1L7B34 )
 **********************************************
 Board  14     Board num  RC1L8B12     CRATE  1 R    Slot = 14
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC1L8X1         X1input2 = 1RC1L8X2
 X2input1 = 2RC1L8X1         X2input2 = 2RC1L8X2
 X3input1 = 3RC1L8X1         X3input2 = 3RC1L8X2
@@ -295,8 +267,6 @@ Switch( RC1L8B12 )
 **********************************************
 Board  15     Board num  RC1L8B34     CRATE  1 R    Slot = 15
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC1L8X3         X1input2 = 1RC1L8X4
 X2input1 = 2RC1L8X3         X2input2 = 2RC1L8X4
 X3input1 = 3RC1L8X3         X3input2 = 3RC1L8X4
@@ -316,8 +286,6 @@ Switch( RC1L8B34 )
 **********************************************
 Board  16     Board num  RC1L9B12     CRATE  1 R    Slot = 16
 
-DetElemId  1104  1204  1304  1404 
-
 X1input1 = 1RC1L9X1         X1input2 = 1RC1L9X2
 X2input1 = 2RC1L9X1         X2input2 = 2RC1L9X2
 X3input1 = 3RC1L9X1         X3input2 = 3RC1L9X2
@@ -336,8 +304,6 @@ Switch( RC1L9B12 )
 
 *********************************************
 Board  17     Board num  RC2L1B12     CRATE  2 R    Slot = 1
-
-DetElemId  1114  1214  1314  1414 
     
 X1input1 = 1RC2L1X1         X1input2 = 1RC2L1X2
 X2input1 = 2RC2L1X1         X2input2 = 2RC2L1X2
@@ -358,8 +324,6 @@ Switch( RC2L1B12 )
 *********************************************
 Board  18     Board num  RC2L2B12     CRATE  2 R    Slot = 2
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC2L2X1         X1input2 = 1RC2L2X2
 X2input1 = 2RC2L2X1         X2input2 = 2RC2L2X2
 X3input1 = 3RC2L2X1         X3input2 = 3RC2L2X2
@@ -379,8 +343,6 @@ Switch( RC2L2B12 )
 *********************************************
 Board  19     Board num  RC2L2B34     CRATE  2 R    Slot = 3
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC2L2X3         X1input2 = 1RC2L2X4
 X2input1 = 2RC2L2X3         X2input2 = 2RC2L2X4
 X3input1 = 3RC2L2X3         X3input2 = 3RC2L2X4
@@ -400,8 +362,6 @@ Switch( RC2L2B34 )
 *********************************************
 Board  20     Board num  RC2L3B12     CRATE  2 R    Slot = 4
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC2L3X1         X1input2 = 1RC2L3X2
 X2input1 = 2RC2L3X1         X2input2 = 2RC2L3X2
 X3input1 = 3RC2L3X1         X3input2 = 3RC2L3X2
@@ -421,8 +381,6 @@ Switch( RC2L3B12 )
 *********************************************
 Board  21     Board num  RC2L3B34     CRATE  2 R    Slot = 5
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC2L3X3         X1input2 = 1RC2L3X4
 X2input1 = 2RC2L3X3         X2input2 = 2RC2L3X4
 X3input1 = 3RC2L3X3         X3input2 = 3RC2L3X4
@@ -442,8 +400,6 @@ Switch( RC2L3B34 )
 *********************************************
 Board  22     Board num  RC2L4B12     CRATE  2 R    Slot = 6
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC2L4X1         X1input2 = 1RC2L4X2
 X2input1 = 2RC2L4X1         X2input2 = 2RC2L4X2
 X3input1 = 3RC2L4X1         X3input2 = 3RC2L4X2
@@ -463,8 +419,6 @@ Switch( RC2L4B12 )
 *********************************************
 Board  23     Board num  RC2L4B34     CRATE  2 R    Slot = 7
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC2L4X3         X1input2 = 1RC2L4X4
 X2input1 = 2RC2L4X3         X2input2 = 2RC2L4X4
 X3input1 = 3RC2L4X3         X3input2 = 3RC2L4X4
@@ -484,8 +438,6 @@ Switch( RC2L4B34 )
 *********************************************
 Board  24     Board num  RC2L4B56     CRATE  2 R    Slot = 8
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC2L4X5         X1input2 = 1RC2L4X6
 X2input1 = 2RC2L4X5         X2input2 = 2RC2L4X6
 X3input1 = 3RC2L4X5         X3input2 = 3RC2L4X6
@@ -505,8 +457,6 @@ Switch( RC2L4B56 )
 ******************************************
 Board  25     Board num  RC2L4B78     CRATE  2 R    Slot = 9
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC2L4X7         X1input2 = 1RC2L4X8
 X2input1 = 2RC2L4X7         X2input2 = 2RC2L4X8
 X3input1 = 3RC2L4X7         X3input2 = 3RC2L4X8
@@ -526,8 +476,6 @@ Switch( RC2L4B78 )
 *********************************************
 Board  26     Board num  RC2L5B12     CRATE  2 R    Slot = 10
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC2L5X1         X1input2 = 1RC2L5X2
 X2input1 = 2RC2L5X1         X2input2 = 2RC2L5X2
 X3input1 = 3RC2L5X1         X3input2 = 3RC2L5X2
@@ -547,8 +495,6 @@ Switch( RC2L5B12 )
 **********************************************
 Board  27     Board num  RC2L5B34     CRATE  2 R    Slot = 11
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC2L5X3         X1input2 = 1RC2L5X4
 X2input1 = 2RC2L5X3         X2input2 = 2RC2L5X4
 X3input1 = 3RC2L5X3         X3input2 = 3RC2L5X4
@@ -568,8 +514,6 @@ Switch( RC2L5B34 )
 **********************************************
 Board  28     Board num  RC2L5B56     CRATE  2 R    Slot = 12
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC2L5X5         X1input2 = 1RC2L5X6
 X2input1 = 2RC2L5X5         X2input2 = 2RC2L5X6
 X3input1 = 3RC2L5X5         X3input2 = 3RC2L5X6
@@ -589,8 +533,6 @@ Switch( RC2L5B56 )
 **********************************************
 Board  29     Board num  RC2L5B78     CRATE  2 R    Slot = 13
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC2L5X7         X1input2 = 1RC2L5X8
 X2input1 = 2RC2L5X7         X2input2 = 2RC2L5X8
 X3input1 = 3RC2L5X7         X3input2 = 3RC2L5X8
@@ -610,8 +552,6 @@ Switch( RC2L5B78 )
 **********************************************
 Board  30     Board num  RC2L6B12     CRATE  2 R    Slot = 14
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC2L6X1         X1input2 = 1RC2L6X2
 X2input1 = 2RC2L6X1         X2input2 = 2RC2L6X2
 X3input1 = 3RC2L6X1         X3input2 = 3RC2L6X2
@@ -631,8 +571,6 @@ Switch( RC2L6B12 )
 **********************************************
 Board  31     Board num  RC2L6B34     CRATE  2 R    Slot = 15
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC2L6X3          X1input2 = 1RC2L6X4
 X2input1 = 2RC2L6X3          X2input2 = 2RC2L6X4
 X3input1 = 3RC2L6X3 (1)      X3input2 = 3RC2L6X4 (1)
@@ -652,8 +590,6 @@ Switch( RC2L6B34 )
 **********************************************
 Board  nn     Board num  RIntC2-Up     CRATE  2 R    Slot = 16
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3RC2L6X5 (2)         X3input2 = 3RC2L6X6 (2)
@@ -673,8 +609,6 @@ Switch( RIntC2-Up )
 *********************************************
 Board nn     Board num  RIntC2-Dw     CRATE  2-3 R    Slot = 1
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3RC2L6X3 (2)         X3input2 = 3RC2L6X4 (2)
@@ -694,8 +628,6 @@ Switch( RIntC2-Dw )
 *********************************************
 Board  32     Board num  RC2L6B56     CRATE  2-3 R    Slot = 2
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC2L6X5              X1input2 = 1RC2L6X6
 X2input1 = 2RC2L6X5              X2input2 = 2RC2L6X6
 X3input1 = 3RC2L6X5 (1)          X3input2 = 3RC2L6X6 (1)
@@ -715,8 +647,6 @@ Switch( RC2L6B56 )
 **********************************************
 Board  33     Board num  RC2L6B78     CRATE  2-3 R    Slot = 3
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC2L6X7         X1input2 = 1RC2L6X8
 X2input1 = 2RC2L6X7         X2input2 = 2RC2L6X8
 X3input1 = 3RC2L6X7         X3input2 = 3RC2L6X8
@@ -736,8 +666,6 @@ Switch( RC2L6B78 )
 **********************************************
 Board  34     Board num  RC2L7B12     CRATE  2-3 R    Slot = 4
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC2L7X1         X1input2 = 1RC2L7X2
 X2input1 = 2RC2L7X1         X2input2 = 2RC2L7X2
 X3input1 = 3RC2L7X1         X3input2 = 3RC2L7X2
@@ -757,8 +685,6 @@ Switch( RC2L7B12 )
 **********************************************
 Board  35     Board num  RC2L7B34     CRATE  2-3 R    Slot = 5
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC2L7X3         X1input2 = 1RC2L7X4
 X2input1 = 2RC2L7X3         X2input2 = 2RC2L7X4
 X3input1 = 3RC2L7X3         X3input2 = 3RC2L7X4
@@ -778,8 +704,6 @@ Switch( RC2L7B34 )
 **********************************************
 Board  36     Board num  RC2L8B12     CRATE  2-3 R    Slot = 6
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC2L8X1         X1input2 = 1RC2L8X2
 X2input1 = 2RC2L8X1         X2input2 = 2RC2L8X2
 X3input1 = 3RC2L8X1         X3input2 = 3RC2L8X2
@@ -799,8 +723,6 @@ Switch( RC2L8B12 )
 **********************************************
 Board  37     Board num  RC2L8B34     CRATE  2-3 R    Slot = 7
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC2L8X3         X1input2 = 1RC2L8X4
 X2input1 = 2RC2L8X3         X2input2 = 2RC2L8X4
 X3input1 = 3RC2L8X3         X3input2 = 3RC2L8X4
@@ -820,8 +742,6 @@ Switch( RC2L8B34 )
 **********************************************
 Board  38     Board num  RC2L9B12     CRATE  2-3 R    Slot = 8
 
-DetElemId  1104  1204  1304  1404 
-
 X1input1 = 1RC2L9X1         X1input2 = 1RC2L9X2
 X2input1 = 2RC2L9X1         X2input2 = 2RC2L9X2
 X3input1 = 3RC2L9X1         X3input2 = 3RC2L9X2
@@ -841,8 +761,6 @@ Switch( RC2L9B12 )
 *********************************************
 Board nn     Board num  RintC3-Dw     CRATE  2-3 R    Slot = 9
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3RC3L6X3 (2)         X3input2 = 3RC3L6X4 (2)
@@ -862,8 +780,6 @@ Switch( RIntC3-Dw )
 *********************************************
 Board  54     Board num  RC3L6B56     CRATE  2-3 R    Slot = 10
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC3L6X5              X1input2 = 1RC3L6X6
 X2input1 = 2RC3L6X5              X2input2 = 2RC3L6X6
 X3input1 = 3RC3L6X5 (1)          X3input2 = 3RC3L6X6 (1)
@@ -883,8 +799,6 @@ Switch( RC3L6B56 )
 **********************************************
 Board  55     Board num  RC3L6B78     CRATE  2-3 R    Slot = 11
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC3L6X7         X1input2 = 1RC3L6X8
 X2input1 = 2RC3L6X7         X2input2 = 2RC3L6X8
 X3input1 = 3RC3L6X7         X3input2 = 3RC3L6X8
@@ -904,8 +818,6 @@ Switch( RC3L6B78 )
 **********************************************
 Board  56     Board num  RC3L7B12     CRATE  2-3 R    Slot = 12
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC3L7X1         X1input2 = 1RC3L7X2
 X2input1 = 2RC3L7X1         X2input2 = 2RC3L7X2
 X3input1 = 3RC3L7X1         X3input2 = 3RC3L7X2
@@ -925,8 +837,6 @@ Switch( RC3L7B12 )
 **********************************************
 Board  57     Board num  RC3L7B34     CRATE  2-3 R    Slot = 13
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC3L7X3         X1input2 = 1RC3L7X4
 X2input1 = 2RC3L7X3         X2input2 = 2RC3L7X4
 X3input1 = 3RC3L7X3         X3input2 = 3RC3L7X4
@@ -946,8 +856,6 @@ Switch( RC3L7B34 )
 **********************************************
 Board  58     Board num  RC3L8B12     CRATE  2-3 R    Slot = 14
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC3L8X1         X1input2 = 1RC3L8X2
 X2input1 = 2RC3L8X1         X2input2 = 2RC3L8X2
 X3input1 = 3RC3L8X1         X3input2 = 3RC3L8X2
@@ -967,8 +875,6 @@ Switch( RC3L8B12 )
 **********************************************
 Board  59     Board num  RC3L8B34     CRATE  2-3 R    Slot = 15
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC3L8X3         X1input2 = 1RC3L8X4
 X2input1 = 2RC3L8X3         X2input2 = 2RC3L8X4
 X3input1 = 3RC3L8X3         X3input2 = 3RC3L8X4
@@ -988,8 +894,6 @@ Switch( RC3L8B34 )
 **********************************************
 Board  60     Board num  RC3L9B12     CRATE  2-3 R    Slot = 16
 
-DetElemId  1104  1204  1304  1404 
-
 X1input1 = 1RC3L9X1         X1input2 = 1RC3L9X2
 X2input1 = 2RC3L9X1         X2input2 = 2RC3L9X2
 X3input1 = 3RC3L9X1         X3input2 = 3RC3L9X2
@@ -1008,8 +912,6 @@ Switch( RC3L9B12 )
 
 *********************************************
 Board  39     Board num  RC3L1B12     CRATE  3 R    Slot = 1
-
-DetElemId  1114  1214  1314  1414 
     
 X1input1 = 1RC3L1X1         X1input2 = 1RC3L1X2
 X2input1 = 2RC3L1X1         X2input2 = 2RC3L1X2
@@ -1030,8 +932,6 @@ Switch( RC3L1B12 )
 *********************************************
 Board  40     Board num  RC3L2B12     CRATE  3 R    Slot = 2
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC3L2X1         X1input2 = 1RC3L2X2
 X2input1 = 2RC3L2X1         X2input2 = 2RC3L2X2
 X3input1 = 3RC3L2X1         X3input2 = 3RC3L2X2
@@ -1051,8 +951,6 @@ Switch( RC3L2B12 )
 *********************************************
 Board  41     Board num  RC3L2B34     CRATE  3 R    Slot = 3
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC3L2X3         X1input2 = 1RC3L2X4
 X2input1 = 2RC3L2X3         X2input2 = 2RC3L2X4
 X3input1 = 3RC3L2X3         X3input2 = 3RC3L2X4
@@ -1072,8 +970,6 @@ Switch( RC3L2B34 )
 *********************************************
 Board  42     Board num  RC3L3B12     CRATE  3 R    Slot = 4
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC3L3X1         X1input2 = 1RC3L3X2
 X2input1 = 2RC3L3X1         X2input2 = 2RC3L3X2
 X3input1 = 3RC3L3X1         X3input2 = 3RC3L3X2
@@ -1093,8 +989,6 @@ Switch( RC3L3B12 )
 *********************************************
 Board  43     Board num  RC3L3B34     CRATE  3 R    Slot = 5
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC3L3X3         X1input2 = 1RC3L3X4
 X2input1 = 2RC3L3X3         X2input2 = 2RC3L3X4
 X3input1 = 3RC3L3X3         X3input2 = 3RC3L3X4
@@ -1114,8 +1008,6 @@ Switch( RC3L3B34 )
 *********************************************
 Board  44     Board num  RC3L4B12     CRATE  3 R    Slot = 6
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC3L4X1         X1input2 = 1RC3L4X2
 X2input1 = 2RC3L4X1         X2input2 = 2RC3L4X2
 X3input1 = 3RC3L4X1         X3input2 = 3RC3L4X2
@@ -1135,8 +1027,6 @@ Switch( RC3L4B12 )
 *********************************************
 Board  45     Board num  RC3L4B34     CRATE  3 R    Slot = 7
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC3L4X3         X1input2 = 1RC3L4X4
 X2input1 = 2RC3L4X3         X2input2 = 2RC3L4X4
 X3input1 = 3RC3L4X3         X3input2 = 3RC3L4X4
@@ -1156,8 +1046,6 @@ Switch( RC3L4B34 )
 *********************************************
 Board  46     Board num  RC3L4B56     CRATE  3 R    Slot = 8
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC3L4X5         X1input2 = 1RC3L4X6
 X2input1 = 2RC3L4X5         X2input2 = 2RC3L4X6
 X3input1 = 3RC3L4X5         X3input2 = 3RC3L4X6
@@ -1177,8 +1065,6 @@ Switch( RC3L4B56 )
 ******************************************
 Board  47     Board num  RC3L4B78     CRATE  3 R    Slot = 9
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC3L4X7         X1input2 = 1RC3L4X8
 X2input1 = 2RC3L4X7         X2input2 = 2RC3L4X8
 X3input1 = 3RC3L4X7         X3input2 = 3RC3L4X8
@@ -1198,8 +1084,6 @@ Switch( RC3L4B78 )
 *********************************************
 Board  48     Board num  RC3L5B12     CRATE  3 R    Slot = 10
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC3L5X1         X1input2 = 1RC3L5X2
 X2input1 = 2RC3L5X1         X2input2 = 2RC3L5X2
 X3input1 = 3RC3L5X1         X3input2 = 3RC3L5X2
@@ -1219,8 +1103,6 @@ Switch( RC3L5B12 )
 **********************************************
 Board  49     Board num  RC3L5B34     CRATE  3 R    Slot = 11
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC3L5X3         X1input2 = 1RC3L5X4
 X2input1 = 2RC3L5X3         X2input2 = 2RC3L5X4
 X3input1 = 3RC3L5X3         X3input2 = 3RC3L5X4
@@ -1240,8 +1122,6 @@ Switch( RC3L5B34 )
 **********************************************
 Board  50     Board num  RC3L5B56     CRATE  3 R    Slot = 12
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC3L5X5         X1input2 = 1RC3L5X6
 X2input1 = 2RC3L5X5         X2input2 = 2RC3L5X6
 X3input1 = 3RC3L5X5         X3input2 = 3RC3L5X6
@@ -1261,8 +1141,6 @@ Switch( RC3L5B56 )
 **********************************************
 Board  51     Board num  RC3L5B78     CRATE  3 R    Slot = 13
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC3L5X7         X1input2 = 1RC3L5X8
 X2input1 = 2RC3L5X7         X2input2 = 2RC3L5X8
 X3input1 = 3RC3L5X7         X3input2 = 3RC3L5X8
@@ -1282,8 +1160,6 @@ Switch( RC3L5B78 )
 **********************************************
 Board  52     Board num  RC3L6B12     CRATE  3 R    Slot = 14
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC3L6X1         X1input2 = 1RC3L6X2
 X2input1 = 2RC3L6X1         X2input2 = 2RC3L6X2
 X3input1 = 3RC3L6X1         X3input2 = 3RC3L6X2
@@ -1303,8 +1179,6 @@ Switch( RC3L6B12 )
 **********************************************
 Board  53     Board num  RC3L6B34     CRATE  3 R    Slot = 15
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC3L6X3              X1input2 = 1RC3L6X4
 X2input1 = 2RC3L6X3              X2input2 = 2RC3L6X4
 X3input1 = 3RC3L6X3 (1)          X3input2 = 3RC3L6X4 (1)
@@ -1324,8 +1198,6 @@ Switch( RC3L6B34 )
 **********************************************
 Board  nn     Board num  RIntC3-Up     CRATE  3 R    Slot = 16
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3RC3L6X5 (2)         X3input2 = 3RC3L6X6 (2)
@@ -1344,8 +1216,6 @@ Switch( RIntC3-Up )
 
 *********************************************
 Board  61     Board num  RC4L1B12     CRATE  4 R    Slot = 1
-
-DetElemId  1114  1214  1314  1414 
     
 X1input1 = 1RC4L1X1         X1input2 = 1RC4L1X2
 X2input1 = 2RC4L1X1         X2input2 = 2RC4L1X2
@@ -1366,8 +1236,6 @@ Switch( RC4L1B12 )
 *********************************************
 Board  62     Board num  RC4L2B12     CRATE  4 R    Slot = 2
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC4L2X1         X1input2 = 1RC4L2X2
 X2input1 = 2RC4L2X1         X2input2 = 2RC4L2X2
 X3input1 = 3RC4L2X1         X3input2 = 3RC4L2X2
@@ -1387,8 +1255,6 @@ Switch( RC4L2B12 )
 *********************************************
 Board  63     Board num  RC4L2B34     CRATE  4 R    Slot = 3
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC4L2X3         X1input2 = 1RC4L2X4
 X2input1 = 2RC4L2X3         X2input2 = 2RC4L2X4
 X3input1 = 3RC4L2X3         X3input2 = 3RC4L2X4
@@ -1408,8 +1274,6 @@ Switch( RC4L2B34 )
 *********************************************
 Board  64     Board num  RC4L3B12     CRATE  4 R    Slot = 4
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC4L3X1         X1input2 = 1RC4L3X2
 X2input1 = 2RC4L3X1         X2input2 = 2RC4L3X2
 X3input1 = 3RC4L3X1         X3input2 = 3RC4L3X2
@@ -1429,8 +1293,6 @@ Switch( RC4L3B12 )
 *********************************************
 Board  65     Board num  RC4L3B34     CRATE  4 R    Slot = 5
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC4L3X3         X1input2 = 1RC4L3X4
 X2input1 = 2RC4L3X3         X2input2 = 2RC4L3X4
 X3input1 = 3RC4L3X3         X3input2 = 3RC4L3X4
@@ -1450,8 +1312,6 @@ Switch( RC4L3B34 )
 *********************************************
 Board  66     Board num  RC4L4B12     CRATE  4 R    Slot = 6
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC4L4X1         X1input2 = 1RC4L4X2
 X2input1 = 2RC4L4X1         X2input2 = 2RC4L4X2
 X3input1 = 3RC4L4X1         X3input2 = 3RC4L4X2
@@ -1471,8 +1331,6 @@ Switch( RC4L4B12 )
 *********************************************
 Board  67     Board num  RC4L4B34     CRATE  4 R    Slot = 7
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC4L4X3         X1input2 = 1RC4L4X4
 X2input1 = 2RC4L4X3         X2input2 = 2RC4L4X4
 X3input1 = 3RC4L4X3         X3input2 = 3RC4L4X4
@@ -1492,8 +1350,6 @@ Switch( RC4L4B34 )
 *********************************************
 Board  68     Board num  RC4L5B12     CRATE  4 R    Slot = 8
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC4L5X1         X1input2 = 1RC4L5X2
 X2input1 = 2RC4L5X1         X2input2 = 2RC4L5X2
 X3input1 = 3RC4L5X1         X3input2 = 3RC4L5X2
@@ -1513,8 +1369,6 @@ Switch( RC4L5B12 )
 ******************************************
 Board  69     Board num  RC4L5B34     CRATE  4 R    Slot = 9
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC4L5X3         X1input2 = 1RC4L5X4
 X2input1 = 2RC4L5X3         X2input2 = 2RC4L5X4
 X3input1 = 3RC4L5X3         X3input2 = 3RC4L5X4
@@ -1534,8 +1388,6 @@ Switch( RC4L5B34 )
 *********************************************
 Board  70     Board num  RC4L6B12     CRATE  4 R    Slot = 10
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC4L6X1         X1input2 = 1RC4L6X2
 X2input1 = 2RC4L6X1         X2input2 = 2RC4L6X2
 X3input1 = 3RC4L6X1         X3input2 = 3RC4L6X2
@@ -1555,8 +1407,6 @@ Switch( RC4L6B12 )
 **********************************************
 Board  71     Board num  RC4L6B34     CRATE  4 R    Slot = 11
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC4L6X3         X1input2 = 1RC4L6X4
 X2input1 = 2RC4L6X3         X2input2 = 2RC4L6X4
 X3input1 = 3RC4L6X3         X3input2 = 3RC4L6X4
@@ -1576,8 +1426,6 @@ Switch( RC4L6B34 )
 **********************************************
 Board  72     Board num  RC4L7B12     CRATE  4 R    Slot = 12
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC4L7X1         X1input2 = 1RC4L7X2
 X2input1 = 2RC4L7X1         X2input2 = 2RC4L7X2
 X3input1 = 3RC4L7X1         X3input2 = 3RC4L7X2
@@ -1597,8 +1445,6 @@ Switch( RC4L7B12 )
 **********************************************
 Board  73     Board num  RC4L7B34     CRATE  4 R    Slot = 13
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC4L7X3         X1input2 = 1RC4L7X4
 X2input1 = 2RC4L7X3         X2input2 = 2RC4L7X4
 X3input1 = 3RC4L7X3         X3input2 = 3RC4L7X4
@@ -1618,8 +1464,6 @@ Switch( RC4L7B34 )
 **********************************************
 Board  74     Board num  RC4L8B12     CRATE  4 R    Slot = 14
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC4L8X1         X1input2 = 1RC4L8X2
 X2input1 = 2RC4L8X1         X2input2 = 2RC4L8X2
 X3input1 = 3RC4L8X1         X3input2 = 3RC4L8X2
@@ -1639,8 +1483,6 @@ Switch( RC4L8B12 )
 **********************************************
 Board  75     Board num  RC4L8B34     CRATE  4 R    Slot = 15
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC4L8X3         X1input2 = 1RC4L8X4
 X2input1 = 2RC4L8X3         X2input2 = 2RC4L8X4
 X3input1 = 3RC4L8X3         X3input2 = 3RC4L8X4
@@ -1660,8 +1502,6 @@ Switch( RC4L8B34 )
 **********************************************
 Board  76     Board num  RC4L9B12     CRATE  4 R    Slot = 16
 
-DetElemId  1104  1204  1304  1404 
-
 X1input1 = 1RC4L9X1         X1input2 = 1RC4L9X2
 X2input1 = 2RC4L9X1         X2input2 = 2RC4L9X2
 X3input1 = 3RC4L9X1         X3input2 = 3RC4L9X2
@@ -1680,8 +1520,6 @@ Switch( RC4L9B12 )
 
 *********************************************
 Board  77     Board num  RC5L1B12     CRATE  5 R    Slot = 1
-
-DetElemId  1114  1214  1314  1414 
     
 X1input1 = 1RC5L1X1         X1input2 = 1RC5L1X2
 X2input1 = 2RC5L1X1         X2input2 = 2RC5L1X2
@@ -1702,8 +1540,6 @@ Switch( RC5L1B12 )
 *********************************************
 Board  78     Board num  RC5L2B12     CRATE  5 R    Slot = 2
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC5L2X1         X1input2 = 1RC5L2X2
 X2input1 = 2RC5L2X1         X2input2 = 2RC5L2X2
 X3input1 = 3RC5L2X1         X3input2 = 3RC5L2X2
@@ -1723,8 +1559,6 @@ Switch( RC5L2B12 )
 *********************************************
 Board  79     Board num  RC5L2B34     CRATE  5 R    Slot = 3
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC5L2X3         X1input2 = 1RC5L2X4
 X2input1 = 2RC5L2X3         X2input2 = 2RC5L2X4
 X3input1 = 3RC5L2X3         X3input2 = 3RC5L2X4
@@ -1744,8 +1578,6 @@ Switch( RC5L2B34 )
 *********************************************
 Board  80     Board num  RC5L3B12     CRATE  5 R    Slot = 4
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC5L3X1         X1input2 = 1RC5L3X2
 X2input1 = 2RC5L3X1         X2input2 = 2RC5L3X2
 X3input1 = 3RC5L3X1         X3input2 = 3RC5L3X2
@@ -1765,8 +1597,6 @@ Switch( RC5L3B12 )
 *********************************************
 Board  81     Board num  RC5L3B34     CRATE  5 R    Slot = 5
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC5L3X3         X1input2 = 1RC5L3X4
 X2input1 = 2RC5L3X3         X2input2 = 2RC5L3X4
 X3input1 = 3RC5L3X3         X3input2 = 3RC5L3X4
@@ -1786,8 +1616,6 @@ Switch( RC5L3B34 )
 *********************************************
 Board  82     Board num  RC5L4B12     CRATE  5 R    Slot = 6
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC5L4X1         X1input2 = 1RC5L4X2
 X2input1 = 2RC5L4X1         X2input2 = 2RC5L4X2
 X3input1 = 3RC5L4X1         X3input2 = 3RC5L4X2
@@ -1807,8 +1635,6 @@ Switch( RC5L4B12 )
 *********************************************
 Board  83     Board num  RC5L4B34     CRATE  5 R    Slot = 7
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC5L4X3         X1input2 = 1RC5L4X4
 X2input1 = 2RC5L4X3         X2input2 = 2RC5L4X4
 X3input1 = 3RC5L4X3         X3input2 = 3RC5L4X4
@@ -1828,8 +1654,6 @@ Switch( RC5L4B34 )
 *********************************************
 Board  84     Board num  RC5L5B12     CRATE  5 R    Slot = 8
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC5L5X1         X1input2 = 1RC5L5X2
 X2input1 = 2RC5L5X1         X2input2 = 2RC5L5X2
 X3input1 = 3RC5L5X1         X3input2 = 3RC5L5X2
@@ -1849,8 +1673,6 @@ Switch( RC5L5B12 )
 ******************************************
 Board  85     Board num  RC5L5B34     CRATE  5 R    Slot = 9
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC5L5X3         X1input2 = 1RC5L5X4
 X2input1 = 2RC5L5X3         X2input2 = 2RC5L5X4
 X3input1 = 3RC5L5X3         X3input2 = 3RC5L5X4
@@ -1870,8 +1692,6 @@ Switch( RC5L5B34 )
 *********************************************
 Board  86     Board num  RC5L6B12     CRATE  5 R    Slot = 10
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC5L6X1         X1input2 = 1RC5L6X2
 X2input1 = 2RC5L6X1         X2input2 = 2RC5L6X2
 X3input1 = 3RC5L6X1         X3input2 = 3RC5L6X2
@@ -1891,8 +1711,6 @@ Switch( RC5L6B12 )
 **********************************************
 Board  87     Board num  RC5L6B34     CRATE  5 R    Slot = 11
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC5L6X3         X1input2 = 1RC5L6X4
 X2input1 = 2RC5L6X3         X2input2 = 2RC5L6X4
 X3input1 = 3RC5L6X3         X3input2 = 3RC5L6X4
@@ -1912,8 +1730,6 @@ Switch( RC5L6B34 )
 **********************************************
 Board  88     Board num  RC5L7B12     CRATE  5 R    Slot = 12
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC5L7X1         X1input2 = 1RC5L7X2
 X2input1 = 2RC5L7X1         X2input2 = 2RC5L7X2
 X3input1 = 3RC5L7X1         X3input2 = 3RC5L7X2
@@ -1933,8 +1749,6 @@ Switch( RC5L7B12 )
 **********************************************
 Board  89     Board num  RC5L7B34     CRATE  5 R    Slot = 13
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC5L7X3         X1input2 = 1RC5L7X4
 X2input1 = 2RC5L7X3         X2input2 = 2RC5L7X4
 X3input1 = 3RC5L7X3         X3input2 = 3RC5L7X4
@@ -1954,8 +1768,6 @@ Switch( RC5L7B34 )
 **********************************************
 Board  90     Board num  RC5L8B12     CRATE  5 R    Slot = 14
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC5L8X1         X1input2 = 1RC5L8X2
 X2input1 = 2RC5L8X1         X2input2 = 2RC5L8X2
 X3input1 = 3RC5L8X1         X3input2 = 3RC5L8X2
@@ -1975,8 +1787,6 @@ Switch( RC5L8B12 )
 **********************************************
 Board  91     Board num  RC5L8B34     CRATE  5 R    Slot = 15
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC5L8X3         X1input2 = 1RC5L8X4
 X2input1 = 2RC5L8X3         X2input2 = 2RC5L8X4
 X3input1 = 3RC5L8X3         X3input2 = 3RC5L8X4
@@ -1996,8 +1806,6 @@ Switch( RC5L8B34 )
 **********************************************
 Board  92     Board num  RC5L9B12     CRATE  5 R    Slot = 16
 
-DetElemId  1104  1204  1304  1404 
-
 X1input1 = 1RC5L9X1         X1input2 = 1RC5L9X2
 X2input1 = 2RC5L9X1         X2input2 = 2RC5L9X2
 X3input1 = 3RC5L9X1         X3input2 = 3RC5L9X2
@@ -2016,8 +1824,6 @@ Switch( RC5L9B12 )
 
 *********************************************
 Board  93     Board num  RC6L1B12     CRATE  6 R    Slot = 1
-
-DetElemId  1114  1214  1314  1414 
     
 X1input1 = 1RC6L1X1         X1input2 = 1RC6L1X2
 X2input1 = 2RC6L1X1         X2input2 = 2RC6L1X2
@@ -2038,8 +1844,6 @@ Switch( RC6L1B12 )
 *********************************************
 Board  94     Board num  RC6L2B12     CRATE  6 R    Slot = 2
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC6L2X1         X1input2 = 1RC6L2X2
 X2input1 = 2RC6L2X1         X2input2 = 2RC6L2X2
 X3input1 = 3RC6L2X1         X3input2 = 3RC6L2X2
@@ -2059,8 +1863,6 @@ Switch( RC6L2B12 )
 *********************************************
 Board  95     Board num  RC6L2B34     CRATE  6 R    Slot = 3
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC6L2X3         X1input2 = 1RC6L2X4
 X2input1 = 2RC6L2X3         X2input2 = 2RC6L2X4
 X3input1 = 3RC6L2X3         X3input2 = 3RC6L2X4
@@ -2080,8 +1882,6 @@ Switch( RC6L2B34 )
 *********************************************
 Board  96     Board num  RC6L3B12     CRATE  6 R    Slot = 4
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC6L3X1         X1input2 = 1RC6L3X2
 X2input1 = 2RC6L3X1         X2input2 = 2RC6L3X2
 X3input1 = 3RC6L3X1         X3input2 = 3RC6L3X2
@@ -2101,8 +1901,6 @@ Switch( RC6L3B12 )
 *********************************************
 Board  97     Board num  RC6L3B34     CRATE  6 R    Slot = 5
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC6L3X3         X1input2 = 1RC6L3X4
 X2input1 = 2RC6L3X3         X2input2 = 2RC6L3X4
 X3input1 = 3RC6L3X3         X3input2 = 3RC6L3X4
@@ -2122,8 +1920,6 @@ Switch( RC6L3B34 )
 *********************************************
 Board  98     Board num  RC6L4B12     CRATE  6 R    Slot = 6
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC6L4X1         X1input2 = 1RC6L4X2
 X2input1 = 2RC6L4X1         X2input2 = 2RC6L4X2
 X3input1 = 3RC6L4X1         X3input2 = 3RC6L4X2
@@ -2143,8 +1939,6 @@ Switch( RC6L4B12 )
 *********************************************
 Board  99     Board num  RC6L4B34     CRATE  6 R    Slot = 7
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC6L4X3         X1input2 = 1RC6L4X4
 X2input1 = 2RC6L4X3         X2input2 = 2RC6L4X4
 X3input1 = 3RC6L4X3         X3input2 = 3RC6L4X4
@@ -2164,8 +1958,6 @@ Switch( RC6L4B34 )
 *********************************************
 Board  100     Board num  RC6L5B12     CRATE  6 R    Slot = 8
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC6L5X1         X1input2 = 1RC6L5X2
 X2input1 = 2RC6L5X1         X2input2 = 2RC6L5X2
 X3input1 = 3RC6L5X1         X3input2 = 3RC6L5X2
@@ -2185,8 +1977,6 @@ Switch( RC6L5B12 )
 ******************************************
 Board  101     Board num  RC6L5B34     CRATE  6 R    Slot = 9
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC6L5X3         X1input2 = 1RC6L5X4
 X2input1 = 2RC6L5X3         X2input2 = 2RC6L5X4
 X3input1 = 3RC6L5X3         X3input2 = 3RC6L5X4
@@ -2206,8 +1996,6 @@ Switch( RC6L5B34 )
 *********************************************
 Board  102     Board num  RC6L6B12     CRATE  6 R    Slot = 10
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC6L6X1         X1input2 = 1RC6L6X2
 X2input1 = 2RC6L6X1         X2input2 = 2RC6L6X2
 X3input1 = 3RC6L6X1         X3input2 = 3RC6L6X2
@@ -2227,8 +2015,6 @@ Switch( RC6L6B12 )
 **********************************************
 Board  103     Board num  RC6L6B34     CRATE  6 R    Slot = 11
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC6L6X3         X1input2 = 1RC6L6X4
 X2input1 = 2RC6L6X3         X2input2 = 2RC6L6X4
 X3input1 = 3RC6L6X3         X3input2 = 3RC6L6X4
@@ -2248,8 +2034,6 @@ Switch( RC6L6B34 )
 **********************************************
 Board  104     Board num  RC6L7B12     CRATE  6 R    Slot = 12
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC6L7X1         X1input2 = 1RC6L7X2
 X2input1 = 2RC6L7X1         X2input2 = 2RC6L7X2
 X3input1 = 3RC6L7X1         X3input2 = 3RC6L7X2
@@ -2269,8 +2053,6 @@ Switch( RC6L7B12 )
 **********************************************
 Board  105     Board num  RC6L7B34     CRATE  6 R    Slot = 13
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC6L7X3         X1input2 = 1RC6L7X4
 X2input1 = 2RC6L7X3         X2input2 = 2RC6L7X4
 X3input1 = 3RC6L7X3         X3input2 = 3RC6L7X4
@@ -2290,8 +2072,6 @@ Switch( RC6L7B34 )
 **********************************************
 Board  106     Board num  RC6L8B12     CRATE  6 R    Slot = 14
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC6L8X1         X1input2 = 1RC6L8X2
 X2input1 = 2RC6L8X1         X2input2 = 2RC6L8X2
 X3input1 = 3RC6L8X1         X3input2 = 3RC6L8X2
@@ -2311,8 +2091,6 @@ Switch( RC6L8B12 )
 **********************************************
 Board  107     Board num  RC6L8B34     CRATE  6 R    Slot = 15
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC6L8X3         X1input2 = 1RC6L8X4
 X2input1 = 2RC6L8X3         X2input2 = 2RC6L8X4
 X3input1 = 3RC6L8X3         X3input2 = 3RC6L8X4
@@ -2332,8 +2110,6 @@ Switch( RC6L8B34 )
 **********************************************
 Board  108     Board num  RC6L9B12     CRATE  6 R    Slot = 16
 
-DetElemId  1104  1204  1304  1404 
-
 X1input1 = 1RC6L9X1         X1input2 = 1RC6L9X2
 X2input1 = 2RC6L9X1         X2input2 = 2RC6L9X2
 X3input1 = 3RC6L9X1         X3input2 = 3RC6L9X2
@@ -2352,8 +2128,6 @@ Switch( RC6L9B12 )
 
 *********************************************
 Board  109     Board num  RC7L1B12     CRATE  7 R    Slot = 1
-
-DetElemId  1114  1214  1314  1414 
     
 X1input1 = 1RC7L1X1         X1input2 = 1RC7L1X2
 X2input1 = 2RC7L1X1         X2input2 = 2RC7L1X2
@@ -2374,8 +2148,6 @@ Switch( RC7L1B12 )
 *********************************************
 Board  110     Board num  RC7L2B12     CRATE  7 R    Slot = 2
 
-DetElemId  1115  1215  1315  1415 
-
 X1input1 = 1RC7L2X1         X1input2 = 1RC7L2X2
 X2input1 = 2RC7L2X1         X2input2 = 2RC7L2X2
 X3input1 = 3RC7L2X1         X3input2 = 3RC7L2X2
@@ -2395,8 +2167,6 @@ Switch( RC7L2B12 )
 *********************************************
 Board  111     Board num  RC7L3B12     CRATE  7 R    Slot = 3
 
-DetElemId  1116  1216  1316  1416 
-
 X1input1 = 1RC7L3X1         X1input2 = 1RC7L3X2
 X2input1 = 2RC7L3X1         X2input2 = 2RC7L3X2
 X3input1 = 3RC7L3X1         X3input2 = 3RC7L3X2
@@ -2416,8 +2186,6 @@ Switch( RC7L3B12 )
 *********************************************
 Board  112     Board num  RC7L4B12     CRATE  7 R    Slot = 4
 
-DetElemId  1117  1217  1317  1417 
-
 X1input1 = 1RC7L4X1         X1input2 = 1RC7L4X2
 X2input1 = 2RC7L4X1         X2input2 = 2RC7L4X2
 X3input1 = 3RC7L4X1         X3input2 = 3RC7L4X2
@@ -2437,8 +2205,6 @@ Switch( RC7L4B12 )
 *********************************************
 Board  113     Board num  RC7L5B12     CRATE  7 R    Slot = 5
 
-DetElemId  1100  1200  1300  1400 
-
 X1input1 = 1RC7L5X1         X1input2 = 1RC7L5X2
 X2input1 = 2RC7L5X1         X2input2 = 2RC7L5X2
 X3input1 = 3RC7L5X1         X3input2 = 3RC7L5X2
@@ -2458,8 +2224,6 @@ Switch( RC7L5B12 )
 *********************************************
 Board  114     Board num  RC7L6B12     CRATE  7 R    Slot = 6
 
-DetElemId  1101  1201  1301  1401 
-
 X1input1 = 1RC7L6X1         X1input2 = 1RC7L6X2
 X2input1 = 2RC7L6X1         X2input2 = 2RC7L6X2
 X3input1 = 3RC7L6X1         X3input2 = 3RC7L6X2
@@ -2479,8 +2243,6 @@ Switch( RC7L6B12 )
 *********************************************
 Board  115     Board num  RC7L7B12     CRATE  7 R    Slot = 7
 
-DetElemId  1102  1202  1302  1402 
-
 X1input1 = 1RC7L7X1         X1input2 = 1RC7L7X2
 X2input1 = 2RC7L7X1         X2input2 = 2RC7L7X2
 X3input1 = 3RC7L7X1         X3input2 = 3RC7L7X2
@@ -2500,8 +2262,6 @@ Switch( RC7L7B12 )
 *********************************************
 Board  116     Board num  RC7L8B12     CRATE  7 R    Slot = 8
 
-DetElemId  1103  1203  1303  1403 
-
 X1input1 = 1RC7L8X1         X1input2 = 1RC7L8X2
 X2input1 = 2RC7L8X1         X2input2 = 2RC7L8X2
 X3input1 = 3RC7L8X1         X3input2 = 3RC7L8X2
@@ -2521,8 +2281,6 @@ Switch( RC7L8B12 )
 ******************************************
 Board  117     Board num  RC7L9B12     CRATE  7 R    Slot = 9
 
-DetElemId  1104  1204  1304  1404 
-
 X1input1 = 1RC7L9X1         X1input2 = 1RC7L9X2
 X2input1 = 2RC7L9X1         X2input2 = 2RC7L9X2
 X3input1 = 3RC7L9X1         X3input2 = 3RC7L9X2
@@ -2542,8 +2300,6 @@ Switch( RC7L9B12 )
 *********************************************
 Board  118     Board num  LC1L1B12     CRATE  1 L    Slot = 1
 
-DetElemId  1113  1213  1313  1413 
-
 X1input1 = 1LC1L1X1         X1input2 = 1LC1L1X2
 X2input1 = 2LC1L1X1         X2input2 = 2LC1L1X2
 X3input1 = 3LC1L1X1         X3input2 = 3LC1L1X2
@@ -2563,8 +2319,6 @@ Switch( LC1L1B12 )
 *********************************************
 Board  119     Board num  LC1L2B12     CRATE  1 L    Slot = 2
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC1L2X1         X1input2 = 1LC1L2X2
 X2input1 = 2LC1L2X1         X2input2 = 2LC1L2X2
 X3input1 = 3LC1L2X1         X3input2 = 3LC1L2X2
@@ -2584,8 +2338,6 @@ Switch( LC1L2B12 )
 *********************************************
 Board  120     Board num  LC1L2B34     CRATE  1 L    Slot = 3
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC1L2X3         X1input2 = 1LC1L2X4
 X2input1 = 2LC1L2X3         X2input2 = 2LC1L2X4
 X3input1 = 3LC1L2X3         X3input2 = 3LC1L2X4
@@ -2605,8 +2357,6 @@ Switch( LC1L2B34 )
 *********************************************
 Board  121     Board num  LC1L3B12     CRATE  1 L    Slot = 4
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC1L3X1         X1input2 = 1LC1L3X2
 X2input1 = 2LC1L3X1         X2input2 = 2LC1L3X2
 X3input1 = 3LC1L3X1         X3input2 = 3LC1L3X2
@@ -2626,8 +2376,6 @@ Switch( LC1L3B12 )
 *********************************************
 Board  122     Board num  LC1L3B34     CRATE  1 L    Slot = 5
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC1L3X3         X1input2 = 1LC1L3X4
 X2input1 = 2LC1L3X3         X2input2 = 2LC1L3X4
 X3input1 = 3LC1L3X3         X3input2 = 3LC1L3X4
@@ -2647,8 +2395,6 @@ Switch( LC1L3B34 )
 *********************************************
 Board  123     Board num  LC1L4B12     CRATE  1 L    Slot = 6
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC1L4X1         X1input2 = 1LC1L4X2
 X2input1 = 2LC1L4X1         X2input2 = 2LC1L4X2
 X3input1 = 3LC1L4X1         X3input2 = 3LC1L4X2
@@ -2668,8 +2414,6 @@ Switch( LC1L4B12 )
 *********************************************
 Board  124     Board num  LC1L4B34     CRATE  1 L    Slot = 7
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC1L4X3         X1input2 = 1LC1L4X4
 X2input1 = 2LC1L4X3         X2input2 = 2LC1L4X4
 X3input1 = 3LC1L4X3         X3input2 = 3LC1L4X4
@@ -2689,8 +2433,6 @@ Switch( LC1L4B34 )
 *********************************************
 Board  125     Board num  LC1L4B56     CRATE  1 L    Slot = 8
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC1L4X5         X1input2 = 1LC1L4X6
 X2input1 = 2LC1L4X5         X2input2 = 2LC1L4X6
 X3input1 = 3LC1L4X5         X3input2 = 3LC1L4X6
@@ -2710,8 +2452,6 @@ Switch( LC1L4B56 )
 ******************************************
 Board  126     Board num  LC1L6B12     CRATE  1 L    Slot = 9
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC1L6X1         X1input2 = 1LC1L6X2
 X2input1 = 2LC1L6X1         X2input2 = 2LC1L6X2
 X3input1 = 3LC1L6X1         X3input2 = 3LC1L6X2
@@ -2731,8 +2471,6 @@ Switch( LC1L6B12 )
 *********************************************
 Board  127     Board num  LC1L6B34     CRATE  1 L    Slot = 10
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC1L6X3         X1input2 = 1LC1L6X4
 X2input1 = 2LC1L6X3         X2input2 = 2LC1L6X4
 X3input1 = 3LC1L6X3         X3input2 = 3LC1L6X4
@@ -2752,8 +2490,6 @@ Switch( LC1L6B34 )
 **********************************************
 Board  128     Board num  LC1L6B56     CRATE  1 L    Slot = 11
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC1L6X5         X1input2 = 1LC1L6X6
 X2input1 = 2LC1L6X5         X2input2 = 2LC1L6X6
 X3input1 = 3LC1L6X5         X3input2 = 3LC1L6X6
@@ -2773,8 +2509,6 @@ Switch( LC1L6B56 )
 **********************************************
 Board  129     Board num  LC1L7B12     CRATE  1 L    Slot = 12
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC1L7X1         X1input2 = 1LC1L7X2
 X2input1 = 2LC1L7X1         X2input2 = 2LC1L7X2
 X3input1 = 3LC1L7X1         X3input2 = 3LC1L7X2
@@ -2794,8 +2528,6 @@ Switch( LC1L7B12 )
 **********************************************
 Board  130     Board num  LC1L7B34     CRATE  1 L    Slot = 13
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC1L7X3         X1input2 = 1LC1L7X4
 X2input1 = 2LC1L7X3         X2input2 = 2LC1L7X4
 X3input1 = 3LC1L7X3         X3input2 = 3LC1L7X4
@@ -2815,8 +2547,6 @@ Switch( LC1L7B34 )
 **********************************************
 Board  131     Board num  LC1L8B12     CRATE  1 L    Slot = 14
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC1L8X1         X1input2 = 1LC1L8X2
 X2input1 = 2LC1L8X1         X2input2 = 2LC1L8X2
 X3input1 = 3LC1L8X1         X3input2 = 3LC1L8X2
@@ -2836,8 +2566,6 @@ Switch( LC1L8B12 )
 **********************************************
 Board  132     Board num  LC1L8B34     CRATE  1 L    Slot = 15
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC1L8X3         X1input2 = 1LC1L8X4
 X2input1 = 2LC1L8X3         X2input2 = 2LC1L8X4
 X3input1 = 3LC1L8X3         X3input2 = 3LC1L8X4
@@ -2857,8 +2585,6 @@ Switch( LC1L8B34 )
 **********************************************
 Board  133     Board num  LC1L9B12     CRATE  1 L    Slot = 16
 
-DetElemId  1105  1205  1305  1405 
-
 X1input1 = 1LC1L9X1         X1input2 = 1LC1L9X2
 X2input1 = 2LC1L9X1         X2input2 = 2LC1L9X2
 X3input1 = 3LC1L9X1         X3input2 = 3LC1L9X2
@@ -2877,8 +2603,6 @@ Switch( LC1L9B12 )
 
 *********************************************
 Board  134     Board num  LC2L1B12     CRATE  2 L    Slot = 1
-
-DetElemId  1113  1213  1313  1413 
     
 X1input1 = 1LC2L1X1         X1input2 = 1LC2L1X2
 X2input1 = 2LC2L1X1         X2input2 = 2LC2L1X2
@@ -2899,8 +2623,6 @@ Switch( LC2L1B12 )
 *********************************************
 Board  135     Board num  LC2L2B12     CRATE  2 L    Slot = 2
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC2L2X1         X1input2 = 1LC2L2X2
 X2input1 = 2LC2L2X1         X2input2 = 2LC2L2X2
 X3input1 = 3LC2L2X1         X3input2 = 3LC2L2X2
@@ -2920,8 +2642,6 @@ Switch( LC2L2B12 )
 *********************************************
 Board  136     Board num  LC2L2B34     CRATE  2 L    Slot = 3
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC2L2X3         X1input2 = 1LC2L2X4
 X2input1 = 2LC2L2X3         X2input2 = 2LC2L2X4
 X3input1 = 3LC2L2X3         X3input2 = 3LC2L2X4
@@ -2941,8 +2661,6 @@ Switch( LC2L2B34 )
 *********************************************
 Board  137     Board num  LC2L3B12     CRATE  2 L    Slot = 4
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC2L3X1         X1input2 = 1LC2L3X2
 X2input1 = 2LC2L3X1         X2input2 = 2LC2L3X2
 X3input1 = 3LC2L3X1         X3input2 = 3LC2L3X2
@@ -2962,8 +2680,6 @@ Switch( LC2L3B12 )
 *********************************************
 Board  138     Board num  LC2L3B34     CRATE  2 L    Slot = 5
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC2L3X3         X1input2 = 1LC2L3X4
 X2input1 = 2LC2L3X3         X2input2 = 2LC2L3X4
 X3input1 = 3LC2L3X3         X3input2 = 3LC2L3X4
@@ -2983,8 +2699,6 @@ Switch( LC2L3B34 )
 *********************************************
 Board  139    Board num  LC2L4B12     CRATE  2 L    Slot = 6
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC2L4X1         X1input2 = 1LC2L4X2
 X2input1 = 2LC2L4X1         X2input2 = 2LC2L4X2
 X3input1 = 3LC2L4X1         X3input2 = 3LC2L4X2
@@ -3004,8 +2718,6 @@ Switch( LC2L4B12 )
 *********************************************
 Board  140     Board num  LC2L4B34     CRATE  2 L    Slot = 7
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC2L4X3         X1input2 = 1LC2L4X4
 X2input1 = 2LC2L4X3         X2input2 = 2LC2L4X4
 X3input1 = 3LC2L4X3         X3input2 = 3LC2L4X4
@@ -3025,8 +2737,6 @@ Switch( LC2L4B34 )
 *********************************************
 Board  141     Board num  LC2L4B56     CRATE  2 L    Slot = 8
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC2L4X5         X1input2 = 1LC2L4X6
 X2input1 = 2LC2L4X5         X2input2 = 2LC2L4X6
 X3input1 = 3LC2L4X5         X3input2 = 3LC2L4X6
@@ -3046,8 +2756,6 @@ Switch( LC2L4B56 )
 ******************************************
 Board  142     Board num  LC2L4B78     CRATE  2 L    Slot = 9
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC2L4X7         X1input2 = 1LC2L4X8
 X2input1 = 2LC2L4X7         X2input2 = 2LC2L4X8
 X3input1 = 3LC2L4X7         X3input2 = 3LC2L4X8
@@ -3067,8 +2775,6 @@ Switch( LC2L4B78 )
 *********************************************
 Board  143     Board num  LC2L5B12     CRATE  2 L    Slot = 10
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC2L5X1         X1input2 = 1LC2L5X2
 X2input1 = 2LC2L5X1         X2input2 = 2LC2L5X2
 X3input1 = 3LC2L5X1         X3input2 = 3LC2L5X2
@@ -3088,8 +2794,6 @@ Switch( LC2L5B12 )
 **********************************************
 Board  144     Board num  LC2L5B34     CRATE  2 L    Slot = 11
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC2L5X3         X1input2 = 1LC2L5X4
 X2input1 = 2LC2L5X3         X2input2 = 2LC2L5X4
 X3input1 = 3LC2L5X3         X3input2 = 3LC2L5X4
@@ -3109,8 +2813,6 @@ Switch( LC2L5B34 )
 **********************************************
 Board  145     Board num  LC2L5B56     CRATE  2 L    Slot = 12
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC2L5X5         X1input2 = 1LC2L5X6
 X2input1 = 2LC2L5X5         X2input2 = 2LC2L5X6
 X3input1 = 3LC2L5X5         X3input2 = 3LC2L5X6
@@ -3130,8 +2832,6 @@ Switch( LC2L5B56 )
 **********************************************
 Board  146     Board num  LC2L5B78     CRATE  2 L    Slot = 13
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC2L5X7         X1input2 = 1LC2L5X8
 X2input1 = 2LC2L5X7         X2input2 = 2LC2L5X8
 X3input1 = 3LC2L5X7         X3input2 = 3LC2L5X8
@@ -3151,8 +2851,6 @@ Switch( LC2L5B78 )
 **********************************************
 Board  147     Board num  LC2L6B12     CRATE  2 L    Slot = 14
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC2L6X1         X1input2 = 1LC2L6X2
 X2input1 = 2LC2L6X1         X2input2 = 2LC2L6X2
 X3input1 = 3LC2L6X1         X3input2 = 3LC2L6X2
@@ -3172,8 +2870,6 @@ Switch( LC2L6B12 )
 **********************************************
 Board  148     Board num  LC2L6B34     CRATE  2 L    Slot = 15
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC2L6X3          X1input2 = 1LC2L6X4
 X2input1 = 2LC2L6X3          X2input2 = 2LC2L6X4
 X3input1 = 3LC2L6X3 (1)      X3input2 = 3LC2L6X4 (1)
@@ -3193,8 +2889,6 @@ Switch( LC2L6B34 )
 **********************************************
 Board  nn     Board num  LIntC2-Up     CRATE  2 L    Slot = 16
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3LC2L6X5 (2)         X3input2 = 3LC2L6X6 (2)
@@ -3214,8 +2908,6 @@ Switch( LIntC2-Up )
 *********************************************
 Board nn     Board num  LIntC2-Dw     CRATE  2-3 L    Slot = 1
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3LC2L6X3 (2)         X3input2 = 3LC2L6X4 (2)
@@ -3235,8 +2927,6 @@ Switch( LIntC2-Dw )
 *********************************************
 Board  149     Board num  LC2L6B56     CRATE  2-3 L    Slot = 2
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC2L6X5              X1input2 = 1LC2L6X6
 X2input1 = 2LC2L6X5              X2input2 = 2LC2L6X6
 X3input1 = 3LC2L6X5 (1)          X3input2 = 3LC2L6X6 (1)
@@ -3256,8 +2946,6 @@ Switch( LC2L6B56 )
 **********************************************
 Board  150     Board num  LC2L6B78     CRATE  2-3 L    Slot = 3
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC2L6X7         X1input2 = 1LC2L6X8
 X2input1 = 2LC2L6X7         X2input2 = 2LC2L6X8
 X3input1 = 3LC2L6X7         X3input2 = 3LC2L6X8
@@ -3277,8 +2965,6 @@ Switch( LC2L6B78 )
 **********************************************
 Board  151     Board num  LC2L7B12     CRATE  2-3 L    Slot = 4
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC2L7X1         X1input2 = 1LC2L7X2
 X2input1 = 2LC2L7X1         X2input2 = 2LC2L7X2
 X3input1 = 3LC2L7X1         X3input2 = 3LC2L7X2
@@ -3298,8 +2984,6 @@ Switch( LC2L7B12 )
 **********************************************
 Board  152     Board num  LC2L7B34     CRATE  2-3 L    Slot = 5
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC2L7X3         X1input2 = 1LC2L7X4
 X2input1 = 2LC2L7X3         X2input2 = 2LC2L7X4
 X3input1 = 3LC2L7X3         X3input2 = 3LC2L7X4
@@ -3319,8 +3003,6 @@ Switch( LC2L7B34 )
 **********************************************
 Board  153     Board num  LC2L8B12     CRATE  2-3 L    Slot = 6
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC2L8X1         X1input2 = 1LC2L8X2
 X2input1 = 2LC2L8X1         X2input2 = 2LC2L8X2
 X3input1 = 3LC2L8X1         X3input2 = 3LC2L8X2
@@ -3340,8 +3022,6 @@ Switch( LC2L8B12 )
 **********************************************
 Board  154     Board num  LC2L8B34     CRATE  2-3 L    Slot = 7
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC2L8X3         X1input2 = 1LC2L8X4
 X2input1 = 2LC2L8X3         X2input2 = 2LC2L8X4
 X3input1 = 3LC2L8X3         X3input2 = 3LC2L8X4
@@ -3361,8 +3041,6 @@ Switch( LC2L8B34 )
 **********************************************
 Board  155     Board num  LC2L9B12     CRATE  2-3 L    Slot = 8
 
-DetElemId  1105  1205  1305  1405 
-
 X1input1 = 1LC2L9X1         X1input2 = 1LC2L9X2
 X2input1 = 2LC2L9X1         X2input2 = 2LC2L9X2
 X3input1 = 3LC2L9X1         X3input2 = 3LC2L9X2
@@ -3382,8 +3060,6 @@ Switch( LC2L9B12 )
 *********************************************
 Board nn     Board num  LintC3-Dw     CRATE  2-3 L    Slot = 9
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3LC3L6X3 (2)         X3input2 = 3LC3L6X4 (2)
@@ -3403,8 +3079,6 @@ Switch( LIntC3-Dw )
 *********************************************
 Board   171     Board num  LC3L6B56     CRATE  2-3 L    Slot = 10
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC3L6X5              X1input2 = 1LC3L6X6
 X2input1 = 2LC3L6X5              X2input2 = 2LC3L6X6
 X3input1 = 3LC3L6X5 (1)          X3input2 = 3LC3L6X6 (1)
@@ -3424,8 +3098,6 @@ Switch( LC3L6B56 )
 **********************************************
 Board   172     Board num  LC3L6B78     CRATE  2-3 L    Slot = 11
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC3L6X7         X1input2 = 1LC3L6X8
 X2input1 = 2LC3L6X7         X2input2 = 2LC3L6X8
 X3input1 = 3LC3L6X7         X3input2 = 3LC3L6X8
@@ -3445,8 +3117,6 @@ Switch( LC3L6B78 )
 **********************************************
 Board   173     Board num  LC3L7B12     CRATE  2-3 L    Slot = 12
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC3L7X1         X1input2 = 1LC3L7X2
 X2input1 = 2LC3L7X1         X2input2 = 2LC3L7X2
 X3input1 = 3LC3L7X1         X3input2 = 3LC3L7X2
@@ -3466,8 +3136,6 @@ Switch( LC3L7B12 )
 **********************************************
 Board   174     Board num  LC3L7B34     CRATE  2-3 L    Slot = 13
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC3L7X3         X1input2 = 1LC3L7X4
 X2input1 = 2LC3L7X3         X2input2 = 2LC3L7X4
 X3input1 = 3LC3L7X3         X3input2 = 3LC3L7X4
@@ -3487,8 +3155,6 @@ Switch( LC3L7B34 )
 **********************************************
 Board   175     Board num  LC3L8B12     CRATE  2-3 L    Slot = 14
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC3L8X1         X1input2 = 1LC3L8X2
 X2input1 = 2LC3L8X1         X2input2 = 2LC3L8X2
 X3input1 = 3LC3L8X1         X3input2 = 3LC3L8X2
@@ -3508,8 +3174,6 @@ Switch( LC3L8B12 )
 **********************************************
 Board   176     Board num  LC3L8B34     CRATE  2-3 L    Slot = 15
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC3L8X3         X1input2 = 1LC3L8X4
 X2input1 = 2LC3L8X3         X2input2 = 2LC3L8X4
 X3input1 = 3LC3L8X3         X3input2 = 3LC3L8X4
@@ -3529,8 +3193,6 @@ Switch( LC3L8B34 )
 **********************************************
 Board   177     Board num  LC3L9B12     CRATE  2-3 L    Slot = 16
 
-DetElemId  1105  1205  1305  1405 
-
 X1input1 = 1LC3L9X1         X1input2 = 1LC3L9X2
 X2input1 = 2LC3L9X1         X2input2 = 2LC3L9X2
 X3input1 = 3LC3L9X1         X3input2 = 3LC3L9X2
@@ -3549,8 +3211,6 @@ Switch( LC3L9B12 )
 
 *********************************************
 Board  156     Board num  LC3L1B12     CRATE  3 L    Slot = 1
-
-DetElemId  1113  1213  1313  1413 
     
 X1input1 = 1LC3L1X1         X1input2 = 1LC3L1X2
 X2input1 = 2LC3L1X1         X2input2 = 2LC3L1X2
@@ -3571,8 +3231,6 @@ Switch( LC3L1B12 )
 *********************************************
 Board  157     Board num  LC3L2B12     CRATE  3 L    Slot = 2
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC3L2X1         X1input2 = 1LC3L2X2
 X2input1 = 2LC3L2X1         X2input2 = 2LC3L2X2
 X3input1 = 3LC3L2X1         X3input2 = 3LC3L2X2
@@ -3592,8 +3250,6 @@ Switch( LC3L2B12 )
 *********************************************
 Board  158     Board num  LC3L2B34     CRATE  3 L    Slot = 3
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC3L2X3         X1input2 = 1LC3L2X4
 X2input1 = 2LC3L2X3         X2input2 = 2LC3L2X4
 X3input1 = 3LC3L2X3         X3input2 = 3LC3L2X4
@@ -3613,8 +3269,6 @@ Switch( LC3L2B34 )
 *********************************************
 Board  159     Board num  LC3L3B12     CRATE  3 L    Slot = 4
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC3L3X1         X1input2 = 1LC3L3X2
 X2input1 = 2LC3L3X1         X2input2 = 2LC3L3X2
 X3input1 = 3LC3L3X1         X3input2 = 3LC3L3X2
@@ -3634,8 +3288,6 @@ Switch( LC3L3B12 )
 *********************************************
 Board  160     Board num  LC3L3B34     CRATE  3 L    Slot = 5
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC3L3X3         X1input2 = 1LC3L3X4
 X2input1 = 2LC3L3X3         X2input2 = 2LC3L3X4
 X3input1 = 3LC3L3X3         X3input2 = 3LC3L3X4
@@ -3655,8 +3307,6 @@ Switch( LC3L3B34 )
 *********************************************
 Board  161     Board num  LC3L4B12     CRATE  3 L    Slot = 6
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC3L4X1         X1input2 = 1LC3L4X2
 X2input1 = 2LC3L4X1         X2input2 = 2LC3L4X2
 X3input1 = 3LC3L4X1         X3input2 = 3LC3L4X2
@@ -3676,8 +3326,6 @@ Switch( LC3L4B12 )
 *********************************************
 Board  162     Board num  LC3L4B34     CRATE  3 L    Slot = 7
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC3L4X3         X1input2 = 1LC3L4X4
 X2input1 = 2LC3L4X3         X2input2 = 2LC3L4X4
 X3input1 = 3LC3L4X3         X3input2 = 3LC3L4X4
@@ -3697,8 +3345,6 @@ Switch( LC3L4B34 )
 *********************************************
 Board  163     Board num  LC3L4B56     CRATE  3 L    Slot = 8
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC3L4X5         X1input2 = 1LC3L4X6
 X2input1 = 2LC3L4X5         X2input2 = 2LC3L4X6
 X3input1 = 3LC3L4X5         X3input2 = 3LC3L4X6
@@ -3718,8 +3364,6 @@ Switch( LC3L4B56 )
 ******************************************
 Board  164     Board num  LC3L4B78     CRATE  3 L    Slot = 9
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC3L4X7         X1input2 = 1LC3L4X8
 X2input1 = 2LC3L4X7         X2input2 = 2LC3L4X8
 X3input1 = 3LC3L4X7         X3input2 = 3LC3L4X8
@@ -3739,8 +3383,6 @@ Switch( LC3L4B78 )
 *********************************************
 Board  165     Board num  LC3L5B12     CRATE  3 L    Slot = 10
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC3L5X1         X1input2 = 1LC3L5X2
 X2input1 = 2LC3L5X1         X2input2 = 2LC3L5X2
 X3input1 = 3LC3L5X1         X3input2 = 3LC3L5X2
@@ -3760,8 +3402,6 @@ Switch( LC3L5B12 )
 **********************************************
 Board  166     Board num  LC3L5B34     CRATE  3 L    Slot = 11
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC3L5X3         X1input2 = 1LC3L5X4
 X2input1 = 2LC3L5X3         X2input2 = 2LC3L5X4
 X3input1 = 3LC3L5X3         X3input2 = 3LC3L5X4
@@ -3781,8 +3421,6 @@ Switch( LC3L5B34 )
 **********************************************
 Board  167     Board num  LC3L5B56     CRATE  3 L    Slot = 12
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC3L5X5         X1input2 = 1LC3L5X6
 X2input1 = 2LC3L5X5         X2input2 = 2LC3L5X6
 X3input1 = 3LC3L5X5         X3input2 = 3LC3L5X6
@@ -3802,8 +3440,6 @@ Switch( LC3L5B56 )
 **********************************************
 Board  168     Board num  LC3L5B78     CRATE  3 L    Slot = 13
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC3L5X7         X1input2 = 1LC3L5X8
 X2input1 = 2LC3L5X7         X2input2 = 2LC3L5X8
 X3input1 = 3LC3L5X7         X3input2 = 3LC3L5X8
@@ -3823,8 +3459,6 @@ Switch( LC3L5B78 )
 **********************************************
 Board  169     Board num  LC3L6B12     CRATE  3 L    Slot = 14
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC3L6X1         X1input2 = 1LC3L6X2
 X2input1 = 2LC3L6X1         X2input2 = 2LC3L6X2
 X3input1 = 3LC3L6X1         X3input2 = 3LC3L6X2
@@ -3844,8 +3478,6 @@ Switch( LC3L6B12 )
 **********************************************
 Board  170     Board num  LC3L6B34     CRATE  3 L    Slot = 15
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC3L6X3              X1input2 = 1LC3L6X4
 X2input1 = 2LC3L6X3              X2input2 = 2LC3L6X4
 X3input1 = 3LC3L6X3 (1)          X3input2 = 3LC3L6X4 (1)
@@ -3865,8 +3497,6 @@ Switch( LC3L6B34 )
 **********************************************
 Board  nn     Board num  LIntC3-Up     CRATE  3 L    Slot = 16
 
-DetElemId 0000
-
 X1input1 = NONE                 X1input2 = NONE
 X2input1 = NONE                 X2input2 = NONE
 X3input1 = 3LC3L6X5 (2)         X3input2 = 3LC3L6X6 (2)
@@ -3885,8 +3515,6 @@ Switch( LIntC3-Up )
 
 *********************************************
 Board  178     Board num  LC4L1B12     CRATE  4 L    Slot = 1
-
-DetElemId  1113  1213  1313  1413 
     
 X1input1 = 1LC4L1X1         X1input2 = 1LC4L1X2
 X2input1 = 2LC4L1X1         X2input2 = 2LC4L1X2
@@ -3907,8 +3535,6 @@ Switch( LC4L1B12 )
 *********************************************
 Board  179     Board num  LC4L2B12     CRATE  4 L    Slot = 2
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC4L2X1         X1input2 = 1LC4L2X2
 X2input1 = 2LC4L2X1         X2input2 = 2LC4L2X2
 X3input1 = 3LC4L2X1         X3input2 = 3LC4L2X2
@@ -3928,8 +3554,6 @@ Switch( LC4L2B12 )
 *********************************************
 Board  180     Board num  LC4L2B34     CRATE  4 L    Slot = 3
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC4L2X3         X1input2 = 1LC4L2X4
 X2input1 = 2LC4L2X3         X2input2 = 2LC4L2X4
 X3input1 = 3LC4L2X3         X3input2 = 3LC4L2X4
@@ -3949,8 +3573,6 @@ Switch( LC4L2B34 )
 *********************************************
 Board  181     Board num  LC4L3B12     CRATE  4 L    Slot = 4
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC4L3X1         X1input2 = 1LC4L3X2
 X2input1 = 2LC4L3X1         X2input2 = 2LC4L3X2
 X3input1 = 3LC4L3X1         X3input2 = 3LC4L3X2
@@ -3970,8 +3592,6 @@ Switch( LC4L3B12 )
 *********************************************
 Board  182     Board num  LC4L3B34     CRATE  4 L    Slot = 5
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC4L3X3         X1input2 = 1LC4L3X4
 X2input1 = 2LC4L3X3         X2input2 = 2LC4L3X4
 X3input1 = 3LC4L3X3         X3input2 = 3LC4L3X4
@@ -3992,8 +3612,6 @@ Switch( LC4L3B34 )
 *********************************************
 Board  183     Board num  LC4L4B12     CRATE  4 L    Slot = 6
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC4L4X1         X1input2 = 1LC4L4X2
 X2input1 = 2LC4L4X1         X2input2 = 2LC4L4X2
 X3input1 = 3LC4L4X1         X3input2 = 3LC4L4X2
@@ -4013,8 +3631,6 @@ Switch( LC4L4B12 )
 *********************************************
 Board  184     Board num  LC4L4B34     CRATE  4 L    Slot = 7
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC4L4X3         X1input2 = 1LC4L4X4
 X2input1 = 2LC4L4X3         X2input2 = 2LC4L4X4
 X3input1 = 3LC4L4X3         X3input2 = 3LC4L4X4
@@ -4034,8 +3650,6 @@ Switch( LC4L4B34 )
 *********************************************
 Board  185     Board num  LC4L5B12     CRATE  4 L    Slot = 8
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC4L5X1         X1input2 = 1LC4L5X2
 X2input1 = 2LC4L5X1         X2input2 = 2LC4L5X2
 X3input1 = 3LC4L5X1         X3input2 = 3LC4L5X2
@@ -4055,8 +3669,6 @@ Switch( LC4L5B12 )
 ******************************************
 Board  186     Board num  LC4L5B34     CRATE  4 L    Slot = 9
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC4L5X3         X1input2 = 1LC4L5X4
 X2input1 = 2LC4L5X3         X2input2 = 2LC4L5X4
 X3input1 = 3LC4L5X3         X3input2 = 3LC4L5X4
@@ -4076,8 +3688,6 @@ Switch( LC4L5B34 )
 *********************************************
 Board  187     Board num  LC4L6B12     CRATE  4 L    Slot = 10
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC4L6X1         X1input2 = 1LC4L6X2
 X2input1 = 2LC4L6X1         X2input2 = 2LC4L6X2
 X3input1 = 3LC4L6X1         X3input2 = 3LC4L6X2
@@ -4097,8 +3707,6 @@ Switch( LC4L6B12 )
 **********************************************
 Board  188     Board num  LC4L6B34     CRATE  4 L    Slot = 11
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC4L6X3         X1input2 = 1LC4L6X4
 X2input1 = 2LC4L6X3         X2input2 = 2LC4L6X4
 X3input1 = 3LC4L6X3         X3input2 = 3LC4L6X4
@@ -4118,8 +3726,6 @@ Switch( LC4L6B34 )
 **********************************************
 Board  189     Board num  LC4L7B12     CRATE  4 L    Slot = 12
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC4L7X1         X1input2 = 1LC4L7X2
 X2input1 = 2LC4L7X1         X2input2 = 2LC4L7X2
 X3input1 = 3LC4L7X1         X3input2 = 3LC4L7X2
@@ -4139,8 +3745,6 @@ Switch( LC4L7B12 )
 **********************************************
 Board  190     Board num  LC4L7B34     CRATE  4 L    Slot = 13
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC4L7X3         X1input2 = 1LC4L7X4
 X2input1 = 2LC4L7X3         X2input2 = 2LC4L7X4
 X3input1 = 3LC4L7X3         X3input2 = 3LC4L7X4
@@ -4160,8 +3764,6 @@ Switch( LC4L7B34 )
 **********************************************
 Board  191     Board num  LC4L8B12     CRATE  4 L    Slot = 14
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC4L8X1         X1input2 = 1LC4L8X2
 X2input1 = 2LC4L8X1         X2input2 = 2LC4L8X2
 X3input1 = 3LC4L8X1         X3input2 = 3LC4L8X2
@@ -4181,8 +3783,6 @@ Switch( LC4L8B12 )
 **********************************************
 Board  192     Board num  LC4L8B34     CRATE  4 L    Slot = 15
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC4L8X3         X1input2 = 1LC4L8X4
 X2input1 = 2LC4L8X3         X2input2 = 2LC4L8X4
 X3input1 = 3LC4L8X3         X3input2 = 3LC4L8X4
@@ -4202,8 +3802,6 @@ Switch( LC4L8B34 )
 **********************************************
 Board  193     Board num  LC4L9B12     CRATE  4 L    Slot = 16
 
-DetElemId  1105  1205  1305  1405 
-
 X1input1 = 1LC4L9X1         X1input2 = 1LC4L9X2
 X2input1 = 2LC4L9X1         X2input2 = 2LC4L9X2
 X3input1 = 3LC4L9X1         X3input2 = 3LC4L9X2
@@ -4222,8 +3820,6 @@ Switch( LC4L9B12 )
 
 *********************************************
 Board  194     Board num  LC5L1B12     CRATE  5 L    Slot = 1
-
-DetElemId  1113  1213  1313  1413 
     
 X1input1 = 1LC5L1X1         X1input2 = 1LC5L1X2
 X2input1 = 2LC5L1X1         X2input2 = 2LC5L1X2
@@ -4244,8 +3840,6 @@ Switch( LC5L1B12 )
 *********************************************
 Board  195     Board num  LC5L2B12     CRATE  5 L    Slot = 2
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC5L2X1         X1input2 = 1LC5L2X2
 X2input1 = 2LC5L2X1         X2input2 = 2LC5L2X2
 X3input1 = 3LC5L2X1         X3input2 = 3LC5L2X2
@@ -4265,8 +3859,6 @@ Switch( LC5L2B12 )
 *********************************************
 Board  196     Board num  LC5L2B34     CRATE  5 L    Slot = 3
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC5L2X3         X1input2 = 1LC5L2X4
 X2input1 = 2LC5L2X3         X2input2 = 2LC5L2X4
 X3input1 = 3LC5L2X3         X3input2 = 3LC5L2X4
@@ -4286,8 +3878,6 @@ Switch( LC5L2B34 )
 *********************************************
 Board  197     Board num  LC5L3B12     CRATE  5 L    Slot = 4
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC5L3X1         X1input2 = 1LC5L3X2
 X2input1 = 2LC5L3X1         X2input2 = 2LC5L3X2
 X3input1 = 3LC5L3X1         X3input2 = 3LC5L3X2
@@ -4307,8 +3897,6 @@ Switch( LC5L3B12 )
 *********************************************
 Board  198     Board num  LC5L3B34     CRATE  5 L    Slot = 5
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC5L3X3         X1input2 = 1LC5L3X4
 X2input1 = 2LC5L3X3         X2input2 = 2LC5L3X4
 X3input1 = 3LC5L3X3         X3input2 = 3LC5L3X4
@@ -4328,8 +3916,6 @@ Switch( LC5L3B34 )
 *********************************************
 Board  199     Board num  LC5L4B12     CRATE  5 L    Slot = 6
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC5L4X1         X1input2 = 1LC5L4X2
 X2input1 = 2LC5L4X1         X2input2 = 2LC5L4X2
 X3input1 = 3LC5L4X1         X3input2 = 3LC5L4X2
@@ -4349,8 +3935,6 @@ Switch( LC5L4B12 )
 *********************************************
 Board  200     Board num  LC5L4B34     CRATE  5 L    Slot = 7
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC5L4X3         X1input2 = 1LC5L4X4
 X2input1 = 2LC5L4X3         X2input2 = 2LC5L4X4
 X3input1 = 3LC5L4X3         X3input2 = 3LC5L4X4
@@ -4370,8 +3954,6 @@ Switch( LC5L4B34 )
 *********************************************
 Board  201     Board num  LC5L5B12     CRATE  5 L    Slot = 8
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC5L5X1         X1input2 = 1LC5L5X2
 X2input1 = 2LC5L5X1         X2input2 = 2LC5L5X2
 X3input1 = 3LC5L5X1         X3input2 = 3LC5L5X2
@@ -4391,8 +3973,6 @@ Switch( LC5L5B12 )
 ******************************************
 Board  202     Board num  LC5L5B34     CRATE  5 L    Slot = 9
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC5L5X3         X1input2 = 1LC5L5X4
 X2input1 = 2LC5L5X3         X2input2 = 2LC5L5X4
 X3input1 = 3LC5L5X3         X3input2 = 3LC5L5X4
@@ -4412,8 +3992,6 @@ Switch( LC5L5B34 )
 *********************************************
 Board  203     Board num  LC5L6B12     CRATE  5 L    Slot = 10
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC5L6X1         X1input2 = 1LC5L6X2
 X2input1 = 2LC5L6X1         X2input2 = 2LC5L6X2
 X3input1 = 3LC5L6X1         X3input2 = 3LC5L6X2
@@ -4433,8 +4011,6 @@ Switch( LC5L6B12 )
 **********************************************
 Board  204     Board num  LC5L6B34     CRATE  5 L    Slot = 11
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC5L6X3         X1input2 = 1LC5L6X4
 X2input1 = 2LC5L6X3         X2input2 = 2LC5L6X4
 X3input1 = 3LC5L6X3         X3input2 = 3LC5L6X4
@@ -4454,8 +4030,6 @@ Switch( LC5L6B34 )
 **********************************************
 Board  205     Board num  LC5L7B12     CRATE  5 L    Slot = 12
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC5L7X1         X1input2 = 1LC5L7X2
 X2input1 = 2LC5L7X1         X2input2 = 2LC5L7X2
 X3input1 = 3LC5L7X1         X3input2 = 3LC5L7X2
@@ -4475,8 +4049,6 @@ Switch( LC5L7B12 )
 **********************************************
 Board  206     Board num  LC5L7B34     CRATE  5 L    Slot = 13
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC5L7X3         X1input2 = 1LC5L7X4
 X2input1 = 2LC5L7X3         X2input2 = 2LC5L7X4
 X3input1 = 3LC5L7X3         X3input2 = 3LC5L7X4
@@ -4496,8 +4068,6 @@ Switch( LC5L7B34 )
 **********************************************
 Board  207     Board num  LC5L8B12     CRATE  5 L    Slot = 14
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC5L8X1         X1input2 = 1LC5L8X2
 X2input1 = 2LC5L8X1         X2input2 = 2LC5L8X2
 X3input1 = 3LC5L8X1         X3input2 = 3LC5L8X2
@@ -4517,8 +4087,6 @@ Switch( LC5L8B12 )
 **********************************************
 Board  208     Board num  LC5L8B34     CRATE  5 L    Slot = 15
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC5L8X3         X1input2 = 1LC5L8X4
 X2input1 = 2LC5L8X3         X2input2 = 2LC5L8X4
 X3input1 = 3LC5L8X3         X3input2 = 3LC5L8X4
@@ -4538,8 +4106,6 @@ Switch( LC5L8B34 )
 **********************************************
 Board  209     Board num  LC5L9B12     CRATE  5 L    Slot = 16
 
-DetElemId  1105  1205  1305  1405 
-
 X1input1 = 1LC5L9X1         X1input2 = 1LC5L9X2
 X2input1 = 2LC5L9X1         X2input2 = 2LC5L9X2
 X3input1 = 3LC5L9X1         X3input2 = 3LC5L9X2
@@ -4558,8 +4124,6 @@ Switch( LC5L9B12 )
 
 *********************************************
 Board  210     Board num  LC6L1B12     CRATE  6 L    Slot = 1
-
-DetElemId  1113  1213  1313  1413 
     
 X1input1 = 1LC6L1X1         X1input2 = 1LC6L1X2
 X2input1 = 2LC6L1X1         X2input2 = 2LC6L1X2
@@ -4580,8 +4144,6 @@ Switch( LC6L1B12 )
 *********************************************
 Board  211     Board num  LC6L2B12     CRATE  6 L    Slot = 2
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC6L2X1         X1input2 = 1LC6L2X2
 X2input1 = 2LC6L2X1         X2input2 = 2LC6L2X2
 X3input1 = 3LC6L2X1         X3input2 = 3LC6L2X2
@@ -4601,8 +4163,6 @@ Switch( LC6L2B12 )
 *********************************************
 Board  212     Board num  LC6L2B34     CRATE  6 L    Slot = 3
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC6L2X3         X1input2 = 1LC6L2X4
 X2input1 = 2LC6L2X3         X2input2 = 2LC6L2X4
 X3input1 = 3LC6L2X3         X3input2 = 3LC6L2X4
@@ -4622,8 +4182,6 @@ Switch( LC6L2B34 )
 *********************************************
 Board  213     Board num  LC6L3B12     CRATE  6 L    Slot = 4
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC6L3X1         X1input2 = 1LC6L3X2
 X2input1 = 2LC6L3X1         X2input2 = 2LC6L3X2
 X3input1 = 3LC6L3X1         X3input2 = 3LC6L3X2
@@ -4643,8 +4201,6 @@ Switch( LC6L3B12 )
 *********************************************
 Board  214     Board num  LC6L3B34     CRATE  6 L    Slot = 5
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC6L3X3         X1input2 = 1LC6L3X4
 X2input1 = 2LC6L3X3         X2input2 = 2LC6L3X4
 X3input1 = 3LC6L3X3         X3input2 = 3LC6L3X4
@@ -4664,8 +4220,6 @@ Switch( LC6L3B34 )
 *********************************************
 Board  215     Board num  LC6L4B12     CRATE  6 L    Slot = 6
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC6L4X1         X1input2 = 1LC6L4X2
 X2input1 = 2LC6L4X1         X2input2 = 2LC6L4X2
 X3input1 = 3LC6L4X1         X3input2 = 3LC6L4X2
@@ -4685,8 +4239,6 @@ Switch( LC6L4B12 )
 *********************************************
 Board  216     Board num  LC6L4B34     CRATE  6 L    Slot = 7
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC6L4X3         X1input2 = 1LC6L4X4
 X2input1 = 2LC6L4X3         X2input2 = 2LC6L4X4
 X3input1 = 3LC6L4X3         X3input2 = 3LC6L4X4
@@ -4706,8 +4258,6 @@ Switch( LC6L4B34 )
 *********************************************
 Board  217     Board num  LC6L5B12     CRATE  6 L    Slot = 8
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC6L5X1         X1input2 = 1LC6L5X2
 X2input1 = 2LC6L5X1         X2input2 = 2LC6L5X2
 X3input1 = 3LC6L5X1         X3input2 = 3LC6L5X2
@@ -4727,8 +4277,6 @@ Switch( LC6L5B12 )
 ******************************************
 Board  218     Board num  LC6L5B34     CRATE  6 L    Slot = 9
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC6L5X3         X1input2 = 1LC6L5X4
 X2input1 = 2LC6L5X3         X2input2 = 2LC6L5X4
 X3input1 = 3LC6L5X3         X3input2 = 3LC6L5X4
@@ -4748,8 +4296,6 @@ Switch( LC6L5B34 )
 *********************************************
 Board  219     Board num  LC6L6B12     CRATE  6 L    Slot = 10
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC6L6X1         X1input2 = 1LC6L6X2
 X2input1 = 2LC6L6X1         X2input2 = 2LC6L6X2
 X3input1 = 3LC6L6X1         X3input2 = 3LC6L6X2
@@ -4769,8 +4315,6 @@ Switch( LC6L6B12 )
 **********************************************
 Board  220     Board num  LC6L6B34     CRATE  6 L    Slot = 11
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC6L6X3         X1input2 = 1LC6L6X4
 X2input1 = 2LC6L6X3         X2input2 = 2LC6L6X4
 X3input1 = 3LC6L6X3         X3input2 = 3LC6L6X4
@@ -4790,8 +4334,6 @@ Switch( LC6L6B34 )
 **********************************************
 Board  221     Board num  LC6L7B12     CRATE  6 L    Slot = 12
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC6L7X1         X1input2 = 1LC6L7X2
 X2input1 = 2LC6L7X1         X2input2 = 2LC6L7X2
 X3input1 = 3LC6L7X1         X3input2 = 3LC6L7X2
@@ -4811,8 +4353,6 @@ Switch( LC6L7B12 )
 **********************************************
 Board  222     Board num  LC6L7B34     CRATE  6 L    Slot = 13
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC6L7X3         X1input2 = 1LC6L7X4
 X2input1 = 2LC6L7X3         X2input2 = 2LC6L7X4
 X3input1 = 3LC6L7X3         X3input2 = 3LC6L7X4
@@ -4832,8 +4372,6 @@ Switch( LC6L7B34 )
 **********************************************
 Board  223     Board num  LC6L8B12     CRATE  6 L    Slot = 14
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC6L8X1         X1input2 = 1LC6L8X2
 X2input1 = 2LC6L8X1         X2input2 = 2LC6L8X2
 X3input1 = 3LC6L8X1         X3input2 = 3LC6L8X2
@@ -4853,8 +4391,6 @@ Switch( LC6L8B12 )
 **********************************************
 Board  224     Board num  LC6L8B34     CRATE  6 L    Slot = 15
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC6L8X3         X1input2 = 1LC6L8X4
 X2input1 = 2LC6L8X3         X2input2 = 2LC6L8X4
 X3input1 = 3LC6L8X3         X3input2 = 3LC6L8X4
@@ -4874,8 +4410,6 @@ Switch( LC6L8B34 )
 **********************************************
 Board  225     Board num  LC6L9B12     CRATE  6 L    Slot = 16
 
-DetElemId  1105  1205  1305  1405 
-
 X1input1 = 1LC6L9X1         X1input2 = 1LC6L9X2
 X2input1 = 2LC6L9X1         X2input2 = 2LC6L9X2
 X3input1 = 3LC6L9X1         X3input2 = 3LC6L9X2
@@ -4894,8 +4428,6 @@ Switch( LC6L9B12 )
 
 *********************************************
 Board  226     Board num  LC7L1B12     CRATE  7 L    Slot = 1
-
-DetElemId  1113  1213  1313  1413 
     
 X1input1 = 1LC7L1X1         X1input2 = 1LC7L1X2
 X2input1 = 2LC7L1X1         X2input2 = 2LC7L1X2
@@ -4916,8 +4448,6 @@ Switch( LC7L1B12 )
 *********************************************
 Board  227     Board num  LC7L2B12     CRATE  7 L    Slot = 2
 
-DetElemId  1112  1212  1312  1412 
-
 X1input1 = 1LC7L2X1         X1input2 = 1LC7L2X2
 X2input1 = 2LC7L2X1         X2input2 = 2LC7L2X2
 X3input1 = 3LC7L2X1         X3input2 = 3LC7L2X2
@@ -4937,8 +4467,6 @@ Switch( LC7L2B12 )
 *********************************************
 Board  228     Board num  LC7L3B12     CRATE  7 L    Slot = 3
 
-DetElemId  1111  1211  1311  1411 
-
 X1input1 = 1LC7L3X1         X1input2 = 1LC7L3X2
 X2input1 = 2LC7L3X1         X2input2 = 2LC7L3X2
 X3input1 = 3LC7L3X1         X3input2 = 3LC7L3X2
@@ -4958,8 +4486,6 @@ Switch( LC7L3B12 )
 *********************************************
 Board  229     Board num  LC7L4B12     CRATE  7 L    Slot = 4
 
-DetElemId  1110  1210  1310  1410 
-
 X1input1 = 1LC7L4X1         X1input2 = 1LC7L4X2
 X2input1 = 2LC7L4X1         X2input2 = 2LC7L4X2
 X3input1 = 3LC7L4X1         X3input2 = 3LC7L4X2
@@ -4979,8 +4505,6 @@ Switch( LC7L4B12 )
 *********************************************
 Board  230     Board num  LC7L5B12     CRATE  7 L    Slot = 5
 
-DetElemId  1109  1209  1309  1409 
-
 X1input1 = 1LC7L5X1         X1input2 = 1LC7L5X2
 X2input1 = 2LC7L5X1         X2input2 = 2LC7L5X2
 X3input1 = 3LC7L5X1         X3input2 = 3LC7L5X2
@@ -5000,8 +4524,6 @@ Switch( LC7L5B12 )
 *********************************************
 Board  231     Board num  LC7L6B12     CRATE  7 L    Slot = 6
 
-DetElemId  1108  1208  1308  1408 
-
 X1input1 = 1LC7L6X1         X1input2 = 1LC7L6X2
 X2input1 = 2LC7L6X1         X2input2 = 2LC7L6X2
 X3input1 = 3LC7L6X1         X3input2 = 3LC7L6X2
@@ -5021,8 +4543,6 @@ Switch( LC7L6B12 )
 *********************************************
 Board  232     Board num  LC7L7B12     CRATE  7 L    Slot = 7
 
-DetElemId  1107  1207  1307  1407 
-
 X1input1 = 1LC7L7X1         X1input2 = 1LC7L7X2
 X2input1 = 2LC7L7X1         X2input2 = 2LC7L7X2
 X3input1 = 3LC7L7X1         X3input2 = 3LC7L7X2
@@ -5042,8 +4562,6 @@ Switch( LC7L7B12 )
 *********************************************
 Board  233     Board num  LC7L8B12     CRATE  7 L    Slot = 8
 
-DetElemId  1106  1206  1306  1406 
-
 X1input1 = 1LC7L8X1         X1input2 = 1LC7L8X2
 X2input1 = 2LC7L8X1         X2input2 = 2LC7L8X2
 X3input1 = 3LC7L8X1         X3input2 = 3LC7L8X2
@@ -5063,8 +4581,6 @@ Switch( LC7L8B12 )
 ******************************************
 Board  234     Board num  LC7L9B12     CRATE  7 L    Slot = 9
 
-DetElemId  1105  1205  1305  1405 
-
 X1input1 = 1LC7L9X1         X1input2 = 1LC7L9X2
 X2input1 = 2LC7L9X1         X2input2 = 2LC7L9X2
 X3input1 = 3LC7L9X1         X3input2 = 3LC7L9X2
diff --git a/MUON/rootlogon.C b/MUON/rootlogon.C
index f98af17eea8..2a7fc3d77c1 100644
--- a/MUON/rootlogon.C
+++ b/MUON/rootlogon.C
@@ -11,13 +11,5 @@
   gInterpreter->ProcessLine("loadlibs()");
     
   cout << "Setting include path ..." << endl;
-  TString includePath = "-I${ALICE_ROOT}/include ";
-  includePath        += "-I${ALICE_ROOT}/RAW ";
-  includePath        += "-I${ALICE_ROOT}/FASTSIM ";
-  includePath        += "-I${ALICE_ROOT}/EVGEN ";
-  includePath        += "-I${ALICE_ROOT}/SHUTTLE/TestShuttle ";
-  includePath        += "-I${ALICE_ROOT}/ITS ";
-  includePath        += "-I${ALICE_ROOT}/MUON ";
-  includePath        += "-I${ALICE_ROOT}/MUON/mapping";
-  gSystem->SetIncludePath(includePath.Data());
+  gSystem->SetIncludePath("-I${ALICE_ROOT}/include -I${ALICE_ROOT}/RAW -I${ALICE_ROOT}/MUON -I${ALICE_ROOT}/MUON/mapping");
 }
diff --git a/Makefile b/Makefile
index 791297046da..de34189ae6c 100644
--- a/Makefile
+++ b/Makefile
@@ -156,7 +156,7 @@ DEPINC     += $(GENINC)
 # Libraries will be linked against SHLIB
 # ROOT libraries 
 
-ROOTCLIBS     := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof -lProofPlayer
+ROOTCLIBS     := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO
 
 ROOTPLIBS     := -lEGPythia6
 
diff --git a/PHOS/AliPHOSCalibData.cxx b/PHOS/AliPHOSCalibData.cxx
index db6ed5faa4e..ac42bd13a60 100644
--- a/PHOS/AliPHOSCalibData.cxx
+++ b/PHOS/AliPHOSCalibData.cxx
@@ -54,14 +54,14 @@ ClassImp(AliPHOSCalibData)
     fCalibDataEmc = (AliPHOSEmcCalibData*)entryEmc->GetObject();
 
   if(!fCalibDataEmc)
-    AliWarning("Calibration parameters for PHOS EMC not found. Create a new set.\n");
+    AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction!\n");
     
   AliCDBEntry* entryCpv = AliCDBManager::Instance()->Get(fCpvDataPath.Data());
   if(entryCpv)
     fCalibDataCpv = (AliPHOSCpvCalibData*)entryCpv->GetObject();
 
   if(!fCalibDataCpv)
-    AliWarning("Calibration parameters for PHOS CPV not found. Create a new set.\n");
+    AliFatal("Calibration parameters for PHOS CPV not found. Stop reconstruction!\n");
 
   AliCDBEntry* entryEmcBadMap = AliCDBManager::Instance()->Get(fEmcBadChannelsMapPath.Data());
   if(entryEmcBadMap)
diff --git a/PHOS/AliPHOSCalibData.h b/PHOS/AliPHOSCalibData.h
index 48866ddff1a..a8c8c7282a1 100644
--- a/PHOS/AliPHOSCalibData.h
+++ b/PHOS/AliPHOSCalibData.h
@@ -30,9 +30,6 @@ class AliPHOSCalibData: public TNamed {
 
   void Reset();
   virtual void Print(Option_t *option = "") const; 
-
-  AliPHOSEmcCalibData *GetCalibDataEmc() const {return fCalibDataEmc;}
-  AliPHOSCpvCalibData *GetCalibDataCpv() const {return fCalibDataCpv;}
   
   void CreateNew();
   void RandomEmc(Float_t ccMin=0.5   , Float_t ccMax=1.5);
diff --git a/PHOS/AliPHOSClusterizerv1.cxx b/PHOS/AliPHOSClusterizerv1.cxx
index 73a91a6f70a..1bff0e02cbd 100644
--- a/PHOS/AliPHOSClusterizerv1.cxx
+++ b/PHOS/AliPHOSClusterizerv1.cxx
@@ -18,9 +18,6 @@
 /* History of cvs commits:
  *
  * $Log$
- * Revision 1.104  2007/04/27 16:55:53  kharlov
- * Calibration stops if PHOS CDB objects do not exist
- *
  * Revision 1.103  2007/04/11 11:55:45  policheh
  * SetDistancesToBadChannels() added.
  *
@@ -445,11 +442,6 @@ void AliPHOSClusterizerv1::GetCalibrationParameters()
   // AliCDBStorage* storage = AliCDBManager::Instance()->GetStorage("local://CalibDB");
 
   fCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number
-  if (fCalibData->GetCalibDataEmc() == 0)
-    AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction.\n");
-  if (fCalibData->GetCalibDataCpv() == 0)
-    AliFatal("Calibration parameters for PHOS CPV not found. Stop reconstruction.\n");
-
 }
 
 //____________________________________________________________________________
diff --git a/PHOS/AliPHOSGeometry.cxx b/PHOS/AliPHOSGeometry.cxx
index ad7fe75513c..4a8e2efcdf8 100644
--- a/PHOS/AliPHOSGeometry.cxx
+++ b/PHOS/AliPHOSGeometry.cxx
@@ -262,18 +262,13 @@ Bool_t AliPHOSGeometry::AbsToRelNumbering(Int_t AbsId, Int_t * relid) const
   } 
   return rv ; 
 }
-//____________________________________________________________________________
-void AliPHOSGeometry::GetGlobal(const AliRecPoint* recPoint, TVector3 & gpos) const
-{
-  AliFatal(Form("Please use GetGlobalPHOS(recPoint,gpos) instead of GetGlobal!"));
-}
 
 //____________________________________________________________________________
-void AliPHOSGeometry::GetGlobalPHOS(const AliPHOSRecPoint* recPoint, TVector3 & gpos) const
+void AliPHOSGeometry::GetGlobal(const AliRecPoint* recPoint, TVector3 & gpos) const
 {
   // Calculates the coordinates of a RecPoint and the error matrix in the ALICE global coordinate system
  
-  const AliPHOSRecPoint * tmpPHOS = recPoint ;  
+  AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) recPoint ;  
   TVector3 localposition ;
 
   tmpPHOS->GetLocalPosition(gpos) ;
diff --git a/PHOS/AliPHOSGeometry.h b/PHOS/AliPHOSGeometry.h
index b6b15793999..d5e9951dd37 100644
--- a/PHOS/AliPHOSGeometry.h
+++ b/PHOS/AliPHOSGeometry.h
@@ -25,8 +25,6 @@
 #include "AliPHOSCPVGeometry.h"
 #include "AliPHOSSupportGeometry.h"
 
-class AliPHOSRecPoint;
-class TVector3;
 
 class AliPHOSGeometry : public AliGeometry {
 
@@ -41,9 +39,6 @@ class AliPHOSGeometry : public AliGeometry {
   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrixF & /* gmat */) const 
                  {GetGlobal(RecPoint,gpos); }
   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
-  virtual void   GetGlobalPHOS(const AliPHOSRecPoint* RecPoint, TVector3 & gpos) const ;
-  virtual void   GetGlobalPHOS(const AliPHOSRecPoint* RecPoint, TVector3 & gpos, TMatrixF & /* gmat */) const 
-                 {GetGlobalPHOS(RecPoint,gpos); }
   virtual Bool_t Impact(const TParticle * particle) const ;
 
   AliPHOSGeometry & operator = (const AliPHOSGeometry  & /*rvalue*/) {
diff --git a/PHOS/AliPHOSPIDv1.cxx b/PHOS/AliPHOSPIDv1.cxx
index 48eabe6dc52..0ba806b578f 100644
--- a/PHOS/AliPHOSPIDv1.cxx
+++ b/PHOS/AliPHOSPIDv1.cxx
@@ -18,9 +18,6 @@
 /* History of cvs commits:
  *
  * $Log$
- * Revision 1.110  2007/04/24 10:08:03  kharlov
- * Vertex extraction from GenHeader
- *
  * Revision 1.109  2007/04/18 09:34:05  kharlov
  * Geometry bug fixes
  *
@@ -1507,7 +1504,7 @@ void  AliPHOSPIDv1::MakeRecParticles()
     AliPHOSTrackSegment * ts  = gime->TrackSegment(rp->GetPHOSTSIndex()) ; 
     AliPHOSEmcRecPoint  * erp = gime->EmcRecPoint(ts->GetEmcIndex()) ; 
     TVector3 pos ; 
-    geom->GetGlobalPHOS(erp, pos) ; 
+    geom->GetGlobal(erp, pos) ; 
     rp->SetPos(pos);
     index++ ; 
   }
diff --git a/PHOS/AliPHOSRecPoint.cxx b/PHOS/AliPHOSRecPoint.cxx
index bb2b1de4bc0..d259034baa4 100644
--- a/PHOS/AliPHOSRecPoint.cxx
+++ b/PHOS/AliPHOSRecPoint.cxx
@@ -40,78 +40,24 @@ ClassImp(AliPHOSRecPoint)
 
 //____________________________________________________________________________
 AliPHOSRecPoint::AliPHOSRecPoint()
-  : AliCluster(),fPHOSMod(0),
-    fMulTrack(0),fMaxDigit(100),fMulDigit(0),fMaxTrack(0),
-    fDigitsList(0),fTracksList(0),fAmp(0),
-    fIndexInList(-1), // to be set when the point is already stored
-    fLocPos(0,0,0),fLocPosM(0)
+  : AliRecPoint(),
+    fPHOSMod(0)
 {
   // ctor
 
+  fMaxTrack = 0 ;
 }
 
 //____________________________________________________________________________
-AliPHOSRecPoint::AliPHOSRecPoint(const char * ) 
-  : AliCluster(),fPHOSMod(0),
-    fMulTrack(0),fMaxDigit(100),fMulDigit(0),fMaxTrack(200),
-    fDigitsList(new int[fMaxDigit]),fTracksList(new int[fMaxTrack]),fAmp(0),
-    fIndexInList(-1), // to be set when the point is already stored
-    fLocPos(0,0,0),fLocPosM(new TMatrixF(3,3))
-
+AliPHOSRecPoint::AliPHOSRecPoint(const char * opt) 
+  : AliRecPoint(opt),
+    fPHOSMod(0)
 {
   // ctor
   
+  fMaxTrack = 200 ;
 }
-//_______________________________________________________________________
-AliPHOSRecPoint::~AliPHOSRecPoint()
-{
-  // dtor
-  
-  delete fLocPosM ; 
-  delete [] fDigitsList ; 
-  delete [] fTracksList ;  
-  
-}
-//____________________________________________________________________________
-AliPHOSRecPoint::AliPHOSRecPoint(const AliPHOSRecPoint &rp) : 
-  AliCluster(rp),
-  fPHOSMod(rp.fPHOSMod),fMulTrack(rp.fMulTrack),fMaxDigit(rp.fMaxDigit),
-  fMulDigit(rp.fMulDigit),fMaxTrack(rp.fMaxTrack),fDigitsList(new int[rp.fMaxDigit]),
-  fTracksList(new int[rp.fMaxTrack]),fAmp(rp.fAmp),fIndexInList(rp.fIndexInList), 
-  fLocPos(rp.fLocPos),fLocPosM(rp.fLocPosM)
-{
-  //copy ctor
 
-  for(Int_t i=0; iPHOSGeometry()->GetGlobalPHOS(this, gpos, gmat);
-
-//   Float_t xyz[3];
-//   GetGlobalXYZ(xyz);
-//   gpos.SetXYZ(xyz[0],xyz[1],xyz[2]);
-
-  
+  (AliPHOSGetter::Instance())->PHOSGeometry()->GetGlobal(this, gpos, gmat);
 }
 
 
@@ -337,10 +276,4 @@ void AliPHOSRecPoint::Paint(Option_t *)
   gPad->PaintPolyMarker(1,&x,&y,"") ;
 }
 //______________________________________________________________________________
-void AliPHOSRecPoint::GetLocalPosition(TVector3 & pos) const
-{
-  // returns the position of the cluster in the local reference system 
-  // of the sub-detector
-  
-  pos = fLocPos;
-}
+
diff --git a/PHOS/AliPHOSRecPoint.h b/PHOS/AliPHOSRecPoint.h
index c49f70bee04..b3951a53bf6 100644
--- a/PHOS/AliPHOSRecPoint.h
+++ b/PHOS/AliPHOSRecPoint.h
@@ -8,17 +8,19 @@
 //*-- Author: Gines Martinez (SUBATECH)
 
 // --- ROOT system ---
-#include 
+
+//#include "TMarker.h"
+//#include "TGraph.h"
+//#include "TPaveText.h"
+  class TClonesArray ;
+// --- Standard library ---
 
 // --- AliRoot header files ---
-#include "AliCluster.h"
 
-class TClonesArray ;
-class AliPHOSDigit ;
-class AliDigitNew;
-class TMAtrixF; 
+#include "AliRecPoint.h"
+class AliPHOSDigit ; 
 
-class AliPHOSRecPoint : public AliCluster {
+class AliPHOSRecPoint : public AliRecPoint {
 
  public:
   
@@ -26,13 +28,10 @@ class AliPHOSRecPoint : public AliCluster {
 
   AliPHOSRecPoint() ;                   // ctor         
   AliPHOSRecPoint(const char * opt) ;   // ctor 
-
-  AliPHOSRecPoint(const AliPHOSRecPoint &rp);
-  AliPHOSRecPoint& operator= (const AliPHOSRecPoint &rp);
-
   
-  virtual ~AliPHOSRecPoint();
-
+  virtual ~AliPHOSRecPoint(){
+    // dtor
+  }
   virtual  void   AddDigit(AliDigitNew &){
    Fatal("AddDigit", "use AddDigit(AliPHOSDigit & digit, Float_t Energy)") ; 
   }
@@ -41,24 +40,18 @@ class AliPHOSRecPoint : public AliCluster {
   virtual Int_t   DistancetoPrimitive(Int_t px, Int_t py);
   virtual void    Draw(Option_t * option="") ;
   virtual void    ExecuteEvent(Int_t event, Int_t px, Int_t py) ;
-  void            EvalAll(TClonesArray * digits) ;  
+  void    EvalAll(TClonesArray * digits) ;  
   virtual void    EvalPHOSMod(AliPHOSDigit * digit) ;  
-  virtual void    EvalPrimaries(TClonesArray * digits) ;
-  virtual int *   GetDigitsList(void) const { return fDigitsList ; }  
-  virtual Float_t GetEnergy() const {return fAmp; }
-  virtual void    GetLocalPosition(TVector3 & pos) const ;   
+  virtual void    EvalPrimaries(TClonesArray * digits) ;  
   virtual void    GetGlobalPosition(TVector3 & gpos, TMatrixF & gmat) const ; // return global position in ALICE
   virtual Int_t   GetPHOSMod(void) const {return fPHOSMod ; }
   virtual Int_t * GetPrimaries(Int_t & number) const {number = fMulTrack ; 
                                                       return fTracksList ; }
-  virtual Int_t   GetDigitsMultiplicity(void) const { return fMulDigit ; }
-  Int_t           GetIndexInList() const { return fIndexInList ; }
   virtual Bool_t  IsEmc(void)const { return kTRUE ;  } 
   virtual Bool_t  IsSortable() const { 
     // tells that this is a sortable object
     return kTRUE ; 
   }  
-  void            SetIndexInList(Int_t val) { fIndexInList = val ; }
   virtual void    Paint(Option_t * option="");
   virtual void    Print(Option_t *) const {
     // Print prototype
@@ -66,20 +59,9 @@ class AliPHOSRecPoint : public AliCluster {
 
 protected:
   
-  Int_t     fPHOSMod ;    // PHOS Module number in which the RecPoint is found
-  Int_t     fMulTrack ;   // total multiplicity of tracks to which the point was assigned
-  Int_t     fMaxDigit ;   //! max initial size of digits array (not saved)
-  Int_t     fMulDigit ;   // total multiplicity of digits
-  Int_t     fMaxTrack ;   //! max initial size of tracks array (not saved)
-  Int_t*    fDigitsList ; //[fMulDigit] list of digit's indexes from which the point was reconstructed 
-  Int_t*    fTracksList ; //[fMulTrack] list of tracks to which the point was assigned 
-  Float_t   fAmp ;        // summed amplitude of digits 
-  Int_t     fIndexInList ;// the index of this RecPoint in the list stored in TreeR (to be set by analysis)  
-  TVector3  fLocPos ;     // local position in the sub-detector coordinate
-  TMatrixF* fLocPosM ;    // covariance matrix ;
-
-
-  ClassDef(AliPHOSRecPoint,2) // RecPoint for PHOS (Base Class)
+  Int_t fPHOSMod ;      // PHOS Module number in which the RecPoint is found
+  
+  ClassDef(AliPHOSRecPoint,1) // RecPoint for PHOS (Base Class)
  
 };
 
diff --git a/PHOS/AliPHOSTrackSegmentMakerv1.cxx b/PHOS/AliPHOSTrackSegmentMakerv1.cxx
index 12c90cd4321..1f475525c63 100644
--- a/PHOS/AliPHOSTrackSegmentMakerv1.cxx
+++ b/PHOS/AliPHOSTrackSegmentMakerv1.cxx
@@ -17,9 +17,6 @@
 /* History of cvs commits:
  *
  * $Log$
- * Revision 1.86  2007/04/02 15:00:16  cvetan
- * No more calls to gAlice in the reconstruction
- *
  * Revision 1.85  2007/03/28 19:18:15  kharlov
  * RecPoints recalculation in TSM removed
  *
@@ -249,7 +246,7 @@ void  AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * em
     
   Double_t xCPV,zCPV ; //EMC-projected coordinates of CPV cluster 
   TVector3 cpvGlobal; // Global position of the CPV recpoint
-  geom->GetGlobalPHOS((AliPHOSRecPoint*)cpvClu,cpvGlobal);
+  geom->GetGlobal((AliRecPoint*)cpvClu,cpvGlobal);
   Double_t vtxCPV[3]={cpvGlobal.X(),cpvGlobal.Y(),cpvGlobal.Z()} ;
 
   if (fESD == 0x0) {
diff --git a/PHOS/AliPHOSTrackSegmentMakerv2.cxx b/PHOS/AliPHOSTrackSegmentMakerv2.cxx
index 70900bbfd33..3afbb7e8faa 100644
--- a/PHOS/AliPHOSTrackSegmentMakerv2.cxx
+++ b/PHOS/AliPHOSTrackSegmentMakerv2.cxx
@@ -17,9 +17,6 @@
 /* History of cvs commits:
  *
  * $Log$
- * Revision 1.3  2007/04/25 19:39:42  kharlov
- * Track extracpolation improved
- *
  * Revision 1.2  2007/04/01 19:16:52  kharlov
  * D.P.: Produce EMCTrackSegments using TPC/ITS tracks (no CPV)
  *
@@ -227,7 +224,7 @@ void  AliPHOSTrackSegmentMakerv2::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * em
 
   const AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
   TVector3 emcGlobal; // Global position of the EMC recpoint
-  geom->GetGlobalPHOS((AliPHOSRecPoint*)emcClu,emcGlobal);
+  geom->GetGlobal((AliRecPoint*)emcClu,emcGlobal);
 
   //Calculate actual distance to the PHOS surface
   Double_t modAngle=270.+geom->GetPHOSAngle(emcClu->GetPHOSMod()) ;
diff --git a/PHOS/macros/CalibrationDB/AliPHOSSetCDB.C b/PHOS/macros/CalibrationDB/AliPHOSSetCDB.C
index f5e4b9b203b..7df4a8361be 100644
--- a/PHOS/macros/CalibrationDB/AliPHOSSetCDB.C
+++ b/PHOS/macros/CalibrationDB/AliPHOSSetCDB.C
@@ -81,7 +81,7 @@ void SetCC(Int_t flag=0)
   if      (flag == 0) {
     DBFolder  ="local://InitCalibDB";
     firstRun  =  0;
-    lastRun   =  999999;
+    lastRun   =  0;
     objFormat = "PHOS initial pedestals and ADC gain factors (5x64x56)";
     cdb = new AliPHOSCalibData();
     cdb->CreateNew();
@@ -89,8 +89,8 @@ void SetCC(Int_t flag=0)
 
   else if (flag == 1) {
     DBFolder  ="local://DeCalibDB";
-    firstRun  =  0;
-    lastRun   =  999999;
+    firstRun  =  100;
+    lastRun   =  100;
     objFormat = "PHOS decalibration pedestals and ADC gain factors (5x64x56)";
  
     cdb = new AliPHOSCalibData();    
@@ -101,12 +101,12 @@ void SetCC(Int_t flag=0)
   else if (flag == 2) {
     // First read decalibration DB
     AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    AliCDBManager::Instance()->SetSpecificStorage("PHOS/*","local://DeCalibDB");
+    AliCDBManager::Instance()->SetSpecificStorage("PHOS","local://DeCalibDB");
     AliPHOSCalibData* cdbDecalib = new AliPHOSCalibData(100);
 
     DBFolder  ="local://InverseCalibDB";
-    firstRun  = 0;
-    lastRun   = 999999;
+    firstRun  = 200;
+    lastRun   = 200;
     objFormat = "PHOS calibration parameters equal to inverse decalibration ones (5x64x56)";
     cdb = new AliPHOSCalibData();    
 
@@ -155,7 +155,7 @@ void SetCC(Int_t flag=0)
   md.SetResponsible("Boris Polichtchouk");
   
   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-  AliCDBManager::Instance()->SetSpecificStorage("PHOS/*",DBFolder.Data());
+  AliCDBManager::Instance()->SetSpecificStorage("PHOS",DBFolder.Data());
 
   cdb->WriteEmc(firstRun,lastRun,&md);
   cdb->WriteCpv(firstRun,lastRun,&md);
@@ -193,7 +193,7 @@ void GetCC(Int_t flag=0)
   }
 
   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-  AliCDBManager::Instance()->SetSpecificStorage("PHOS/*",DBFolder.Data());
+  AliCDBManager::Instance()->SetSpecificStorage("PHOS",DBFolder.Data());
 
   AliPHOSCalibData* clb  = new AliPHOSCalibData(runNumber);
 
diff --git a/PMD/AliPMDPreprocessor.cxx b/PMD/AliPMDPreprocessor.cxx
index e99d2bb42c1..6eac322a9a3 100644
--- a/PMD/AliPMDPreprocessor.cxx
+++ b/PMD/AliPMDPreprocessor.cxx
@@ -120,14 +120,6 @@ UInt_t AliPMDPreprocessor::Process(TMap* pdaqAliasMap)
   result = Store("Calib","Data", calibda, &metaData);
 
  delete calibda;
-if(result==0)
-      { Log("Error storing");                        
-        return 1;
- }
- else
- {
-        return 0;
- }
-
+ return result;
 }
 
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx
index 0de85ab3488..d9419f582eb 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx
@@ -193,42 +193,36 @@ void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
   }
 }
 //____________________________
-AliFemtoAnalysis::AliFemtoAnalysis() :
-  fPicoEventCollectionVectorHideAway(0), 
-  fPairCut(0),            
-  fCorrFctnCollection(0), 
-  fEventCut(0),           
-  fFirstParticleCut(0),   
-  fSecondParticleCut(0),  
-  fMixingBuffer(0),       
-  fPicoEvent(0),          
-  fNumEventsToMix(0),                     
-  fNeventsProcessed(0),                   
-  fMinSizePartCollection(0)
-{
+AliFemtoAnalysis::AliFemtoAnalysis(){
   //  mControlSwitch     = 0;
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
   fMixingBuffer = new AliFemtoPicoEventCollection;
+  fNeventsProcessed = 0;
+  fPicoEvent=0;
+
+  fPicoEventCollectionVectorHideAway = 0;
+
+  fMinSizePartCollection=0;  // minimum # particles in ParticleCollection
+
 }
 //____________________________
 
-AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) : 
-  AliFemtoBaseAnalysis(),
-  fPicoEventCollectionVectorHideAway(0), 
-  fPairCut(0),            
-  fCorrFctnCollection(0), 
-  fEventCut(0),           
-  fFirstParticleCut(0),   
-  fSecondParticleCut(0),  
-  fMixingBuffer(0),       
-  fPicoEvent(0),          
-  fNumEventsToMix(0),                     
-  fNeventsProcessed(0),                   
-  fMinSizePartCollection(0)
-{
+AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) : AliFemtoBaseAnalysis() {
   //AliFemtoAnalysis();
+  fEventCut          = 0;
+  fFirstParticleCut  = 0;
+  fSecondParticleCut = 0;
+  fPairCut           = 0;
+  fCorrFctnCollection= 0;
   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
   fMixingBuffer = new AliFemtoPicoEventCollection;
+  fNeventsProcessed = 0;
+  fPicoEvent=0;
 
   // find the right event cut
   fEventCut = a.fEventCut->Clone();
@@ -297,59 +291,6 @@ AliFemtoAnalysis::~AliFemtoAnalysis(){
   }
 }
 //______________________
-AliFemtoAnalysis& AliFemtoAnalysis::operator=(const AliFemtoAnalysis& aAna) 
-{
-  if (this == &aAna)
-    return *this;
-
-  fCorrFctnCollection = new AliFemtoCorrFctnCollection;
-  fMixingBuffer = new AliFemtoPicoEventCollection;
-
-  // find the right event cut
-  fEventCut = aAna.fEventCut->Clone();
-  // find the right first particle cut
-  fFirstParticleCut = aAna.fFirstParticleCut->Clone();
-  // find the right second particle cut
-  if (aAna.fFirstParticleCut==aAna.fSecondParticleCut) 
-    SetSecondParticleCut(fFirstParticleCut); // identical particle hbt
-  else
-    fSecondParticleCut = aAna.fSecondParticleCut->Clone();
-
-  fPairCut = aAna.fPairCut->Clone();
-  
-  if ( fEventCut ) {
-      SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
-      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - event cut set " << endl;
-  }
-  if ( fFirstParticleCut ) {
-      SetFirstParticleCut(fFirstParticleCut); // this will set the myAnalysis pointer inside the cut
-      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - first particle cut set " << endl;
-  }
-  if ( fSecondParticleCut ) {
-      SetSecondParticleCut(fSecondParticleCut); // this will set the myAnalysis pointer inside the cut
-      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - second particle cut set " << endl;
-  }  if ( fPairCut ) {
-      SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
-      cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - pair cut set " << endl;
-  }
-
-  AliFemtoCorrFctnIterator iter;
-  for (iter=aAna.fCorrFctnCollection->begin(); iter!=aAna.fCorrFctnCollection->end();iter++){
-    cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - looking for correlation functions " << endl;
-    AliFemtoCorrFctn* fctn = (*iter)->Clone();
-    if (fctn) AddCorrFctn(fctn);
-    else cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - correlation function not found " << endl;
-  }
-
-  fNumEventsToMix = aAna.fNumEventsToMix;
-
-  fMinSizePartCollection = aAna.fMinSizePartCollection;  // minimum # particles in ParticleCollection
-
-  cout << " AliFemtoAnalysis::AliFemtoAnalysis(const AliFemtoAnalysis& a) - analysis copied " << endl;
-
-  return *this;
-}
-//______________________
 AliFemtoCorrFctn* AliFemtoAnalysis::CorrFctn(int n){  // return pointer to n-th correlation function
   if ( n<0 || n > (int)fCorrFctnCollection->size() )
     return NULL;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.h b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.h
index 9fdde6a690d..f709edfa1e2 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.h
@@ -31,8 +31,6 @@ class AliFemtoAnalysis : public AliFemtoBaseAnalysis {
   AliFemtoAnalysis(const AliFemtoAnalysis& OriginalAnalysis);  // copy constructor
   virtual ~AliFemtoAnalysis();
 
-  AliFemtoAnalysis& operator=(const AliFemtoAnalysis& aAna);
-
   // Gets and Sets
 
   virtual AliFemtoPairCut*       PairCut();
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.cxx
index 1b3c197238b..1471dfe5779 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoLikeSignAnalysis.cxx
@@ -33,12 +33,7 @@ extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
 
  
 //____________________________
-AliFemtoLikeSignAnalysis::AliFemtoLikeSignAnalysis(unsigned int bins, double min, double max) : 
-  AliFemtoAnalysis(),
-  fVertexBins(0),
-  fOverFlow(0),  
-  fUnderFlow(0)  
-{
+AliFemtoLikeSignAnalysis::AliFemtoLikeSignAnalysis(unsigned int bins, double min, double max) : AliFemtoAnalysis() {
   fVertexBins = bins;
   fVertexZ[0] = min;
   fVertexZ[1] = max;
@@ -49,12 +44,7 @@ AliFemtoLikeSignAnalysis::AliFemtoLikeSignAnalysis(unsigned int bins, double min
     /* no-op */
 }
 //____________________________
-AliFemtoLikeSignAnalysis::AliFemtoLikeSignAnalysis(const AliFemtoLikeSignAnalysis& a) : 
-  AliFemtoAnalysis(a) ,
-  fVertexBins(0),
-  fOverFlow(0),  
-  fUnderFlow(0)  
-{
+AliFemtoLikeSignAnalysis::AliFemtoLikeSignAnalysis(const AliFemtoLikeSignAnalysis& a) : AliFemtoAnalysis(a) {
   fVertexBins = a.fVertexBins; 
   fVertexZ[0] = a.fVertexZ[0]; 
   fVertexZ[1] = a.fVertexZ[1];
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx
index f50a9363091..cd50d69fc94 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexAnalysis.cxx
@@ -13,9 +13,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -54,11 +51,7 @@ extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
 
 
 //____________________________
-AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(unsigned int bins, double min, double max):
-  fVertexBins(0),
-  fOverFlow(0),  
-  fUnderFlow(0)
-{
+AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(unsigned int bins, double min, double max){
   //  mControlSwitch     = 0;
   fEventCut          = 0;
   fFirstParticleCut  = 0;
@@ -76,12 +69,7 @@ AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(unsigned int bins, double min, do
 };
 //____________________________
 
-AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) : 
-  AliFemtoAnalysis(),
-  fVertexBins(0),
-  fOverFlow(0),  
-  fUnderFlow(0)
-{
+AliFemtoVertexAnalysis::AliFemtoVertexAnalysis(const AliFemtoVertexAnalysis& a) : AliFemtoAnalysis() {
   //AliFemtoVertexAnalysis();
   fEventCut          = 0;
   fFirstParticleCut  = 0;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.cxx b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.cxx
index 0b97218ddc2..f6cc2d9b731 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Analysis/AliFemtoVertexMultAnalysis.cxx
@@ -13,9 +13,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -57,14 +54,7 @@ extern void FillHbtParticleCollection(AliFemtoParticleCut*         partCut,
 //____________________________
 AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(unsigned int binsVertex, double minVertex, double maxVertex,
 						 unsigned int binsMult, double minMult, double maxMult) 
-  : 
-  fVertexZBins(binsVertex), 
-  fOverFlowVertexZ(0), 
-  fUnderFlowVertexZ(0),
-  fMultBins(binsMult) ,
-  fOverFlowMult(0),    
-  fUnderFlowMult(0)    
-{
+  : fVertexZBins(binsVertex), fMultBins(binsMult) {
   //  mControlSwitch     = 0;
   fEventCut          = 0;
   fFirstParticleCut  = 0;
@@ -86,15 +76,7 @@ AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(unsigned int binsVertex,
 };
 //____________________________
 
-AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) : 
-  AliFemtoAnalysis(),
-  fVertexZBins(a.fVertexZBins), 
-  fOverFlowVertexZ(0), 
-  fUnderFlowVertexZ(0),
-  fMultBins(a.fMultBins) ,
-  fOverFlowMult(0),    
-  fUnderFlowMult(0)    
-{
+AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultAnalysis& a) : AliFemtoAnalysis() {
   //AliFemtoVertexMultAnalysis();
   fEventCut          = 0;
   fFirstParticleCut  = 0;
@@ -102,10 +84,12 @@ AliFemtoVertexMultAnalysis::AliFemtoVertexMultAnalysis(const AliFemtoVertexMultA
   fPairCut           = 0;
   fCorrFctnCollection= 0;
   fCorrFctnCollection = new AliFemtoCorrFctnCollection;
+  fVertexZBins = a.fVertexZBins; 
   fVertexZ[0] = a.fVertexZ[0]; 
   fVertexZ[1] = a.fVertexZ[1];
   fUnderFlowVertexZ = 0; 
   fOverFlowVertexZ = 0; 
+  fMultBins = a.fMultBins; 
   fMult[0] = a.fMult[0]; 
   fMult[1] = a.fMult[1];
   fUnderFlowMult = 0; 
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCorrFctn.h
index 277d2d2e2bd..6dfbcf2786e 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCorrFctn.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoCorrFctn.h
@@ -14,15 +14,14 @@ class AliFemtoCorrFctn{
   friend class AliFemtoBaseAnalysis;
 
 public:
-  AliFemtoCorrFctn();
+  AliFemtoCorrFctn(){/* no-op */};
   AliFemtoCorrFctn(const AliFemtoCorrFctn& aCorrFctn);
   virtual ~AliFemtoCorrFctn(){/* no-op */};
-  AliFemtoCorrFctn& operator=(const AliFemtoCorrFctn& aCorrFctn);
 
   virtual AliFemtoString Report() = 0;
 
-  virtual void AddRealPair(AliFemtoPair* aPair);
-  virtual void AddMixedPair(AliFemtoPair* aPir);
+  virtual void AddRealPair(const AliFemtoPair* aPair);
+  virtual void AddMixedPair(const AliFemtoPair* aPir);
 
   virtual void EventBegin(const AliFemtoEvent* aEvent) { /* no-op */ }
   virtual void EventEnd(const AliFemtoEvent* aEvent) { /* no-op */ }
@@ -40,12 +39,10 @@ class AliFemtoCorrFctn{
 
 };
 
-inline void AliFemtoCorrFctn::AddRealPair(AliFemtoPair*) { cout << "Not implemented" << endl; }
-inline void AliFemtoCorrFctn::AddMixedPair(AliFemtoPair*) { cout << "Not implemented" << endl; }
+inline void AliFemtoCorrFctn::AddRealPair(const AliFemtoPair*) { cout << "Not implemented" << endl; }
+inline void AliFemtoCorrFctn::AddMixedPair(const AliFemtoPair*) { cout << "Not implemented" << endl; }
 
-inline AliFemtoCorrFctn::AliFemtoCorrFctn(const AliFemtoCorrFctn& c):fyAnalysis(0) {}
-inline AliFemtoCorrFctn::AliFemtoCorrFctn(): fyAnalysis(0) {/* no-op */};
+inline AliFemtoCorrFctn::AliFemtoCorrFctn(const AliFemtoCorrFctn& c) { fyAnalysis =0; }
 inline void AliFemtoCorrFctn::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
-inline AliFemtoCorrFctn& AliFemtoCorrFctn::operator=(const AliFemtoCorrFctn& aCorrFctn) { if (this == &aCorrFctn) return *this; fyAnalysis = aCorrFctn.fyAnalysis; return *this; }
 
 #endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventCut.h
index f3b50e49eef..9944b7eaa2f 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventCut.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventCut.h
@@ -17,11 +17,10 @@ class AliFemtoEventCut : public AliFemtoCutMonitorHandler {
 
 public:
 
-  AliFemtoEventCut();                // default constructor. - Users should write their own
+  AliFemtoEventCut(){/* no-op */};                // default constructor. - Users should write their own
   AliFemtoEventCut(const AliFemtoEventCut& c); // copy constructor
   virtual ~AliFemtoEventCut(){/* no-op */};       // destructor
-  AliFemtoEventCut& operator=(const AliFemtoEventCut& aCut);
-
+  
   virtual bool Pass(const AliFemtoEvent* event) =0;  // true if passes, false if not
 
   virtual AliFemtoString Report() =0;    // user-written method to return string describing cuts
@@ -39,8 +38,6 @@ class AliFemtoEventCut : public AliFemtoCutMonitorHandler {
 #endif
 };
 
-inline AliFemtoEventCut::AliFemtoEventCut(const AliFemtoEventCut& c) : AliFemtoCutMonitorHandler(), fyAnalysis(0) { }
+inline AliFemtoEventCut::AliFemtoEventCut(const AliFemtoEventCut& c) : AliFemtoCutMonitorHandler() { fyAnalysis=0;}
 inline void AliFemtoEventCut::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
-inline AliFemtoEventCut::AliFemtoEventCut(): AliFemtoCutMonitorHandler(), fyAnalysis(0){};                // default constructor. - Users should write their own
-inline AliFemtoEventCut& AliFemtoEventCut::operator=(const AliFemtoEventCut& aCut) { if (this == &aCut) return *this; fyAnalysis = aCut.fyAnalysis; return *this; }
 #endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx
index 16beb41f95b..fd37b6c9546 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx
@@ -14,41 +14,6 @@
 ClassImp(AliFemtoEventReader)
 #endif
 
-AliFemtoEventReader::AliFemtoEventReader(const AliFemtoEventReader& aReader):
-  fEventCut(0),  
-  fTrackCut(0),    
-  fV0Cut(0),       
-  fXiCut(0),       
-  fKinkCut(0),    
-  fReaderStatus(0),  
-  fDebug(0)
-{
-  fEventCut = aReader.fEventCut;
-  fTrackCut = aReader.fTrackCut;
-  fV0Cut    = aReader.fV0Cut;
-  fXiCut    = aReader.fXiCut;
-  fKinkCut  = aReader.fKinkCut;
-  fReaderStatus = aReader.fReaderStatus;
-  fDebug = aReader.fDebug;
-}
-
-AliFemtoEventReader& AliFemtoEventReader::operator=(const AliFemtoEventReader& aReader)
-{
-  if (this == &aReader) 
-    return *this;
-
-  fEventCut = aReader.fEventCut;
-  fTrackCut = aReader.fTrackCut;
-  fV0Cut    = aReader.fV0Cut;
-  fXiCut    = aReader.fXiCut;
-  fKinkCut  = aReader.fKinkCut;
-  fReaderStatus = aReader.fReaderStatus;
-  fDebug = aReader.fDebug;
-
-  return *this;
-}
-
-
 AliFemtoString AliFemtoEventReader::Report(){
   // Create a simple report from the workings of the reader
   AliFemtoString temp = "\n This is the base class AliFemtoEventReader reporting";
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.h
index 414ca95a608..3fa1d16568b 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.h
@@ -19,16 +19,13 @@ using namespace std;
 #include "Infrastructure/AliFemtoString.h"
 
 class AliFemtoEventReader {
-  
- public:
+
+public:
   // even tho it's only a base class and never constructed, if you don't have an implementation,
   // you get "AliFemtoEventReader type_info node" upon dynamical loading
-  AliFemtoEventReader() : fEventCut(0), fTrackCut(0), fV0Cut(0), fXiCut(0), fKinkCut(0), fReaderStatus(0), fDebug(1) { /* no-op */ };
-  AliFemtoEventReader(const AliFemtoEventReader& aReader);
+  AliFemtoEventReader() : fEventCut(0), fTrackCut(0), fV0Cut(0), fXiCut(0), fKinkCut(0), fDebug(1) { /* no-op */ }
   virtual ~AliFemtoEventReader(){/* no-op */}
   
-  AliFemtoEventReader& operator=(const AliFemtoEventReader& aReader);
-  
   virtual AliFemtoEvent* ReturnHbtEvent() =0;
 
   virtual AliFemtoString Report();    // user-written method to return string describing reader
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoPairCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoPairCut.h
index 1fbc30ee788..25ba8ba8461 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoPairCut.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoPairCut.h
@@ -21,10 +21,9 @@ class AliFemtoPairCut : public AliFemtoCutMonitorHandler {
 
 public:
 
-  AliFemtoPairCut();   // default constructor. - Users should write their own
+  AliFemtoPairCut(){/* no-op */};   // default constructor. - Users should write their own
   AliFemtoPairCut(const AliFemtoPairCut& c); // copy constructor
   virtual ~AliFemtoPairCut(){/* no-op */};  // destructor
-  AliFemtoPairCut& operator=(const AliFemtoPairCut &aCut);
 
   virtual bool Pass(const AliFemtoPair* pair) =0;  // true if passes, false if not
 
@@ -46,9 +45,6 @@ class AliFemtoPairCut : public AliFemtoCutMonitorHandler {
 };
 
 
-inline AliFemtoPairCut::AliFemtoPairCut(const AliFemtoPairCut& c) :  AliFemtoCutMonitorHandler(), fyAnalysis(0) {  }
+inline AliFemtoPairCut::AliFemtoPairCut(const AliFemtoPairCut& c) : AliFemtoCutMonitorHandler() { fyAnalysis = 0; }
 inline void AliFemtoPairCut::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
-inline AliFemtoPairCut::AliFemtoPairCut(): AliFemtoCutMonitorHandler(), fyAnalysis(0) {};   // default constructor. - Users should write their own
-inline AliFemtoPairCut& AliFemtoPairCut::operator=(const AliFemtoPairCut &aCut) { if (this == &aCut) return *this; fyAnalysis = aCut.fyAnalysis; return *this; }
-
 #endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoParticleCut.h b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoParticleCut.h
index 51733e8b85a..f1a0f23dd53 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoParticleCut.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Base/AliFemtoParticleCut.h
@@ -16,10 +16,9 @@ class AliFemtoParticleCut : public AliFemtoCutMonitorHandler {
   friend class AliFemtoBaseAnalysis;
 
 public:
-  AliFemtoParticleCut();   // default constructor. - Users should write their own
+  AliFemtoParticleCut(){/* no-op */};   // default constructor. - Users should write their own
   AliFemtoParticleCut(const AliFemtoParticleCut&); // copy constructor
   virtual ~AliFemtoParticleCut(){/* no-op */};  // destructor
-  AliFemtoParticleCut& operator=(const AliFemtoParticleCut& aCut);
 
   virtual AliFemtoString Report() =0;    // user-written method to return string describing cuts
 
@@ -37,21 +36,19 @@ class AliFemtoParticleCut : public AliFemtoCutMonitorHandler {
   void SetAnalysis(AliFemtoBaseAnalysis*);
 
 protected:
-  AliFemtoBaseAnalysis* fyAnalysis; // Link to the base analysis class
   double fMass;
+  AliFemtoBaseAnalysis* fyAnalysis; // Link to the base analysis class
 
 #ifdef __ROOT__
   ClassDef(AliFemtoParticleCut, 0)
 #endif
 };
 
-inline AliFemtoParticleCut::AliFemtoParticleCut(): AliFemtoCutMonitorHandler(), fyAnalysis(0), fMass(0){};   // default constructor. - Users should write their own
-inline AliFemtoParticleCut::AliFemtoParticleCut(const AliFemtoParticleCut& c): AliFemtoCutMonitorHandler(), fyAnalysis(0), fMass(0) { 
+inline AliFemtoParticleCut::AliFemtoParticleCut(const AliFemtoParticleCut& c) : AliFemtoCutMonitorHandler() { 
   fMass = c.fMass; fyAnalysis = 0; 
 #ifdef STHBTDEBUG
   cout << " AliFemtoParticleCut::AliFemtoParticleCut(const AliFemtoParticleCut& c) - fMass: " << fMass << endl;
 #endif
 }
 inline void AliFemtoParticleCut::SetAnalysis(AliFemtoBaseAnalysis* analysis) { fyAnalysis = analysis; }
-inline AliFemtoParticleCut& AliFemtoParticleCut::operator=(const AliFemtoParticleCut& aCut) { if (this == &aCut) return *this; fyAnalysis = aCut.fyAnalysis; fMass=aCut.fMass; return *this; }
 #endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.cxx b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.cxx
index 9d1f85dcd22..30a31226895 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.cxx
@@ -11,9 +11,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -50,30 +47,7 @@ ClassImp(AliFemtoBPLCMS3DCorrFctn)
 #endif
 
 //____________________________
-AliFemtoBPLCMS3DCorrFctn::AliFemtoBPLCMS3DCorrFctn(char* title, const int& nbins, const float& QLo, const float& QHi)
-  :
-  fIDNumHisto(0),
-  fIDDenHisto(0),
-  fIDRatHisto(0),
-  fSMNumHisto(0),
-  fSMDenHisto(0),
-  fSMRatHisto(0),
-  fCorrectionHisto(0),
-  fCorrCFHisto(0),
-  fNumerator(0),
-  fDenominator(0),
-  fRatio(0),
-  fQinvHisto(0),
-  fLambda(0),
-  fRout2(0),
-  fRside2(0),
-  fRlong2(0),
-  fPairCut(0), 
-  fQinvNormLo(0),
-  fQinvNormHi(0),
-  fNumRealsNorm(0),
-  fNumMixedNorm(0)
-{
+AliFemtoBPLCMS3DCorrFctn::AliFemtoBPLCMS3DCorrFctn(char* title, const int& nbins, const float& QLo, const float& QHi){
 
   // set some stuff...
   fQinvNormLo = 0.15;
@@ -165,51 +139,6 @@ AliFemtoBPLCMS3DCorrFctn::AliFemtoBPLCMS3DCorrFctn(char* title, const int& nbins
 
 }
 
-AliFemtoBPLCMS3DCorrFctn::AliFemtoBPLCMS3DCorrFctn(const AliFemtoBPLCMS3DCorrFctn& aCorrFctn) :
-  fIDNumHisto(0),
-  fIDDenHisto(0),
-  fIDRatHisto(0),
-  fSMNumHisto(0),
-  fSMDenHisto(0),
-  fSMRatHisto(0),
-  fCorrectionHisto(0),
-  fCorrCFHisto(0),
-  fNumerator(0),
-  fDenominator(0),
-  fRatio(0),
-  fQinvHisto(0),
-  fLambda(0),
-  fRout2(0),
-  fRside2(0),
-  fRlong2(0),
-  fPairCut(0), 
-  fQinvNormLo(0),
-  fQinvNormHi(0),
-  fNumRealsNorm(0),
-  fNumMixedNorm(0)
-{
-  fIDNumHisto = aCorrFctn.fIDNumHisto;
-  fIDDenHisto = aCorrFctn.fIDDenHisto;
-  fIDRatHisto = aCorrFctn.fIDRatHisto;
-  fSMNumHisto = aCorrFctn.fSMNumHisto;
-  fSMDenHisto = aCorrFctn.fSMDenHisto;
-  fSMRatHisto = aCorrFctn.fSMRatHisto;
-  fCorrectionHisto = aCorrFctn.fCorrectionHisto;
-  fCorrCFHisto = aCorrFctn.fCorrCFHisto;
-  fNumerator = aCorrFctn.fNumerator;
-  fDenominator = aCorrFctn.fDenominator;
-  fRatio = aCorrFctn.fRatio;
-  fQinvHisto = aCorrFctn.fQinvHisto;
-  fLambda = aCorrFctn.fLambda;
-  fRout2 = aCorrFctn.fRout2;
-  fRside2 = aCorrFctn.fRside2;
-  fRlong2 = aCorrFctn.fRlong2;
-  fPairCut = aCorrFctn.fPairCut; 
-  fQinvNormLo = aCorrFctn.fQinvNormLo;
-  fQinvNormHi = aCorrFctn.fQinvNormHi;
-  fNumRealsNorm = aCorrFctn.fNumRealsNorm;
-  fNumMixedNorm = aCorrFctn.fNumMixedNorm;
-}
 //____________________________
 AliFemtoBPLCMS3DCorrFctn::~AliFemtoBPLCMS3DCorrFctn(){
   delete fNumerator;
@@ -225,49 +154,6 @@ AliFemtoBPLCMS3DCorrFctn::~AliFemtoBPLCMS3DCorrFctn(){
   delete fCorrectionHisto;
   delete fCorrCFHisto;
 }
-//_________________________
-AliFemtoBPLCMS3DCorrFctn& AliFemtoBPLCMS3DCorrFctn::operator=(const AliFemtoBPLCMS3DCorrFctn& aCorrFctn)
-{
-  if (this == &aCorrFctn)
-    return *this;
-  if (fIDNumHisto) delete fIDNumHisto;
-  fIDNumHisto = new TH3D(*aCorrFctn.fIDNumHisto);
-  if (fIDDenHisto) delete fIDDenHisto;
-  fIDDenHisto = new TH3D(*aCorrFctn.fIDDenHisto);
-  if (fIDRatHisto) delete fIDRatHisto;
-  fIDRatHisto = new TH3D(*aCorrFctn.fIDRatHisto);
-  if (fSMNumHisto) delete fSMNumHisto;
-  fSMNumHisto = new TH3D(*aCorrFctn.fSMNumHisto);
-  if (fSMDenHisto) delete fSMDenHisto;
-  fSMDenHisto = new TH3D(*aCorrFctn.fSMDenHisto);
-  if (fSMRatHisto) delete fSMRatHisto;
-  fSMRatHisto = new TH3D(*aCorrFctn.fSMRatHisto);
-
-  if (fCorrectionHisto) delete fCorrectionHisto;
-  fCorrectionHisto = new TH3D(*aCorrFctn.fCorrectionHisto);
-  if (fCorrCFHisto) delete fCorrCFHisto;
-  fCorrCFHisto = new TH3D(*aCorrFctn.fCorrCFHisto);
-  if (fNumerator) delete fNumerator;
-  fNumerator = new TH3D(*aCorrFctn.fNumerator);
-  if (fDenominator) delete fDenominator;
-  fDenominator = new TH3D(*aCorrFctn.fDenominator);
-  if (fRatio) delete fRatio;
-  fRatio = new TH3D(*aCorrFctn.fRatio);
-  if (fQinvHisto) delete fQinvHisto;
-  fQinvHisto = new TH3D(*aCorrFctn.fQinvHisto);
-
-  fLambda = aCorrFctn.fLambda;
-  fRout2 = aCorrFctn.fRout2;
-  fRside2 = aCorrFctn.fRside2;
-  fRlong2 = aCorrFctn.fRlong2;
-  fPairCut = aCorrFctn.fPairCut; 
-  fQinvNormLo = aCorrFctn.fQinvNormLo;
-  fQinvNormHi = aCorrFctn.fQinvNormHi;
-  fNumRealsNorm = aCorrFctn.fNumRealsNorm;
-  fNumMixedNorm = aCorrFctn.fNumMixedNorm;
-  
-  return *this;
-}
 
 //_________________________
 void AliFemtoBPLCMS3DCorrFctn::WriteOutHistos(){
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.h
index 1e274332632..c37919fec2b 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoBPLCMS3DCorrFctn.h
@@ -11,9 +11,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -49,11 +46,8 @@
 class AliFemtoBPLCMS3DCorrFctn : public AliFemtoCorrFctn {
 public:
   AliFemtoBPLCMS3DCorrFctn(char* title, const int& nbins, const float& QLo, const float& QHi);
-  AliFemtoBPLCMS3DCorrFctn(const AliFemtoBPLCMS3DCorrFctn& aCorrFctn);
   virtual ~AliFemtoBPLCMS3DCorrFctn();
 
-  AliFemtoBPLCMS3DCorrFctn& operator=(const AliFemtoBPLCMS3DCorrFctn& aCorrFctn);
-
   virtual AliFemtoString Report();
   virtual void AddRealPair(const AliFemtoPair*);
   virtual void AddMixedPair(const AliFemtoPair*);
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.cxx b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.cxx
index 7ddc088af41..6b5eaea035a 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.cxx
@@ -11,9 +11,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -49,11 +46,7 @@ ClassImp(AliFemtoQinvCorrFctn)
 #endif
 
 //____________________________
-AliFemtoQinvCorrFctn::AliFemtoQinvCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi):
-  fNumerator(0),
-  fDenominator(0),
-  fRatio(0)
-{
+AliFemtoQinvCorrFctn::AliFemtoQinvCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi){
   // set up numerator
   //  title = "Num Qinv (MeV/c)";
   char TitNum[100] = "Num";
@@ -82,38 +75,12 @@ AliFemtoQinvCorrFctn::AliFemtoQinvCorrFctn(char* title, const int& nbins, const
 
 }
 
-//____________________________
-AliFemtoQinvCorrFctn::AliFemtoQinvCorrFctn(const AliFemtoQinvCorrFctn& aCorrFctn) :
-  fNumerator(0),
-  fDenominator(0),
-  fRatio(0)
-{
-  fNumerator = new TH1D(*aCorrFctn.fNumerator);
-  fDenominator = new TH1D(*aCorrFctn.fDenominator);
-  fRatio = new TH1D(*aCorrFctn.fRatio);
-}
 //____________________________
 AliFemtoQinvCorrFctn::~AliFemtoQinvCorrFctn(){
   delete fNumerator;
   delete fDenominator;
   delete fRatio;
 }
-//_________________________
-AliFemtoQinvCorrFctn& AliFemtoQinvCorrFctn::operator=(const AliFemtoQinvCorrFctn& aCorrFctn)
-{
-  if (this == &aCorrFctn)
-    return *this;
-
-  if (fNumerator) delete fNumerator;
-  fNumerator = new TH1D(*aCorrFctn.fNumerator);
-  if (fDenominator) delete fDenominator;
-  fDenominator = new TH1D(*aCorrFctn.fDenominator);
-  if (fRatio) delete fRatio;
-  fRatio = new TH1D(*aCorrFctn.fRatio);
-
-  return *this;
-}
-
 //_________________________
 void AliFemtoQinvCorrFctn::Finish(){
   // here is where we should normalize, fit, etc...
diff --git a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.h
index 1d1ca57ee2b..34dd0da8f28 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/CorrFctn/AliFemtoQinvCorrFctn.h
@@ -11,9 +11,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -46,11 +43,8 @@
 class AliFemtoQinvCorrFctn : public AliFemtoCorrFctn {
 public:
   AliFemtoQinvCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi);
-  AliFemtoQinvCorrFctn(const AliFemtoQinvCorrFctn& aCorrFctn);
   virtual ~AliFemtoQinvCorrFctn();
 
-  AliFemtoQinvCorrFctn& operator=(const AliFemtoQinvCorrFctn& aCorrFctn);
-
   virtual AliFemtoString Report();
   virtual void AddRealPair(const AliFemtoPair*);
   virtual void AddMixedPair(const AliFemtoPair*);
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.cxx b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.cxx
index bb13bb40968..0e22b4ef8b4 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.cxx
@@ -12,9 +12,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -72,10 +69,8 @@
 ClassImp(AliFemtoBasicEventCut)
 #endif
 
-AliFemtoBasicEventCut::AliFemtoBasicEventCut() :
-  fNEventsPassed(0), fNEventsFailed(0)
-{
-  /* no-op */
+AliFemtoBasicEventCut::AliFemtoBasicEventCut(){
+  fNEventsPassed =  fNEventsFailed = 0;
 } 
 //------------------------------
 //AliFemtoBasicEventCut::~AliFemtoBasicEventCut(){
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.h b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.h
index 904bb16b803..3fb25ab29c7 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicEventCut.h
@@ -12,9 +12,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -105,11 +102,13 @@ inline void AliFemtoBasicEventCut::SetVertZPos(const float& lo, const float& hi)
 inline int  AliFemtoBasicEventCut::NEventsPassed() {return fNEventsPassed;}
 inline int  AliFemtoBasicEventCut::NEventsFailed() {return fNEventsFailed;}
 inline AliFemtoBasicEventCut* AliFemtoBasicEventCut::Clone() { AliFemtoBasicEventCut* c = new AliFemtoBasicEventCut(*this); return c;}
-inline AliFemtoBasicEventCut::AliFemtoBasicEventCut(AliFemtoBasicEventCut& c) : AliFemtoEventCut(c), fNEventsPassed(0), fNEventsFailed(0) {
+inline AliFemtoBasicEventCut::AliFemtoBasicEventCut(AliFemtoBasicEventCut& c) : AliFemtoEventCut(c) {
   fEventMult[0] = c.fEventMult[0];
   fEventMult[1] = c.fEventMult[1];
   fVertZPos[0] = c.fVertZPos[0];
   fVertZPos[1] = c.fVertZPos[1];
+  fNEventsPassed = 0;
+  fNEventsFailed = 0;
 }
 
 
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.cxx b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.cxx
index b50a58b0dba..c342cd8675b 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoBasicTrackCut.cxx
@@ -20,11 +20,7 @@
 ClassImp(AliFemtoBasicTrackCut)
 #endif
 
-AliFemtoBasicTrackCut::AliFemtoBasicTrackCut():
-  fCharge(0),
-  fNTracksPassed(0),
-  fNTracksFailed(0)
-{
+AliFemtoBasicTrackCut::AliFemtoBasicTrackCut(){
   fNTracksPassed = fNTracksFailed = 0;
   fCharge = 1;  // takes both charges 0
   fNSigmaPion[0] = -100.0;   fNSigmaPion[1] = 100.0;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.cxx b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.cxx
index db760c3bea8..84a05e04371 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.cxx
@@ -11,9 +11,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007-03-07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -46,11 +43,8 @@ ClassImp(AliFemtoDummyPairCut)
 #endif
 
 //__________________
-AliFemtoDummyPairCut::AliFemtoDummyPairCut() :
-  fNPairsPassed(0),
-  fNPairsFailed(0)
-{
-  /* no-op */
+AliFemtoDummyPairCut::AliFemtoDummyPairCut(){
+  fNPairsPassed = fNPairsFailed = 0;
 }
 //__________________
 //AliFemtoDummyPairCut::~AliFemtoDummyPairCut(){
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.h b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.h
index 81ded7edfc0..bf468477b0f 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Cut/AliFemtoDummyPairCut.h
@@ -11,9 +11,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -88,7 +85,11 @@ class AliFemtoDummyPairCut : public AliFemtoPairCut{
 #endif
 };
 
-inline AliFemtoDummyPairCut::AliFemtoDummyPairCut(const AliFemtoDummyPairCut& c) : AliFemtoPairCut(c), fNPairsPassed(0), fNPairsFailed(0) { /* no-op */ }
+inline AliFemtoDummyPairCut::AliFemtoDummyPairCut(const AliFemtoDummyPairCut& c) : AliFemtoPairCut(c) {
+  fNPairsPassed = 0;
+  fNPairsFailed = 0;
+
+}
 inline AliFemtoDummyPairCut* AliFemtoDummyPairCut::Clone() { AliFemtoDummyPairCut* c = new AliFemtoDummyPairCut(*this); return c;}
 
 #endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.cxx
index 4758180b918..7ec3e9340c5 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.cxx
@@ -14,9 +14,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.3  2007/04/27 07:24:34  akisiel
- * Make revisions needed for compilation from the main AliRoot tree
- *
  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
  * Importing the HBT code dir
  *
@@ -59,35 +56,18 @@
 ClassImp(AliFemtoCoulomb)
 #endif
 
-AliFemtoCoulomb::AliFemtoCoulomb() :
-  fFile(""),
-  fRadius(-1.0),
-  fZ1Z2(1.0),
-  fNLines(0)
-{
+AliFemtoCoulomb::AliFemtoCoulomb() {
   fFile = "/afs/rhic/star/hbt/coul/AliFemtoCorrectionFiles/correctionpp.dat";
   if (!fFile) {
     cout << " No file, dummy!" << endl;
     assert(0);
   }
+  fRadius = -1.0;
+  fZ1Z2 = 1.0; // Default has been set up to be same sign charges
   cout << "You have 1 default Coulomb correction!" << endl;
 }
 
-AliFemtoCoulomb::AliFemtoCoulomb(const AliFemtoCoulomb& aCoul) :
-  fFile(aCoul.fFile),
-  fRadius(aCoul.fRadius),
-  fZ1Z2(aCoul.fZ1Z2),
-  fNLines(0)
-{
-  CreateLookupTable(fRadius);
-}
-
-AliFemtoCoulomb::AliFemtoCoulomb(const char* readFile, const double& radius, const double& charge) :
-  fFile(readFile),
-  fRadius(radius),
-  fZ1Z2(0),
-  fNLines(0)
-{
+AliFemtoCoulomb::AliFemtoCoulomb(const char* readFile, const double& radius, const double& charge) {
   fFile = readFile;
   fRadius = radius;
   CreateLookupTable(fRadius);
@@ -99,21 +79,6 @@ AliFemtoCoulomb::~AliFemtoCoulomb() {
 
 }
 
-AliFemtoCoulomb& AliFemtoCoulomb::operator=(const AliFemtoCoulomb& aCoul)
-{
-  if (this == &aCoul)
-    return *this;
-
-  fFile = aCoul.fFile;
-  fRadius = aCoul.fRadius;
-  fZ1Z2 = aCoul.fZ1Z2;
-
-  CreateLookupTable(fRadius);
-  
-  return *this;
-}
-
-
 void AliFemtoCoulomb::SetRadius(const double& radius) {
   cout << " AliFemtoCoulomb::setRadius() " << endl;
   fRadius = radius;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.h
index aa1a3b29d09..f23e48640d3 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCoulomb.h
@@ -14,9 +14,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -55,11 +52,8 @@ class AliFemtoCoulomb {
 public:
   AliFemtoCoulomb();
   AliFemtoCoulomb(const char *readFile, const double& radius, const double& charge);
-  AliFemtoCoulomb(const AliFemtoCoulomb& aCoul);
   virtual ~AliFemtoCoulomb();
 
-  AliFemtoCoulomb& operator=(const AliFemtoCoulomb& aCoul);
-
   void SetRadius(const double& radius);
   double GetRadius();
   void SetFile(const char *readFile);
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.cxx
index e819703b7de..4fb5fb1b7bb 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.cxx
@@ -6,61 +6,17 @@
 ClassImp(AliFemtoCutMonitorHandler)
 #endif
 // ---------------------------------------------------------------------------
-AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler():
-  fCollectionsEmpty(0), fPassColl(0), fFailColl(0)
- {
+AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler() {
   cout << " *** AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler() " << endl;
   fCollectionsEmpty = 0;
   fPassColl = new AliFemtoCutMonitorCollection();
   fFailColl = new AliFemtoCutMonitorCollection();
 }
-// ---------------------------------------------------------------------------
-AliFemtoCutMonitorHandler::AliFemtoCutMonitorHandler(const AliFemtoCutMonitorHandler& aHan):
-  fCollectionsEmpty(0), fPassColl(0), fFailColl(0)
-{
-  fCollectionsEmpty = aHan.fCollectionsEmpty;
-  fPassColl = new AliFemtoCutMonitorCollection();
-  AliFemtoCutMonitorIterator iter;
-  for (iter=aHan.fPassColl->begin(); iter!=aHan.fPassColl->end(); iter++){
-    fPassColl->push_back(*iter);
-  }
-  fFailColl = new AliFemtoCutMonitorCollection();
-  for (iter=aHan.fFailColl->begin(); iter!=aHan.fFailColl->end(); iter++){
-    fFailColl->push_back(*iter);
-  }
-}
-
 // ---------------------------------------------------------------------------
 AliFemtoCutMonitorHandler::~AliFemtoCutMonitorHandler() { 
   delete fPassColl;
   delete fFailColl;
 }   
-//__________________________
-AliFemtoCutMonitorHandler& AliFemtoCutMonitorHandler::operator=(const AliFemtoCutMonitorHandler& aHan)
-{
-  if (this == &aHan)
-    return *this;
-
-  AliFemtoCutMonitorIterator iter;
-  if (fPassColl) {
-    fPassColl->clear();
-    delete fPassColl;
-  }
-  if (fFailColl) {
-    fFailColl->clear();
-    delete fFailColl;
-  }
-  fPassColl = new AliFemtoCutMonitorCollection();
-  for (iter=aHan.fPassColl->begin(); iter!=aHan.fPassColl->end(); iter++){
-    fPassColl->push_back(*iter);
-  }
-  fFailColl = new AliFemtoCutMonitorCollection();
-  for (iter=aHan.fFailColl->begin(); iter!=aHan.fFailColl->end(); iter++){
-    fFailColl->push_back(*iter);
-  }
-  return *this;
-}
-
 // ---------------------------------------------------------------------------
 void AliFemtoCutMonitorHandler::FillCutMonitor(const AliFemtoEvent* event, bool pass) { 
   if (fCollectionsEmpty) return;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.h
index 5057d5eb432..f48a2bfb8be 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoCutMonitorHandler.h
@@ -17,10 +17,8 @@ class AliFemtoCutMonitorHandler{
  public:
   
   AliFemtoCutMonitorHandler();
-  AliFemtoCutMonitorHandler(const AliFemtoCutMonitorHandler& aHan);
   virtual ~AliFemtoCutMonitorHandler();
-  AliFemtoCutMonitorHandler& operator=(const AliFemtoCutMonitorHandler& aHan);
-
+  
   AliFemtoCutMonitorCollection* PassMonitorColl(); 
   AliFemtoCutMonitorCollection* FailMonitorColl(); 
   AliFemtoCutMonitor* PassMonitor(int n); 
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx
index 7e549239324..5471c731600 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx
@@ -13,9 +13,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.3  2007/04/27 07:24:34  akisiel
- * Make revisions needed for compilation from the main AliRoot tree
- *
  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
  * Importing the HBT code dir
  *
@@ -141,25 +138,7 @@
 
 
 //___________________
-AliFemtoEvent::AliFemtoEvent():
-  fEventNumber(0),
-  fRunNumber(0),
-  fNumberOfTracks(0),
-  fMagneticField(0),
-  fPrimVertPos(0,0,0),
-  fTrackCollection(0),
-  fV0Collection(0),
-  fXiCollection(0),
-  fKinkCollection(0),
-  fZDCN1Energy(0),   
-  fZDCP1Energy(0),   
-  fZDCN2Energy(0),   
-  fZDCP2Energy(0),   
-  fZDCEMEnergy(0),   
-  fZDCParticipants(0),
-  fTriggerMask(0),  
-  fTriggerCluster(0)
-{
+AliFemtoEvent::AliFemtoEvent(){
   fPrimVertPos[0]=-999.0;
   fPrimVertPos[1]=-999.0;
   fPrimVertPos[2]=-999.0;
@@ -170,25 +149,7 @@ AliFemtoEvent::AliFemtoEvent():
   fMagneticField=0.0;
 }
 //___________________
-AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoXiCut* xCut, AliFemtoKinkCut* kCut):
-  fEventNumber(0),
-  fRunNumber(0),
-  fNumberOfTracks(0),
-  fMagneticField(0),
-  fPrimVertPos(0,0,0),
-  fTrackCollection(0),
-  fV0Collection(0),
-  fXiCollection(0),
-  fKinkCollection(0),
-  fZDCN1Energy(0),   
-  fZDCP1Energy(0),   
-  fZDCN2Energy(0),   
-  fZDCP2Energy(0),   
-  fZDCEMEnergy(0),   
-  fZDCParticipants(0),
-  fTriggerMask(0),  
-  fTriggerCluster(0)
-{ // copy constructor with track and v0 cuts
+AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoXiCut* xCut, AliFemtoKinkCut* kCut){ // copy constructor with track and v0 cuts
   //cout << "AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoV0Cut* kCut)" << endl;
   fEventNumber = ev.fEventNumber;
   fRunNumber = ev.fRunNumber;
@@ -239,55 +200,6 @@ AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, Al
     }
   }
 }
-//______________________________
-AliFemtoEvent& AliFemtoEvent::operator=(const AliFemtoEvent& aEvent)
-{
-  if (this == &aEvent)
-    return *this;
-
-  fEventNumber = aEvent.fEventNumber;
-  fRunNumber = aEvent.fRunNumber;
-  
-  fZDCN1Energy=aEvent.fZDCN1Energy;     
-  fZDCP1Energy=aEvent.fZDCP1Energy;      
-  fZDCN2Energy=aEvent.fZDCN2Energy;      
-  fZDCP2Energy=aEvent.fZDCP2Energy;      
-  fZDCEMEnergy=aEvent.fZDCEMEnergy;
-  fZDCParticipants=aEvent.fZDCParticipants;
-  fNumberOfTracks = aEvent.fNumberOfTracks;
-  fMagneticField= aEvent.fMagneticField;
-  
-  fTriggerMask=aEvent.fTriggerMask;     // Trigger Type (mask)
-  fTriggerCluster=aEvent.fTriggerCluster;
-  // create collections
-  fTrackCollection = new AliFemtoTrackCollection;
-  fV0Collection = new AliFemtoV0Collection;
-  fXiCollection = new AliFemtoXiCollection;
-  fKinkCollection = new AliFemtoKinkCollection;
-  // copy track collection  
-  for ( AliFemtoTrackIterator tIter=aEvent.fTrackCollection->begin(); tIter!=aEvent.fTrackCollection->end(); tIter++) {
-    AliFemtoTrack* trackCopy = new AliFemtoTrack(**tIter);
-    fTrackCollection->push_back(trackCopy);
-  }
-  // copy v0 collection
-  for ( AliFemtoV0Iterator vIter=aEvent.fV0Collection->begin(); vIter!=aEvent.fV0Collection->end(); vIter++) {
-    AliFemtoV0* v0Copy = new AliFemtoV0(**vIter);
-    fV0Collection->push_back(v0Copy);
-  }
-  // copy xi collection
-  for ( AliFemtoXiIterator xIter=aEvent.fXiCollection->begin(); xIter!=aEvent.fXiCollection->end(); xIter++) {
-    AliFemtoXi* xiCopy = new AliFemtoXi(**xIter);
-    fXiCollection->push_back(xiCopy);
-  }
-  // copy kink collection  
-  for ( AliFemtoKinkIterator kIter=aEvent.fKinkCollection->begin(); kIter!=aEvent.fKinkCollection->end(); kIter++) {
-    AliFemtoKink* kinkCopy = new AliFemtoKink(**kIter);
-    fKinkCollection->push_back(kinkCopy);
-  }
-
-  return *this;
-}
-
 //___________________
 AliFemtoEvent::~AliFemtoEvent(){
 #ifdef STHBTDEBUG
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.h
index 47aa5e65fcc..26b75abd260 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.h
@@ -15,9 +15,6 @@
  *
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -130,7 +127,6 @@ class AliFemtoEvent{
 #endif
   AliFemtoEvent(const AliFemtoEvent&, AliFemtoTrackCut* =0, AliFemtoV0Cut* =0,  AliFemtoXiCut* =0, AliFemtoKinkCut* =0); // copy constructor with track and v0 cuts
   ~AliFemtoEvent();
-  AliFemtoEvent& operator=(const AliFemtoEvent& aEvent);
 
   unsigned short EventNumber() const;
   int RunNumber() const;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.cxx
index 1d62c03070e..02290b77e74 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.cxx
@@ -12,9 +12,6 @@
  ***********************************************************************
  *
  * $Log$
- * Revision 1.3  2007/04/27 07:24:34  akisiel
- * Make revisions needed for compilation from the main AliRoot tree
- *
  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
  * Importing the HBT code dir
  *
@@ -52,25 +49,7 @@
 #include "Infrastructure/phys_constants.h"
 #include "Infrastructure/AliFemtoTrack.h"
 // -----------------------------------------------------------------------
-AliFemtoKink::AliFemtoKink():
-  fDcaParentDaughter(0), fDcaDaughterPrimaryVertex(0), 
-  fDcaParentPrimaryVertex(0), fHitDistanceParentDaughter(0),  
-  fHitDistanceParentVertex(0),
-  fDecayAngle(0), fDecayAngleCM(0),             
-  fDaughter(),            
-  mParent(),               
-  mPosition(0,0,0)        
-{/* no-op */}
-// -----------------------------------------------------------------------
-AliFemtoKink::AliFemtoKink(const AliFemtoKink& k):
-  fDcaParentDaughter(0), fDcaDaughterPrimaryVertex(0), 
-  fDcaParentPrimaryVertex(0), fHitDistanceParentDaughter(0),  
-  fHitDistanceParentVertex(0),
-  fDecayAngle(0), fDecayAngleCM(0),             
-  fDaughter(),            
-  mParent(),               
-  mPosition(0,0,0)        
-{ // copy constructor
+AliFemtoKink::AliFemtoKink(const AliFemtoKink& k){ // copy constructor
 
   fDcaParentDaughter          =   k.fDcaParentDaughter;           
   fDcaDaughterPrimaryVertex   =   k.fDcaDaughterPrimaryVertex;    
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.h
index 244742ca4e0..8d7f67c272f 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoKink.h
@@ -12,9 +12,6 @@
  ***********************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -55,7 +52,7 @@ class StKinkVertex;
 
 class AliFemtoKink {
 public:
-  AliFemtoKink();
+  AliFemtoKink(){/* no-op */}
   AliFemtoKink( const AliFemtoKink&); // copy constructor
 #ifndef __NO_STAR_DEPENDENCE_ALLOWED__
 #ifdef __ROOT__
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.cxx
index e7ec1ecc9cc..edaaf0cd91f 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.cxx
@@ -13,9 +13,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -137,34 +134,11 @@ ClassImp(AliFemtoManager)
 
 
 //____________________________
-AliFemtoManager::AliFemtoManager():
-  fAnalysisCollection(0),
-  fEventReader(0),
-  fEventWriterCollection(0)
-{
+AliFemtoManager::AliFemtoManager(){
   fAnalysisCollection = new AliFemtoAnalysisCollection;
   fEventWriterCollection = new AliFemtoEventWriterCollection;
   fEventReader = 0;
 }
-//____________________________
-AliFemtoManager::AliFemtoManager(const AliFemtoManager& aManager) :
-  fAnalysisCollection(0),
-  fEventReader(0),
-  fEventWriterCollection(0)
-{
-  fEventReader = aManager.fEventReader;
-  AliFemtoAnalysisIterator AnalysisIter;
-  fAnalysisCollection = new AliFemtoAnalysisCollection;
-  for (AnalysisIter=aManager.fAnalysisCollection->begin();AnalysisIter!=aManager.fAnalysisCollection->end();AnalysisIter++){
-    fAnalysisCollection->push_back(*AnalysisIter);
-  }
-  AliFemtoEventWriterIterator EventWriterIter;
-  fEventWriterCollection = new AliFemtoEventWriterCollection;
-  for (EventWriterIter=aManager.fEventWriterCollection->begin();EventWriterIter!=aManager.fEventWriterCollection->end();EventWriterIter++){
-    fEventWriterCollection->push_back(*EventWriterIter);
-  }
-}
-
 //____________________________
 AliFemtoManager::~AliFemtoManager(){
   delete fEventReader;
@@ -183,43 +157,6 @@ AliFemtoManager::~AliFemtoManager(){
   }
   delete fEventWriterCollection;
 }
-//____________________________
-AliFemtoManager& AliFemtoManager::operator=(const AliFemtoManager& aManager)
-{
-  if (this == &aManager)
-    return *this;
-
-  fEventReader = aManager.fEventReader;
-  AliFemtoAnalysisIterator AnalysisIter;
-  if (fAnalysisCollection) {
-    for (AnalysisIter=fAnalysisCollection->begin();AnalysisIter!=fAnalysisCollection->end();AnalysisIter++){
-      delete *AnalysisIter;
-      *AnalysisIter = 0;
-    }
-    delete fAnalysisCollection;
-  }
-  // now delete each EventWriter in the Collection, and then the Collection itself
-  AliFemtoEventWriterIterator EventWriterIter;
-  if (fEventWriterCollection) {
-    for (EventWriterIter=fEventWriterCollection->begin();EventWriterIter!=fEventWriterCollection->end();EventWriterIter++){
-      delete *EventWriterIter;
-      *EventWriterIter = 0;
-    }
-    delete fEventWriterCollection;
-  }
-
-  fAnalysisCollection = new AliFemtoAnalysisCollection;
-  for (AnalysisIter=aManager.fAnalysisCollection->begin();AnalysisIter!=aManager.fAnalysisCollection->end();AnalysisIter++){
-    fAnalysisCollection->push_back(*AnalysisIter);
-  }
-
-  fEventWriterCollection = new AliFemtoEventWriterCollection;
-  for (EventWriterIter=aManager.fEventWriterCollection->begin();EventWriterIter!=aManager.fEventWriterCollection->end();EventWriterIter++){
-    fEventWriterCollection->push_back(*EventWriterIter);
-  }
-  return *this;
-}
-
 //____________________________
 int AliFemtoManager::Init(){
   AliFemtoString readerMessage;
@@ -278,7 +215,7 @@ AliFemtoString AliFemtoManager::Report(){
   // EventReader
   stemp = fEventReader->Report();
   // EventWriters
-  sprintf(ctemp,"\nAliFemtoManager Reporting %u EventWriters\n",(unsigned int) fEventWriterCollection->size());
+  sprintf(ctemp,"\nAliFemtoManager Reporting %u EventWriters\n",fEventWriterCollection->size());
   stemp += ctemp;
   AliFemtoEventWriterIterator EventWriterIter;
   AliFemtoEventWriter* currentEventWriter;
@@ -288,7 +225,7 @@ AliFemtoString AliFemtoManager::Report(){
     stemp+=currentEventWriter->Report();
   }
   // Analyses
-  sprintf(ctemp,"\nAliFemtoManager Reporting %u Analyses\n",(unsigned int) fAnalysisCollection->size());
+  sprintf(ctemp,"\nAliFemtoManager Reporting %u Analyses\n",fAnalysisCollection->size());
   stemp += ctemp;
   AliFemtoAnalysisIterator AnalysisIter;
   AliFemtoBaseAnalysis* currentAnalysis;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.h
index d0e22fa068a..3693e9a2df6 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoManager.h
@@ -13,9 +13,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -87,11 +84,8 @@ class AliFemtoManager{
 
 public:
   AliFemtoManager();
-  AliFemtoManager(const AliFemtoManager& aManager);
   virtual ~AliFemtoManager();
 
-  AliFemtoManager& operator=(const AliFemtoManager& aManager);
-
   // Gets and Sets...
   AliFemtoAnalysisCollection* AnalysisCollection();
   AliFemtoBaseAnalysis* Analysis(int n);  // Access to Analysis within Collection
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.cxx
index 6deb4f3cfce..837d7f6ba4a 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.cxx
@@ -19,9 +19,6 @@
  * corrected calculation of opening angle 
  **
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -118,74 +115,14 @@ double AliFemtoPair::fMaxDuOuter = 1.4;
 double AliFemtoPair::fMaxDzOuter = 3.2;
 
 
-AliFemtoPair::AliFemtoPair() :
-  fTrack1(0), fTrack2(0),
-  fNonIdParNotCalculated(0),
-  fDKSide(0),
-  fDKOut(0),
-  fDKLong(0),
-  fCVK(0),
-  kStarCalc(0),
-  fNonIdParNotCalculatedGlobal(0),
-  fMergingParNotCalculated(0),
-  fWeightedAvSep(0),
-  fFracOfMergedRow(0),
-  fClosestRowAtDCA(0),
-  fMergingParNotCalculatedTrkV0Pos(0),
-  fFracOfMergedRowTrkV0Pos(0),
-  fClosestRowAtDCATrkV0Pos(0),
-  fMergingParNotCalculatedTrkV0Neg(0),
-  fFracOfMergedRowTrkV0Neg(0),
-  fClosestRowAtDCATrkV0Neg(0),
-  fMergingParNotCalculatedV0PosV0Neg(0),
-  fFracOfMergedRowV0PosV0Neg(0),
-  fClosestRowAtDCAV0PosV0Neg(0),
-  fMergingParNotCalculatedV0NegV0Pos(0),
-  fFracOfMergedRowV0NegV0Pos(0),
-  fClosestRowAtDCAV0NegV0Pos(0),
-  fMergingParNotCalculatedV0PosV0Pos(0),
-  fFracOfMergedRowV0PosV0Pos(0),
-  fClosestRowAtDCAV0PosV0Pos(0),
-  fMergingParNotCalculatedV0NegV0Neg(0),
-  fFracOfMergedRowV0NegV0Neg(0),
-  fClosestRowAtDCAV0NegV0Neg(0)
-{
+AliFemtoPair::AliFemtoPair(){
   fTrack1 = 0;
   fTrack2 = 0;
   setDefaultHalfFieldMergingPar();
 }
 
 AliFemtoPair::AliFemtoPair(AliFemtoParticle* a, AliFemtoParticle* b)
-  : fTrack1(a), fTrack2(b),
-  fNonIdParNotCalculated(0),
-  fDKSide(0),
-  fDKOut(0),
-  fDKLong(0),
-  fCVK(0),
-  kStarCalc(0),
-  fNonIdParNotCalculatedGlobal(0),
-  fMergingParNotCalculated(0),
-  fWeightedAvSep(0),
-  fFracOfMergedRow(0),
-  fClosestRowAtDCA(0),
-  fMergingParNotCalculatedTrkV0Pos(0),
-  fFracOfMergedRowTrkV0Pos(0),
-  fClosestRowAtDCATrkV0Pos(0),
-  fMergingParNotCalculatedTrkV0Neg(0),
-  fFracOfMergedRowTrkV0Neg(0),
-  fClosestRowAtDCATrkV0Neg(0),
-  fMergingParNotCalculatedV0PosV0Neg(0),
-  fFracOfMergedRowV0PosV0Neg(0),
-  fClosestRowAtDCAV0PosV0Neg(0),
-  fMergingParNotCalculatedV0NegV0Pos(0),
-  fFracOfMergedRowV0NegV0Pos(0),
-  fClosestRowAtDCAV0NegV0Pos(0),
-  fMergingParNotCalculatedV0PosV0Pos(0),
-  fFracOfMergedRowV0PosV0Pos(0),
-  fClosestRowAtDCAV0PosV0Pos(0),
-  fMergingParNotCalculatedV0NegV0Neg(0),
-  fFracOfMergedRowV0NegV0Neg(0),
-  fClosestRowAtDCAV0NegV0Neg(0)
+  : fTrack1(a), fTrack2(b)
 { 
   setDefaultHalfFieldMergingPar();
 }
@@ -212,128 +149,9 @@ void AliFemtoPair::setMergingPar(double aMaxDuInner, double aMaxDzInner,
 
 AliFemtoPair::~AliFemtoPair() {/* no-op */}
 
-AliFemtoPair::AliFemtoPair(const AliFemtoPair &aPair):
-  fTrack1(0), fTrack2(0),
-  fNonIdParNotCalculated(0),
-  fDKSide(0),
-  fDKOut(0),
-  fDKLong(0),
-  fCVK(0),
-  kStarCalc(0),
-  fNonIdParNotCalculatedGlobal(0),
-  fMergingParNotCalculated(0),
-  fWeightedAvSep(0),
-  fFracOfMergedRow(0),
-  fClosestRowAtDCA(0),
-  fMergingParNotCalculatedTrkV0Pos(0),
-  fFracOfMergedRowTrkV0Pos(0),
-  fClosestRowAtDCATrkV0Pos(0),
-  fMergingParNotCalculatedTrkV0Neg(0),
-  fFracOfMergedRowTrkV0Neg(0),
-  fClosestRowAtDCATrkV0Neg(0),
-  fMergingParNotCalculatedV0PosV0Neg(0),
-  fFracOfMergedRowV0PosV0Neg(0),
-  fClosestRowAtDCAV0PosV0Neg(0),
-  fMergingParNotCalculatedV0NegV0Pos(0),
-  fFracOfMergedRowV0NegV0Pos(0),
-  fClosestRowAtDCAV0NegV0Pos(0),
-  fMergingParNotCalculatedV0PosV0Pos(0),
-  fFracOfMergedRowV0PosV0Pos(0),
-  fClosestRowAtDCAV0PosV0Pos(0),
-  fMergingParNotCalculatedV0NegV0Neg(0),
-  fFracOfMergedRowV0NegV0Neg(0),
-  fClosestRowAtDCAV0NegV0Neg(0)
-{
-  fTrack1 = aPair.fTrack1;
-  fTrack2 = aPair.fTrack2;
-
-  fNonIdParNotCalculated = aPair.fNonIdParNotCalculated;
-  fDKSide = aPair.fDKSide;
-  fDKOut = aPair.fDKOut;
-  fDKLong = aPair.fDKLong;
-  fCVK = aPair.fCVK;
-  kStarCalc = aPair.kStarCalc;
-
-  fNonIdParNotCalculatedGlobal = aPair.fNonIdParNotCalculatedGlobal;
-
-  fMergingParNotCalculated = aPair.fMergingParNotCalculated;
-  fWeightedAvSep = aPair.fWeightedAvSep;
-  fFracOfMergedRow = aPair.fFracOfMergedRow;
-  fClosestRowAtDCA = aPair.fClosestRowAtDCA;
-
-  fMergingParNotCalculatedTrkV0Pos = aPair.fMergingParNotCalculatedTrkV0Pos;
-  fFracOfMergedRowTrkV0Pos = aPair.fFracOfMergedRowTrkV0Pos;
-  fClosestRowAtDCATrkV0Pos = aPair.fClosestRowAtDCATrkV0Pos;
-
-  fMergingParNotCalculatedTrkV0Neg = aPair.fMergingParNotCalculatedTrkV0Neg;
-  fFracOfMergedRowTrkV0Neg = aPair.fFracOfMergedRowTrkV0Neg;
-  fClosestRowAtDCATrkV0Neg = aPair.fClosestRowAtDCATrkV0Neg;
-
-  fMergingParNotCalculatedV0PosV0Neg = aPair.fMergingParNotCalculatedV0PosV0Neg;
-  fFracOfMergedRowV0PosV0Neg = aPair.fFracOfMergedRowV0PosV0Neg;
-  fClosestRowAtDCAV0PosV0Neg = aPair.fClosestRowAtDCAV0PosV0Neg;
-
-  fMergingParNotCalculatedV0NegV0Pos = aPair.fMergingParNotCalculatedV0NegV0Pos;
-  fFracOfMergedRowV0NegV0Pos = aPair.fFracOfMergedRowV0NegV0Pos;
-  fClosestRowAtDCAV0NegV0Pos = aPair.fClosestRowAtDCAV0NegV0Pos;
-
-  fMergingParNotCalculatedV0PosV0Pos = aPair.fMergingParNotCalculatedV0PosV0Pos;
-  fFracOfMergedRowV0PosV0Pos = aPair.fFracOfMergedRowV0PosV0Pos;
-  fClosestRowAtDCAV0PosV0Pos = aPair.fClosestRowAtDCAV0PosV0Pos;
-
-  fMergingParNotCalculatedV0NegV0Neg = aPair.fMergingParNotCalculatedV0NegV0Neg;
-  fFracOfMergedRowV0NegV0Neg = aPair.fFracOfMergedRowV0NegV0Neg;
-  fClosestRowAtDCAV0NegV0Neg = aPair.fClosestRowAtDCAV0NegV0Neg;
-}
-
-AliFemtoPair& AliFemtoPair::operator=(const AliFemtoPair &aPair)
-{
-  if (this == &aPair)
-    return *this;
-
-  fTrack1 = aPair.fTrack1;
-  fTrack2 = aPair.fTrack2;
-
-  fNonIdParNotCalculated = aPair.fNonIdParNotCalculated;
-  fDKSide = aPair.fDKSide;
-  fDKOut = aPair.fDKOut;
-  fDKLong = aPair.fDKLong;
-  fCVK = aPair.fCVK;
-  kStarCalc = aPair.kStarCalc;
-
-  fNonIdParNotCalculatedGlobal = aPair.fNonIdParNotCalculatedGlobal;
+//AliFemtoPair::AliFemtoPair(const AliFemtoPair &a) {/* missing */}
 
-  fMergingParNotCalculated = aPair.fMergingParNotCalculated;
-  fWeightedAvSep = aPair.fWeightedAvSep;
-  fFracOfMergedRow = aPair.fFracOfMergedRow;
-  fClosestRowAtDCA = aPair.fClosestRowAtDCA;
-
-  fMergingParNotCalculatedTrkV0Pos = aPair.fMergingParNotCalculatedTrkV0Pos;
-  fFracOfMergedRowTrkV0Pos = aPair.fFracOfMergedRowTrkV0Pos;
-  fClosestRowAtDCATrkV0Pos = aPair.fClosestRowAtDCATrkV0Pos;
-
-  fMergingParNotCalculatedTrkV0Neg = aPair.fMergingParNotCalculatedTrkV0Neg;
-  fFracOfMergedRowTrkV0Neg = aPair.fFracOfMergedRowTrkV0Neg;
-  fClosestRowAtDCATrkV0Neg = aPair.fClosestRowAtDCATrkV0Neg;
-
-  fMergingParNotCalculatedV0PosV0Neg = aPair.fMergingParNotCalculatedV0PosV0Neg;
-  fFracOfMergedRowV0PosV0Neg = aPair.fFracOfMergedRowV0PosV0Neg;
-  fClosestRowAtDCAV0PosV0Neg = aPair.fClosestRowAtDCAV0PosV0Neg;
-
-  fMergingParNotCalculatedV0NegV0Pos = aPair.fMergingParNotCalculatedV0NegV0Pos;
-  fFracOfMergedRowV0NegV0Pos = aPair.fFracOfMergedRowV0NegV0Pos;
-  fClosestRowAtDCAV0NegV0Pos = aPair.fClosestRowAtDCAV0NegV0Pos;
-
-  fMergingParNotCalculatedV0PosV0Pos = aPair.fMergingParNotCalculatedV0PosV0Pos;
-  fFracOfMergedRowV0PosV0Pos = aPair.fFracOfMergedRowV0PosV0Pos;
-  fClosestRowAtDCAV0PosV0Pos = aPair.fClosestRowAtDCAV0PosV0Pos;
-
-  fMergingParNotCalculatedV0NegV0Neg = aPair.fMergingParNotCalculatedV0NegV0Neg;
-  fFracOfMergedRowV0NegV0Neg = aPair.fFracOfMergedRowV0NegV0Neg;
-  fClosestRowAtDCAV0NegV0Neg = aPair.fClosestRowAtDCAV0NegV0Neg;
-
-  return *this;
-}
+//AliFemtoPair& AliFemtoPair::operator=(const AliFemtoPair &a)
 
 //_________________
 double AliFemtoPair::mInv() const
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.h
index ea2b331ab04..109264a52f0 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPair.h
@@ -14,9 +14,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -104,10 +101,12 @@
 class AliFemtoPair {
 public:
   AliFemtoPair();
-  AliFemtoPair(const AliFemtoPair& aPair);
   AliFemtoPair(AliFemtoParticle*, AliFemtoParticle*);
+  
+
   ~AliFemtoPair();
-  AliFemtoPair& operator=(const AliFemtoPair& aPair);
+  //AliFemtoPair(const AliFemtoPair&);
+  //AliFemtoPair& operator=(const AliFemtoPair&);
 
   // track Gets:
   AliFemtoParticle* track1() const;
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.cxx
index f3d00c48dab..9dd4bda0c69 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.cxx
@@ -14,9 +14,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -139,107 +136,11 @@ int TpcLocalTransform(AliFmThreeVectorD& xgl,
 
 
 //_____________________
-AliFemtoParticle::AliFemtoParticle() : 
-  fTpcV0NegPosSample(0),
-  fV0NegZ(0),
-  fV0NegU(0),
-  fV0NegSect(0),
-  fTrack(0), fV0(0), fKink(0), fXi(0), 
-  fFourMomentum(0),
-  fHelix(),
-  fNominalTpcExitPoint(0),
-  fNominalTpcEntrancePoint(0),
-  fHiddenInfo(0),
-  fPrimaryVertex(0),
-  fSecondaryVertex(0),
-  fHelixV0Pos(),
-  fTpcV0PosEntrancePoint(0),
-  fTpcV0PosExitPoint(0),
-  fHelixV0Neg(),
-  fTpcV0NegEntrancePoint(0),
-  fTpcV0NegExitPoint(0)
-{
+AliFemtoParticle::AliFemtoParticle() : fTrack(0), fV0(0), fKink(0), fHiddenInfo(0) {
   /* no-op for default */
   //  cout << "Created particle " << this << endl;
 }
 //_____________________
-AliFemtoParticle::AliFemtoParticle(const AliFemtoParticle& aParticle):
-  fTpcV0NegPosSample(0),
-  fV0NegZ(0),
-  fV0NegU(0),
-  fV0NegSect(0),
-  fTrack(0), fV0(0), fKink(0), fXi(0),
-  fFourMomentum(0),
-  fHelix(),
-  fNominalTpcExitPoint(0),
-  fNominalTpcEntrancePoint(0),
-  fHiddenInfo(0), 
-  fPrimaryVertex(0),
-  fSecondaryVertex(0),
-  fHelixV0Pos(),
-  fTpcV0PosEntrancePoint(0),
-  fTpcV0PosExitPoint(0),
-  fHelixV0Neg(),
-  fTpcV0NegEntrancePoint(0),
-  fTpcV0NegExitPoint(0)
-{
-  if (aParticle.fTrack)
-    fTrack = new AliFemtoTrack(*aParticle.fTrack);
-  if (aParticle.fV0)
-    fV0    = new AliFemtoV0(*aParticle.fV0);
-  if (aParticle.fKink)
-    fKink  = new AliFemtoKink(*aParticle.fKink);
-  if (aParticle.fXi)
-    fXi    = new AliFemtoXi(*aParticle.fXi);
-  fFourMomentum = aParticle.fFourMomentum;
-  fHelix = aParticle.fHelix;
-
-  for (int iter=0; iter<11; iter++)
-    fNominalPosSample[iter] = aParticle.fNominalPosSample[iter];
-
-  if (aParticle.fTpcV0NegPosSample) {
-    fTpcV0NegPosSample = (AliFemtoThreeVector *) malloc(sizeof(AliFemtoThreeVector) * 11);
-    for (int iter=0; iter<11; iter++)
-      fTpcV0NegPosSample[iter] = aParticle.fTpcV0NegPosSample[iter];
-  }
-
-  if (aParticle.fV0NegZ) {
-    fV0NegZ = (float *) malloc(sizeof(float) * 45);
-    for (int iter=0; iter<11; iter++)
-      fV0NegZ[iter] = aParticle.fV0NegZ[iter];
-  }
-  if (aParticle.fV0NegU) {
-    fV0NegU = (float *) malloc(sizeof(float) * 45);
-    for (int iter=0; iter<11; iter++)
-      fV0NegU[iter] = aParticle.fV0NegU[iter];
-  }
-  if (aParticle.fV0NegSect) {
-    fV0NegSect = (int *) malloc(sizeof(int) * 45);
-    for (int iter=0; iter<11; iter++)
-      fV0NegSect[iter] = aParticle.fV0NegSect[iter];
-  }
-
-  fPrimaryVertex = aParticle.fPrimaryVertex;
-  fSecondaryVertex = aParticle.fSecondaryVertex;
-  CalculatePurity();
-  if(aParticle.fHiddenInfo){
-    fHiddenInfo= aParticle.HiddenInfo()->clone();
-  }
-  
-  fNominalTpcEntrancePoint = aParticle.fNominalTpcEntrancePoint;
-  fNominalTpcExitPoint     = aParticle.fNominalTpcExitPoint;
-  
-  for (int iter=0; iter<6; iter++)
-    fPurity[iter] = aParticle.fPurity[iter];
-  
-  fHelixV0Pos = aParticle.fHelixV0Pos;
-  fTpcV0PosEntrancePoint = aParticle.fTpcV0PosEntrancePoint;
-  fTpcV0PosExitPoint     = aParticle.fTpcV0PosExitPoint;
-  fHelixV0Neg = aParticle.fHelixV0Neg;
-  fTpcV0NegEntrancePoint = aParticle.fTpcV0NegEntrancePoint;
-  fTpcV0NegExitPoint     = aParticle.fTpcV0NegExitPoint;
-}
-//_____________________
 AliFemtoParticle::~AliFemtoParticle(){
   //  cout << "Issuing delete for AliFemtoParticle." << endl;
 
@@ -261,26 +162,7 @@ AliFemtoParticle::~AliFemtoParticle(){
   //  cout << "Deleted particle " << this << endl;
 }
 //_____________________
-AliFemtoParticle::AliFemtoParticle(const AliFemtoTrack* const hbtTrack,const double& mass) : 
-  fTpcV0NegPosSample(0),
-  fV0NegZ(0),
-  fV0NegU(0),
-  fV0NegSect(0),
-  fTrack(0), fV0(0), fKink(0), fXi(0),
-  fFourMomentum(0),
-  fHelix(),
-  fNominalTpcExitPoint(0),
-  fNominalTpcEntrancePoint(0),
-  fHiddenInfo(0), 
-  fPrimaryVertex(0),
-  fSecondaryVertex(0),
-  fHelixV0Pos(),
-  fTpcV0PosEntrancePoint(0),
-  fTpcV0PosExitPoint(0),
-  fHelixV0Neg(),
-  fTpcV0NegEntrancePoint(0),
-  fTpcV0NegExitPoint(0)
-{
+AliFemtoParticle::AliFemtoParticle(const AliFemtoTrack* const hbtTrack,const double& mass) : fTrack(0), fV0(0), fKink(0), fHiddenInfo(0) {
   
   
   // I know there is a better way to do this...
@@ -323,26 +205,7 @@ AliFemtoParticle::AliFemtoParticle(const AliFemtoTrack* const hbtTrack,const dou
 
 }
 //_____________________
-AliFemtoParticle::AliFemtoParticle(const AliFemtoV0* const hbtV0,const double& mass) : 
-  fTpcV0NegPosSample(0),
-  fV0NegZ(0),
-  fV0NegU(0),
-  fV0NegSect(0),
-  fTrack(0), fV0(0), fKink(0),  fXi(0),
-  fFourMomentum(0),
-  fHelix(),
-  fNominalTpcExitPoint(0),
-  fNominalTpcEntrancePoint(0),
-  fHiddenInfo(0),
-  fPrimaryVertex(0),
-  fSecondaryVertex(0),
-  fHelixV0Pos(),
-  fTpcV0PosEntrancePoint(0),
-  fTpcV0PosExitPoint(0),
-  fHelixV0Neg(),
-  fTpcV0NegEntrancePoint(0),
-  fTpcV0NegExitPoint(0)
-{
+AliFemtoParticle::AliFemtoParticle(const AliFemtoV0* const hbtV0,const double& mass) : fTrack(0), fV0(0), fKink(0), fHiddenInfo(0) {
   fV0 = new AliFemtoV0(*hbtV0);
  //fMap[0]= 0;
   //fMap[1]= 0;
@@ -386,26 +249,7 @@ AliFemtoParticle::AliFemtoParticle(const AliFemtoV0* const hbtV0,const double& m
   // ***
 }
 //_____________________
-AliFemtoParticle::AliFemtoParticle(const AliFemtoKink* const hbtKink,const double& mass) : 
-  fTpcV0NegPosSample(0),
-  fV0NegZ(0),
-  fV0NegU(0),
-  fV0NegSect(0),
-  fTrack(0), fV0(0), fKink(0), fXi(0),
-  fFourMomentum(0),
-  fHelix(),
-  fNominalTpcExitPoint(0),
-  fNominalTpcEntrancePoint(0),
-  fHiddenInfo(0),
-  fPrimaryVertex(0),
-  fSecondaryVertex(0),
-  fHelixV0Pos(),
-  fTpcV0PosEntrancePoint(0),
-  fTpcV0PosExitPoint(0),
-  fHelixV0Neg(),
-  fTpcV0NegEntrancePoint(0),
-  fTpcV0NegExitPoint(0)
-{
+AliFemtoParticle::AliFemtoParticle(const AliFemtoKink* const hbtKink,const double& mass) : fTrack(0), fV0(0), fHiddenInfo(0) {
   fKink = new AliFemtoKink(*hbtKink);
  // fMap[0]= 0;
   //fMap[1]= 0;
@@ -417,26 +261,7 @@ AliFemtoParticle::AliFemtoParticle(const AliFemtoKink* const hbtKink,const doubl
 }
 
 //_____________________
-AliFemtoParticle::AliFemtoParticle(const AliFemtoXi* const hbtXi, const double& mass) :
-  fTpcV0NegPosSample(0),
-  fV0NegZ(0),
-  fV0NegU(0),
-  fV0NegSect(0),
-  fTrack(0), fV0(0), fKink(0), fXi(0),
-  fFourMomentum(0),
-  fHelix(),
-  fNominalTpcExitPoint(0),
-  fNominalTpcEntrancePoint(0),
-  fHiddenInfo(0), 
-  fPrimaryVertex(0),
-  fSecondaryVertex(0),
-  fHelixV0Pos(),
-  fTpcV0PosEntrancePoint(0),
-  fTpcV0PosExitPoint(0),
-  fHelixV0Neg(),
-  fTpcV0NegEntrancePoint(0),
-  fTpcV0NegExitPoint(0)
-{
+AliFemtoParticle::AliFemtoParticle(const AliFemtoXi* const hbtXi, const double& mass)  {
   fXi = new AliFemtoXi(*hbtXi);
  // fMap[0]= 0;
   //fMap[1]= 0;
@@ -447,78 +272,6 @@ AliFemtoParticle::AliFemtoParticle(const AliFemtoXi* const hbtXi, const double&
   fHiddenInfo = 0;
 }
 //_____________________
-AliFemtoParticle& AliFemtoParticle::operator=(const AliFemtoParticle& aParticle)
-{
-  if (this == &aParticle)
-    return *this;
-
-  if (aParticle.fTrack)
-    fTrack = new AliFemtoTrack(*aParticle.fTrack);
-  if (aParticle.fV0)
-    fV0    = new AliFemtoV0(*aParticle.fV0);
-  if (aParticle.fKink)
-    fKink  = new AliFemtoKink(*aParticle.fKink);
-  if (aParticle.fXi)
-    fXi    = new AliFemtoXi(*aParticle.fXi);
-  fFourMomentum = aParticle.fFourMomentum;
-  fHelix = aParticle.fHelix;
-
-  for (int iter=0; iter<11; iter++)
-    fNominalPosSample[iter] = aParticle.fNominalPosSample[iter];
-
-  if (fTpcV0NegPosSample) delete fTpcV0NegPosSample;
-  if (aParticle.fTpcV0NegPosSample) {
-    fTpcV0NegPosSample = (AliFemtoThreeVector *) malloc(sizeof(AliFemtoThreeVector) * 11);
-    for (int iter=0; iter<11; iter++)
-      fTpcV0NegPosSample[iter] = aParticle.fTpcV0NegPosSample[iter];
-  }
-
-  if (fV0NegZ) delete fV0NegZ;
-  if (aParticle.fV0NegZ) {
-    fV0NegZ = (float *) malloc(sizeof(float) * 45);
-    for (int iter=0; iter<11; iter++)
-      fV0NegZ[iter] = aParticle.fV0NegZ[iter];
-  }
-  if (fV0NegU) delete fV0NegU;
-  if (aParticle.fV0NegU) {
-    fV0NegU = (float *) malloc(sizeof(float) * 45);
-    for (int iter=0; iter<11; iter++)
-      fV0NegU[iter] = aParticle.fV0NegU[iter];
-  }
-  if (fV0NegSect) delete fV0NegSect;
-  if (aParticle.fV0NegSect) {
-    fV0NegSect = (int *) malloc(sizeof(int) * 45);
-    for (int iter=0; iter<11; iter++)
-      fV0NegSect[iter] = aParticle.fV0NegSect[iter];
-  }
-
-  fPrimaryVertex = aParticle.fPrimaryVertex;
-  fSecondaryVertex = aParticle.fSecondaryVertex;
-  CalculatePurity();
-  if(aParticle.fHiddenInfo){
-    fHiddenInfo= aParticle.fHiddenInfo->clone();
-  }
-  
-  fNominalTpcEntrancePoint = aParticle.fNominalTpcEntrancePoint;
-  fNominalTpcExitPoint     = aParticle.fNominalTpcExitPoint;
-  
-  if (fHiddenInfo) delete fHiddenInfo;
-  if (aParticle.fHiddenInfo) 
-    fHiddenInfo = aParticle.HiddenInfo()->clone();
-  
-  for (int iter=0; iter<6; iter++)
-    fPurity[iter] = aParticle.fPurity[iter];
-  
-  fHelixV0Pos = aParticle.fHelixV0Pos;
-  fTpcV0PosEntrancePoint = aParticle.fTpcV0PosEntrancePoint;
-  fTpcV0PosExitPoint     = aParticle.fTpcV0PosExitPoint;
-  fHelixV0Neg = aParticle.fHelixV0Neg;
-  fTpcV0NegEntrancePoint = aParticle.fTpcV0NegEntrancePoint;
-  fTpcV0NegExitPoint     = aParticle.fTpcV0NegExitPoint;
-
-  return *this;
-}
-//_____________________
 const AliFemtoThreeVector& AliFemtoParticle::NominalTpcExitPoint() const{
   // in future, may want to calculate this "on demand" only, sot this routine may get more sophisticated
   // for now, we calculate Exit and Entrance points upon instantiation
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.h
index dda50266c60..18b423d9e49 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoParticle.h
@@ -14,9 +14,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.2  2007-04-03 16:00:08  mchojnacki
  * Changes to iprove memory managing
  *
@@ -113,15 +110,12 @@ class AliFemtoHiddenInfo;
 class AliFemtoParticle{
 public:
   AliFemtoParticle();
-  AliFemtoParticle(const AliFemtoParticle& aParticle);
   AliFemtoParticle(const AliFemtoTrack* const hbtTrack, const double& mass);
   AliFemtoParticle(const AliFemtoV0* const hbtV0, const double& mass);
   AliFemtoParticle(const AliFemtoKink* const hbtKink, const double& mass);
   AliFemtoParticle(const AliFemtoXi* const hbtXi, const double& mass);
   ~AliFemtoParticle();
 
-  AliFemtoParticle& operator=(const AliFemtoParticle& aParticle);
-
   const AliFemtoLorentzVector& FourMomentum() const;
 
   AliFmPhysicalHelixD& Helix();
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.cxx
index a2c9eeed997..80cc772852a 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.cxx
@@ -16,9 +16,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -47,83 +44,16 @@
 #include "Infrastructure/AliFemtoPicoEvent.h"
 
 //________________
-AliFemtoPicoEvent::AliFemtoPicoEvent() :
-  fFirstParticleCollection(0),
-  fSecondParticleCollection(0),
-  fThirdParticleCollection(0)
-{
+AliFemtoPicoEvent::AliFemtoPicoEvent(){
   fFirstParticleCollection = new AliFemtoParticleCollection;
   fSecondParticleCollection = new AliFemtoParticleCollection;
   fThirdParticleCollection = new AliFemtoParticleCollection;
 }
 //_________________
-AliFemtoPicoEvent::AliFemtoPicoEvent(const AliFemtoPicoEvent& aPicoEvent) :
-  fFirstParticleCollection(0),
-  fSecondParticleCollection(0),
-  fThirdParticleCollection(0)
-{
-  AliFemtoParticleIterator iter;
-
-  fFirstParticleCollection = new AliFemtoParticleCollection;
-  if (aPicoEvent.fFirstParticleCollection) {
-    for (iter=aPicoEvent.fFirstParticleCollection->begin();iter!=aPicoEvent.fFirstParticleCollection->end();iter++){
-      fFirstParticleCollection->push_back(*iter);
-    }
-  }
-  fSecondParticleCollection = new AliFemtoParticleCollection;
-  if (aPicoEvent.fSecondParticleCollection) {
-    for (iter=aPicoEvent.fSecondParticleCollection->begin();iter!=aPicoEvent.fSecondParticleCollection->end();iter++){
-      fSecondParticleCollection->push_back(*iter);
-    }
-  }
-  fThirdParticleCollection = new AliFemtoParticleCollection;
-  if (aPicoEvent.fThirdParticleCollection) {
-    for (iter=aPicoEvent.fThirdParticleCollection->begin();iter!=aPicoEvent.fThirdParticleCollection->end();iter++){
-      fThirdParticleCollection->push_back(*iter);
-    }
-  }
-}
-//_________________
 AliFemtoPicoEvent::~AliFemtoPicoEvent(){
   AliFemtoParticleIterator iter;
-  
-  if (fFirstParticleCollection){
-    for (iter=fFirstParticleCollection->begin();iter!=fFirstParticleCollection->end();iter++){
-      delete *iter;
-    }
-    fFirstParticleCollection->clear();
-    delete fFirstParticleCollection;
-    fFirstParticleCollection = 0;
-  }
-  
-  if (fSecondParticleCollection){
-    for (iter=fSecondParticleCollection->begin();iter!=fSecondParticleCollection->end();iter++){
-      delete *iter;
-    }
-    fSecondParticleCollection->clear();
-    delete fSecondParticleCollection;
-    fSecondParticleCollection = 0;
-  }
 
-  if (fThirdParticleCollection){
-    if (fThirdParticleCollection->size() != 0 ) {
-      for (iter=fThirdParticleCollection->begin();iter!=fThirdParticleCollection->end();iter++){
-	delete *iter;
-      }
-    }
-    fThirdParticleCollection->clear();
-    delete fThirdParticleCollection;
-    fThirdParticleCollection = 0;
-  }
-}
-//_________________
- AliFemtoPicoEvent& AliFemtoPicoEvent::operator=(AliFemtoPicoEvent& aPicoEvent) 
-{
-  if (this == &aPicoEvent) 
-    return *this;
 
-  AliFemtoParticleIterator iter;
-   
   if (fFirstParticleCollection){
       for (iter=fFirstParticleCollection->begin();iter!=fFirstParticleCollection->end();iter++){
 	delete *iter;
@@ -152,26 +82,5 @@ AliFemtoPicoEvent::~AliFemtoPicoEvent(){
     delete fThirdParticleCollection;
     fThirdParticleCollection = 0;
   }
-
-  fFirstParticleCollection = new AliFemtoParticleCollection;
-  if (aPicoEvent.fFirstParticleCollection) {
-    for (iter=aPicoEvent.fFirstParticleCollection->begin();iter!=aPicoEvent.fFirstParticleCollection->end();iter++){
-      fFirstParticleCollection->push_back(*iter);
-    }
-  }
-  fSecondParticleCollection = new AliFemtoParticleCollection;
-  if (aPicoEvent.fSecondParticleCollection) {
-    for (iter=aPicoEvent.fSecondParticleCollection->begin();iter!=aPicoEvent.fSecondParticleCollection->end();iter++){
-      fSecondParticleCollection->push_back(*iter);
-    }
-  }
-  fThirdParticleCollection = new AliFemtoParticleCollection;
-  if (aPicoEvent.fThirdParticleCollection) {
-    for (iter=aPicoEvent.fThirdParticleCollection->begin();iter!=aPicoEvent.fThirdParticleCollection->end();iter++){
-      fThirdParticleCollection->push_back(*iter);
-    }
-  }
-
-  return *this;
 }
-
+//_________________
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.h
index 0351d47108a..17ee411cb05 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEvent.h
@@ -16,9 +16,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -38,11 +35,8 @@
 class AliFemtoPicoEvent{
 public:
   AliFemtoPicoEvent();
-  AliFemtoPicoEvent(const AliFemtoPicoEvent& aPicoEvent);
   ~AliFemtoPicoEvent();
 
-  AliFemtoPicoEvent& operator=(AliFemtoPicoEvent& aPicoEvent);
-
   /* may want to have other stuff in here, like where is primary vertex */
 
   AliFemtoParticleCollection* FirstParticleCollection();
@@ -59,4 +53,6 @@ inline AliFemtoParticleCollection* AliFemtoPicoEvent::FirstParticleCollection(){
 inline AliFemtoParticleCollection* AliFemtoPicoEvent::SecondParticleCollection(){return fSecondParticleCollection;}
 inline AliFemtoParticleCollection* AliFemtoPicoEvent::ThirdParticleCollection(){return fThirdParticleCollection;}
 
+
+
 #endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.cxx
index 9b453b3ceec..e236ce18756 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoPicoEventCollectionVectorHideAway.cxx
@@ -10,9 +10,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -32,28 +29,24 @@
 
 // -----------------------------------
 AliFemtoPicoEventCollectionVectorHideAway::AliFemtoPicoEventCollectionVectorHideAway(int bx, double lx, double ux,
-										     int by, double ly, double uy,
-										     int bz, double lz, double uz):
-  fBinsTot(0),
-  fBinsx(bx), fBinsy(by), fBinsz(bz),
-  fMinx(lx),  fMiny(ly),  fMinz(lz),
-  fMaxx(ux),  fMaxy(uy),  fMaxz(uz),
-  fStepx(0),  fStepy(0),  fStepz(0),
-  fCollection(0),
-  fCollectionVector(0)
-{
-  fBinsTot = fBinsx * fBinsy * fBinsz;
-  fStepx=0;  fStepx = (fMaxx-fMinx)/fBinsx;
-  fStepy=0;  fStepy = (fMaxy-fMiny)/fBinsy;
-  fStepz=0;  fStepz = (fMaxz-fMinz)/fBinsz;
-  
-  
-  //fCollectionVector = new AliFemtoPicoEventCollectionVector();
-  fCollection = 0;
-  for ( int i=0; iclone();
-  else 
-    fHiddenInfo = NULL;
-
-  return *this;
-}
-
 void AliFemtoTrack::SetCharge(const short& ch){fCharge=ch;}
 
 void AliFemtoTrack::SetPidProbElectron(const float& x){fPidProbElectron = x;}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.h
index 5c9ae6de2dd..1e8ac1b3444 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoTrack.h
@@ -31,11 +31,13 @@ class StMuDst;
 class StMuTrack;
 #endif
 
+
+
+
 class AliFemtoTrack{
 public:
   AliFemtoTrack();
   AliFemtoTrack(const AliFemtoTrack&);// copy constructor
-  AliFemtoTrack& operator=(const AliFemtoTrack& aTrack);
 #ifndef __NO_STAR_DEPENDENCE_ALLOWED__
 #ifdef __ROOT__
  //AliFemtoTrack(const StTrack*, AliFemtoThreeVector);   // c-tor from StTrack of STAR DSTs
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.cxx
index b178dc5eb76..6b8749f7ca4 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.cxx
@@ -2,57 +2,7 @@
 #include "phys_constants.h"
 
 // -----------------------------------------------------------------------
-AliFemtoV0::AliFemtoV0():
-  fDecayLengthV0(0), fDecayVertexV0(0), fPrimaryVertex(0),
-  fDcaV0Daughters(0), fDcaV0ToPrimVertex(0),
-  fDcaPosToPrimVertex(0), fDcaNegToPrimVertex(0),
-  fMomPos(0), fMomNeg(0),
-  fTpcHitsPos(0), fTpcHitsNeg(0),
-  fChi2V0(0),  fClV0(0),  fChi2Pos(0),  fClPos(0),  fChi2Neg(0),  fClNeg(0),
-  fDedxPos(0),  fErrDedxPos(0),  fLenDedxPos(0),
-  fDedxNeg(0),  fErrDedxNeg(0),  fLenDedxNeg(0),
-  fNufDedxPos(0), fNufDedxNeg(0),
-  fHelixPos(), fHelixNeg(), 
-  fMomV0(0),
-  fAlphaV0(0),  fPtArmV0(0),
-  fELambda(0),  fEK0Short(0),  
-  fEPosProton(0),  fEPosPion(0),
-  fENegProton(0),  fENegPion(0),
-  fMassLambda(0),  fMassAntiLambda(0),
-  fMassK0Short(0),  fRapLambda(0),
-  fRapK0Short(0),  fCTauLambda(0),
-  fCTauK0Short(0),  fPtV0(0),  fPtotV0(0),
-  fPtPos(0),  fPtotPos(0),
-  fPtNeg(0),  fPtotNeg(0),
-  fKeyNeg(0),   fKeyPos(0),
-  fHiddenInfo(0)  /***/
-{ /* no-op */}
-// -----------------------------------------------------------------------
-AliFemtoV0::AliFemtoV0(const AliFemtoV0& v) :
-  fDecayLengthV0(0), fDecayVertexV0(0), fPrimaryVertex(0),
-  fDcaV0Daughters(0), fDcaV0ToPrimVertex(0),
-  fDcaPosToPrimVertex(0), fDcaNegToPrimVertex(0),
-  fMomPos(0), fMomNeg(0),
-  fTpcHitsPos(0), fTpcHitsNeg(0),
-  fChi2V0(0),  fClV0(0),  fChi2Pos(0),  fClPos(0),  fChi2Neg(0),  fClNeg(0),
-  fDedxPos(0),  fErrDedxPos(0),  fLenDedxPos(0),
-  fDedxNeg(0),  fErrDedxNeg(0),  fLenDedxNeg(0),
-  fNufDedxPos(0), fNufDedxNeg(0),
-  fHelixPos(), fHelixNeg(), 
-  fMomV0(0),
-  fAlphaV0(0),  fPtArmV0(0),
-  fELambda(0),  fEK0Short(0),  
-  fEPosProton(0),  fEPosPion(0),
-  fENegProton(0),  fENegPion(0),
-  fMassLambda(0),  fMassAntiLambda(0),
-  fMassK0Short(0),  fRapLambda(0),
-  fRapK0Short(0),  fCTauLambda(0),
-  fCTauK0Short(0),  fPtV0(0),  fPtotV0(0),
-  fPtPos(0),  fPtotPos(0),
-  fPtNeg(0),  fPtotNeg(0),
-  fKeyNeg(0),   fKeyPos(0),
-  fHiddenInfo(0)  /***/
-{ // copy constructor
+AliFemtoV0::AliFemtoV0(const AliFemtoV0& v){ // copy constructor
   fDecayLengthV0 = v.fDecayLengthV0;
   fDecayVertexV0 = v.fDecayVertexV0;
   fDcaV0Daughters = v.fDcaV0Daughters;
@@ -94,55 +44,6 @@ AliFemtoV0::AliFemtoV0(const AliFemtoV0& v) :
   fHiddenInfo = v.fHiddenInfo? v.fHiddenInfo->clone() : 0;// GR 11 DEC 02
   UpdateV0();
 }
-AliFemtoV0& AliFemtoV0::operator=(const AliFemtoV0& aV0)
-{
-  if (this == &aV0)
-    return *this;
-  fDecayLengthV0 = aV0.fDecayLengthV0;
-  fDecayVertexV0 = aV0.fDecayVertexV0;
-  fDcaV0Daughters = aV0.fDcaV0Daughters;
-  fDcaV0ToPrimVertex = aV0.fDcaV0ToPrimVertex;
-  fDcaPosToPrimVertex = aV0.fDcaPosToPrimVertex;
-  fDcaNegToPrimVertex = aV0.fDcaNegToPrimVertex;
-  fMomPos = aV0.fMomPos;
-  fMomNeg = aV0.fMomNeg;
-
-  fTrackTopologyMapPos[0] = aV0.fTrackTopologyMapPos[0];
-  fTrackTopologyMapPos[1] = aV0.fTrackTopologyMapPos[1];
-  fTrackTopologyMapNeg[0] = aV0.fTrackTopologyMapNeg[0];
-  fTrackTopologyMapNeg[1] = aV0.fTrackTopologyMapNeg[1];
-   
-  fKeyPos = aV0.fKeyPos;
-  fKeyNeg = aV0.fKeyNeg;
-     
-  fTpcHitsPos = aV0.fTpcHitsPos;
-  fTpcHitsNeg = aV0.fTpcHitsNeg;
-
-  fChi2V0 = aV0.fChi2V0;
-  fClV0 = aV0.fClV0;
-  fChi2Pos = aV0.fChi2Pos;
-  fClPos = aV0.fClPos;
-  fChi2Neg = aV0.fChi2Neg;
-  fClNeg = aV0.fClNeg;
-  fDedxPos = aV0.fDedxPos;
-  fErrDedxPos = aV0.fErrDedxPos;//Gael 04Fev2002
-  fLenDedxPos = aV0.fLenDedxPos;//Gael 04Fev2002
-  fDedxNeg = aV0.fDedxNeg;
-  fErrDedxNeg = aV0.fErrDedxNeg;//Gael 04Fev2002
-  fLenDedxNeg = aV0.fLenDedxNeg;//Gael 04Fev2002
-
-  fNufDedxPos = aV0.fNufDedxPos;
-  fNufDedxNeg = aV0.fNufDedxNeg;
-
-  fHelixPos = aV0.fHelixPos;// Gael 12 Sept
-  fHelixNeg = aV0.fHelixNeg;// Gael 12 Sept
-  if (fHiddenInfo) delete fHiddenInfo;
-  fHiddenInfo = aV0.fHiddenInfo? aV0.fHiddenInfo->clone() : 0;// GR 11 DEC 02
-  UpdateV0();
-  
-  return *this;
-}
-
 // -----------------------------------------------------------------------
 void AliFemtoV0::UpdateV0(){
   //Calc. derived memebers of the v0 class
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.h
index d76894fc1e2..a4a676a0c4e 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoV0.h
@@ -11,9 +11,6 @@
  ***********************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -88,15 +85,14 @@
 
 class AliFemtoV0 {
 public:
-  AliFemtoV0();
+  AliFemtoV0(){/* no-op */}
   AliFemtoV0( const AliFemtoV0&); // copy constructor
 #ifdef __ROOT__
 #ifndef __NO_STAR_DEPENDENCE_ALLOWED__
   AliFemtoV0( StV0MuDst&); // from strangeness V0 micro dst structure
 #endif
 #endif
-  virtual ~AliFemtoV0(){if(fHiddenInfo) delete fHiddenInfo;}
-  AliFemtoV0& operator=(const AliFemtoV0& aV0);
+  ~AliFemtoV0(){if(fHiddenInfo) delete fHiddenInfo;}
 
 
   float decayLengthV0() const;       // 3-d decay distance
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.cxx
index e180d36a75d..4dfe3f4040b 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.cxx
@@ -1,21 +1,6 @@
 #include "Infrastructure/AliFemtoXi.h"
 #include "phys_constants.h"
 
-// -----------------------------------------------------------------------
-AliFemtoXi::AliFemtoXi():
-  fCharge(0), fDecayLengthXi(0),
-  fDecayVertexXi(0),
-  fDcaXiDaughters(0), fDcaXiToPrimVertex(0), fDcaBachelorToPrimVertex(0),
-  fMomBachelor(0), fKeyBachelor(0),
-  fTpcHitsBac(0), fChi2Xi(0), fClXi(0), fChi2Bachelor(0), fClBachelor(0),
-  fDedxBachelor(0), fNufDedxBachelor(0), fMomXi(0),
-  fAlphaXi(0), fPtArmXi(0),
-  fEXi(0), fEOmega(0), fEBacPion(0), fEBacKaon(0),
-  fMassXi(0), fMassOmega(0), fRapXi(0), fRapOmega(0),
-  fCTauXi(0), fCTauOmega(0),
-  fPtXi(0), fPtotXi(0), fPtBac(0), fPtotBac(0),
-  fKeyBac(0)
-{/* no-op */}
 // -----------------------------------------------------------------------
 void AliFemtoXi::UpdateXi(){
   //Calc. derived members of the xi class
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.h
index 3a42d26372d..ec1dd45ed49 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoXi.h
@@ -23,13 +23,13 @@
 
 class AliFemtoXi : public AliFemtoV0 {
 public:
-  AliFemtoXi();
+  AliFemtoXi(){/* no-op */}
 #ifdef __ROOT__
 #ifndef __NO_STAR_DEPENDENCE_ALLOWED__
   AliFemtoXi(StXiMuDst&); // from strangeness Xi micro dst structure
 #endif
 #endif
-  virtual ~AliFemtoXi(){/* no-op */}
+  ~AliFemtoXi(){/* no-op */}
 
   void UpdateXi();
   float decayLengthXi() const;            // 3-d decay distance
@@ -244,9 +244,6 @@ inline void AliFemtoXi::SetdedxBac(float x){fDedxBachelor=x;}
 /***********************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.cxx b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.cxx
index a52153d3f34..73bf1d2209f 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.cxx
@@ -10,9 +10,6 @@
 ***************************************************************************
 *
 * $Log$
-* Revision 1.3  2007/04/27 07:24:34  akisiel
-* Make revisions needed for compilation from the main AliRoot tree
-*
 * Revision 1.1.1.1  2007/04/25 15:38:41  panos
 * Importing the HBT code dir
 *
@@ -132,31 +129,10 @@ using namespace std;
 
 const double AliFmHelix::NoSolution = 3.e+33;
 
-AliFmHelix::AliFmHelix() :
-  mSingularity(0),
-  mOrigin(0,0,0),
-  mDipAngle(0),
-  mCurvature(0),
-  mPhase(0),
-  mH(0),
-  mCosDipAngle(0),
-  mSinDipAngle(0),
-  mCosPhase(0),
-  mSinPhase(0)
-{ /*noop*/ }
+AliFmHelix::AliFmHelix(){ /*noop*/ }
 
 AliFmHelix::AliFmHelix(double c, double d, double phase,
-		       const AliFmThreeVector& o, int h) :
-  mSingularity(0),
-  mOrigin(0,0,0),
-  mDipAngle(0),
-  mCurvature(0),
-  mPhase(0),
-  mH(0),
-  mCosDipAngle(0),
-  mSinDipAngle(0),
-  mCosPhase(0),
-  mSinPhase(0)
+				 const AliFmThreeVector& o, int h)
 {
 	setParameters(c, d, phase, o, h);
 }
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.h b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.h
index ed6df23289a..50af0adb790 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFmHelix.h
@@ -18,9 +18,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.1.1.1  2007/04/25 15:38:41  panos
- * Importing the HBT code dir
- *
  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
  * First version on CVS
  *
@@ -66,7 +63,7 @@ class AliFmHelix {
 public:
     /// curvature, dip angle, phase, origin, h
     AliFmHelix(double c, double dip, double phase,
-	       const AliFmThreeVector& o, int h=-1);
+	    const AliFmThreeVector& o, int h=-1);
     
     virtual ~AliFmHelix();
     // AliFmHelix(const AliFmHelix&);			// use default
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelCorrFctn.cxx b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelCorrFctn.cxx
deleted file mode 100644
index 56fb33a729c..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelCorrFctn.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelCorrFctn - the base class for correlation function which    ///
-/// uses the model framework and weight generation                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelCorrFctn, 1)
-#endif
-
-#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
-#include "AliFemtoModelHiddenInfo.h"
-#include "AliFemtoModelCorrFctn.h"
-    
-//_______________________
-AliFemtoModelCorrFctn::AliFemtoModelCorrFctn(): 
-  fManager(0),
-  fNumeratorTrue(0),
-  fNumeratorFake(0),
-  fDenominator(0)
-{
-  fNumeratorTrue = new TH1D("ModelNumTrue","ModelNumTrue",50,0.0,0.5);
-  fNumeratorFake = new TH1D("ModelNumFake","ModelNumFake",50,0.0,0.5);
-  fDenominator = new TH1D("ModelDen","ModelDen",50,0.0,0.5);
-
-  fNumeratorTrue->Sumw2();
-  fNumeratorFake->Sumw2();
-  fDenominator->Sumw2();
-}
-//_______________________
-AliFemtoModelCorrFctn::AliFemtoModelCorrFctn(const char *title, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi):
-  fManager(0),
-  fNumeratorTrue(0),
-  fNumeratorFake(0),
-  fDenominator(0)
-{
-  char buf[100];
-  sprintf(buf, "NumTrue%s", title);
-  fNumeratorTrue = new TH1D(buf,buf,aNbins,aQinvLo,aQinvHi);
-  sprintf(buf, "NumFake%s", title);
-  fNumeratorFake = new TH1D(buf,buf,aNbins,aQinvLo,aQinvHi);
-  sprintf(buf, "Den%s", title);
-  fDenominator = new TH1D(buf,buf,aNbins,aQinvLo,aQinvHi);
-
-  fNumeratorTrue->Sumw2();
-  fNumeratorFake->Sumw2();
-  fDenominator->Sumw2();
-}
-//_______________________
-AliFemtoModelCorrFctn::AliFemtoModelCorrFctn(const AliFemtoModelCorrFctn& aCorrFctn) :
-  fManager(0),
-  fNumeratorTrue(0),
-  fNumeratorFake(0),
-  fDenominator(0)
-{
-  if (aCorrFctn.fNumeratorTrue)
-    fNumeratorTrue = new TH1D(*(aCorrFctn.fNumeratorTrue));
-  if (aCorrFctn.fNumeratorFake)
-    fNumeratorFake = new TH1D(*(aCorrFctn.fNumeratorFake));
-  if (aCorrFctn.fDenominator)
-    fDenominator = new TH1D(*(aCorrFctn.fDenominator));
-  fManager = aCorrFctn.fManager;
-}
-//_______________________
-AliFemtoModelCorrFctn::~AliFemtoModelCorrFctn()
-{
-  if (fNumeratorTrue) delete fNumeratorTrue;
-  if (fNumeratorFake) delete fNumeratorFake;
-  if (fDenominator) delete fDenominator;
-}
-//_______________________
-AliFemtoModelCorrFctn& AliFemtoModelCorrFctn::operator=(const AliFemtoModelCorrFctn& aCorrFctn)
-{
-  if (this == &aCorrFctn)
-    return *this;
-  
-  if (aCorrFctn.fNumeratorTrue)
-    fNumeratorTrue = new TH1D(*(aCorrFctn.fNumeratorTrue));
-  else
-    fNumeratorTrue = 0;
-  if (aCorrFctn.fNumeratorFake)
-    fNumeratorFake = new TH1D(*(aCorrFctn.fNumeratorFake));
-  else
-    fNumeratorFake = 0;
-  if (aCorrFctn.fDenominator)
-    fDenominator = new TH1D(*(aCorrFctn.fDenominator));
-  else
-    fDenominator = 0;
-  fManager = aCorrFctn.fManager;
-
-  return *this;
-}
-//_______________________
-void AliFemtoModelCorrFctn::ConnectToManager(AliFemtoModelManager *aManager)
-{
-  fManager = aManager;
-}
-
-//_______________________
-AliFemtoString AliFemtoModelCorrFctn::Report()
-{
-  AliFemtoString tStr = "AliFemtoModelCorrFctn report";
-
-  return tStr;
-}
-
-//_______________________
-void AliFemtoModelCorrFctn::AddRealPair(AliFemtoPair* aPair)
-{
-  Double_t weight = fManager->GetWeight(aPair);
-  fNumeratorTrue->Fill(aPair->qInv(), weight);
-}
-//_______________________
-void AliFemtoModelCorrFctn::AddMixedPair(AliFemtoPair* aPair)
-{
-  Double_t weight = fManager->GetWeight(aPair);
-  fNumeratorFake->Fill(aPair->qInv(), weight);
-  fDenominator->Fill(aPair->qInv(), 1.0);
-}
-//_______________________
-void AliFemtoModelCorrFctn::EventBegin(const AliFemtoEvent* aEvent)
-{
-  /* Do nothing */
-}
-//_______________________
-void AliFemtoModelCorrFctn::EventEnd(const AliFemtoEvent* aEvent)
-{
-  /* Do nothing */
-}
-//_______________________
-void AliFemtoModelCorrFctn::Finish()
-{
-  /* Do nothing */
-}
-//_______________________
-void AliFemtoModelCorrFctn::Write()
-{
-  fNumeratorTrue->Write();
-  fNumeratorFake->Write();
-  fDenominator->Write();
-}
-//_______________________
-AliFemtoModelCorrFctn* AliFemtoModelCorrFctn::Clone()
-{
-  AliFemtoModelCorrFctn *tCopy = new AliFemtoModelCorrFctn(*this);
-  
-  return tCopy;
-}
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelCorrFctn.h
deleted file mode 100644
index 5dc6c9ae3fb..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelCorrFctn.h
+++ /dev/null
@@ -1,56 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelCorrFctn - the base class for correlation function which    ///
-/// uses the model framework and weight generation                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelCorrFctn_hh
-#define AliFemtoModelCorrFctn_hh
-
-#include "Base/AliFemtoCorrFctn.h"
-#include "Infrastructure/AliFemtoPair.h"
-#include "AliFemtoModelManager.h"
-
-class AliFemtoModelCorrFctn: public AliFemtoCorrFctn {
-
-public:
-  AliFemtoModelCorrFctn();
-  AliFemtoModelCorrFctn(const char *title, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi);
-  AliFemtoModelCorrFctn(const AliFemtoModelCorrFctn& aCorrFctn);
-  virtual ~AliFemtoModelCorrFctn();
-
-  AliFemtoModelCorrFctn& operator=(const AliFemtoModelCorrFctn& aCorrFctn);
-
-  virtual void ConnectToManager(AliFemtoModelManager *aManager);
-
-  virtual AliFemtoString Report();
-
-  virtual void AddRealPair(AliFemtoPair* aPair);
-  virtual void AddMixedPair(AliFemtoPair* aPir);
-
-  virtual void EventBegin(const AliFemtoEvent* aEvent);
-  virtual void EventEnd(const AliFemtoEvent* aEvent);
-  virtual void Finish();
-
-  virtual void Write();
-
-  virtual AliFemtoModelCorrFctn* Clone();
-
-  AliFemtoBaseAnalysis* HbtAnalysis(){return fyAnalysis;};
-  void SetAnalysis(AliFemtoBaseAnalysis* aAnalysis);
-
-protected:
-  AliFemtoModelManager *fManager; // Link back to the managet to get the weights
-  
-  TH1D *fNumeratorTrue; // Numerator made with pairs from the same event
-  TH1D *fNumeratorFake; // Numerator made with pairs from different events (mixed pairs)
-  TH1D *fDenominator;   // Denominator made with mixed pairs
-
-private:
-
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelCorrFctn, 1)
-#endif
-};
-
-#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelFreezeOutGenerator.cxx b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelFreezeOutGenerator.cxx
deleted file mode 100644
index 22ef44b19de..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelFreezeOutGenerator.cxx
+++ /dev/null
@@ -1,44 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelFreezeOutGenerator - abstract base class for freeze-out     ///
-/// coordinates generator                                                    ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelFreezeOutGenerator, 1)
-#endif
-
-#include "AliFemtoModelFreezeOutGenerator.h"
-
-//____________________________
-AliFemtoModelFreezeOutGenerator::AliFemtoModelFreezeOutGenerator(): 
-  fRandom(0) 
-{ /* no-op */ }
-//____________________________
-AliFemtoModelFreezeOutGenerator::AliFemtoModelFreezeOutGenerator(AliFemtoModelFreezeOutGenerator &aModel): 
-  fRandom(0)
-{/* no-op */}
-//____________________________
-AliFemtoModelFreezeOutGenerator::~AliFemtoModelFreezeOutGenerator()
-{
-  if (fRandom) delete fRandom;
-}
-//____________________________
-AliFemtoModelFreezeOutGenerator& AliFemtoModelFreezeOutGenerator::operator=(const AliFemtoModelFreezeOutGenerator& aGen) 
-{ 
-  if (this == &aGen) return *this; 
-  if (aGen.fRandom) 
-    fRandom = new TRandom2(*aGen.fRandom);
-  else 
-    fRandom=0; 
-  return *this; 
-}
-//____________________________
-AliFemtoModelFreezeOutGenerator* AliFemtoModelFreezeOutGenerator::Clone() const 
-{ 
-  return 0; 
-}
-
-
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelFreezeOutGenerator.h b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelFreezeOutGenerator.h
deleted file mode 100644
index c04441f261c..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelFreezeOutGenerator.h
+++ /dev/null
@@ -1,40 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelFreezeOutGenerator - abstract base class for freeze-out     ///
-/// coordinates generator                                                    ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelFreezeOutGenerator_hh
-#define AliFemtoModelFreezeOutGenerator_hh
-
-#include "TRandom2.h"
-#include "AliFemtoPair.h"
-
-class AliFemtoModelFreezeOutGenerator 
-{
- public:
-  AliFemtoModelFreezeOutGenerator();
-  AliFemtoModelFreezeOutGenerator(AliFemtoModelFreezeOutGenerator &aModel);
-  
-  AliFemtoModelFreezeOutGenerator& operator=(const AliFemtoModelFreezeOutGenerator& aGen);
-  
-  virtual ~AliFemtoModelFreezeOutGenerator();
-  virtual void GenerateFreezeOut(AliFemtoPair *aPair) = 0;
-  
-  virtual AliFemtoModelFreezeOutGenerator* Clone() const;
-  
- protected:
-  TRandom2 *fRandom;
-  
- private:
-  
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelFreezeOutGenerator, 1)
-#endif
-    
-};
-
-#endif
-
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelGausLCMSFreezeOutGenerator.cxx b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelGausLCMSFreezeOutGenerator.cxx
deleted file mode 100644
index 83db74d7406..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelGausLCMSFreezeOutGenerator.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelGausLCMSFreezeOutGenerator - freeze-out                     ///
-/// coordinates generator, generating a 3D gaussian ellipsoid in LCMS        ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelGausLCMSFreezeOutGenerator, 1)
-#endif
-
-#include "math.h"
-#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
-#include "AliFemtoModelHiddenInfo.h"
-#include "AliFemtoLorentzVector.h"
-
-//_______________________
-AliFemtoModelGausLCMSFreezeOutGenerator::AliFemtoModelGausLCMSFreezeOutGenerator() :
-  fSizeOut(0), fSizeSide(0), fSizeLong(0)
-{
-  // Default constructor
-  fRandom = new TRandom2();
-}
-
-//_______________________
-AliFemtoModelGausLCMSFreezeOutGenerator::AliFemtoModelGausLCMSFreezeOutGenerator(const AliFemtoModelGausLCMSFreezeOutGenerator &aModel):
-  fSizeOut(0), fSizeSide(0), fSizeLong(0)
-{
-  // Copy constructor
-  fRandom = new TRandom2();
-  SetSizeOut(aModel.GetSizeOut());
-  SetSizeSide(aModel.GetSizeSide());
-  SetSizeLong(aModel.GetSizeLong());
-}
-//_______________________
-AliFemtoModelGausLCMSFreezeOutGenerator::~AliFemtoModelGausLCMSFreezeOutGenerator()
-{
-  if (fRandom) delete fRandom;
-}
-//_______________________
-void AliFemtoModelGausLCMSFreezeOutGenerator::GenerateFreezeOut(AliFemtoPair *aPair)
-{
-  // Generate two particle emission points with respect
-  // to their pair momentum 
-  // The source is the 3D Gaussian ellipsoid in the LCMS frame
-  AliFemtoModelHiddenInfo *inf1 = (AliFemtoModelHiddenInfo *) aPair->track1()->HiddenInfo();
-  AliFemtoModelHiddenInfo *inf2 = (AliFemtoModelHiddenInfo *) aPair->track2()->HiddenInfo();
-
-  if ((!inf1) || (!inf2)) { cout << "Hidden info not created! "  << endl; exit(kFALSE); }
-
-  Double_t tPx = inf1->GetTrueMomentum()->x() + inf2->GetTrueMomentum()->x();
-  Double_t tPy = inf1->GetTrueMomentum()->y() + inf2->GetTrueMomentum()->y();
-  Double_t tPz = inf1->GetTrueMomentum()->z() + inf2->GetTrueMomentum()->z();
-  Double_t tM1 = inf1->GetMass();
-  Double_t tM2 = inf2->GetMass();
-  Double_t tE1 = sqrt(tM1*tM1 + inf1->GetTrueMomentum()->mag2());
-  Double_t tE2 = sqrt(tM2*tM2 + inf2->GetTrueMomentum()->mag2());
-  Double_t tEs = tE1 + tE2;
-
-  Double_t tPt = sqrt(tPx*tPx + tPy*tPy);
-
-  Double_t tRout = fRandom->Gaus(0.0, fSizeOut);
-  Double_t tRside = fRandom->Gaus(0.0, fSizeSide);
-  Double_t tRlong = fRandom->Gaus(0.0, fSizeLong);
-  
-  Double_t tXout = (tPx * tRout + tPy * tRside)/tPt;
-  Double_t tXside = (tPy * tRout - tPx * tRside)/tPt;
-
-  Double_t tBetaz = tPz/tEs;
-  Double_t tGammaz = 1.0/(1-tBetaz*tBetaz);
-  
-  Double_t tXlong = tGammaz * (tRlong + tBetaz * 0);
-  Double_t tXtime = tGammaz * (0 + tBetaz * tRlong);
-  
-  if (!(inf1->GetEmissionPoint())) {
-    AliFemtoLorentzVector *tPos = new AliFemtoLorentzVector(0,0,0,0);
-    inf1->SetEmissionPoint(tPos);
-  }
-  else
-    inf1->SetEmissionPoint(0,0,0,0);
-  if (!(inf2->GetEmissionPoint())) {
-    AliFemtoLorentzVector *tPos = new AliFemtoLorentzVector(tXout,tXside,tXlong,tXtime);
-    inf2->SetEmissionPoint(tPos);
-  }
-  else
-    inf2->SetEmissionPoint(tXout, tXside, tXlong, tXtime);
-}
-
-//_______________________
-void AliFemtoModelGausLCMSFreezeOutGenerator::SetSizeOut(Double_t aSizeOut)
-{
-  fSizeOut = aSizeOut;
-}
-//_______________________
-void AliFemtoModelGausLCMSFreezeOutGenerator::SetSizeSide(Double_t aSizeSide)
-{
-  fSizeSide = aSizeSide;
-}
-//_______________________
-void AliFemtoModelGausLCMSFreezeOutGenerator::SetSizeLong(Double_t aSizeLong)
-{
-  fSizeLong = aSizeLong;
-}
-
-//_______________________
-Double_t AliFemtoModelGausLCMSFreezeOutGenerator::GetSizeOut() const
-{
-  return fSizeOut;
-}
-//_______________________
-Double_t AliFemtoModelGausLCMSFreezeOutGenerator::GetSizeSide() const
-{
-  return fSizeSide;
-}
-//_______________________
-Double_t AliFemtoModelGausLCMSFreezeOutGenerator::GetSizeLong() const
-{
-  return fSizeLong;
-}
-//_______________________
-AliFemtoModelFreezeOutGenerator* AliFemtoModelGausLCMSFreezeOutGenerator::Clone() const
-{ 
-  return GetGenerator(); 
-}
-//_______________________
-AliFemtoModelFreezeOutGenerator* AliFemtoModelGausLCMSFreezeOutGenerator::GetGenerator() const 
-{ 
-  AliFemtoModelFreezeOutGenerator* tModel = new AliFemtoModelGausLCMSFreezeOutGenerator(*this); return tModel; 
-}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelGausLCMSFreezeOutGenerator.h b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelGausLCMSFreezeOutGenerator.h
deleted file mode 100644
index 198a9c5a427..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelGausLCMSFreezeOutGenerator.h
+++ /dev/null
@@ -1,49 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelGausLCMSFreezeOutGenerator - freeze-out                     ///
-/// coordinates generator, generating a 3D gaussian ellipsoid in LCMS        ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelGausLCMSFreezeOutGenerator_hh
-#define AliFemtoModelGausLCMSFreezeOutGenerator_hh
-
-#include "Model/AliFemtoModelFreezeOutGenerator.h"
-
-#include "TRandom.h"
-
-class AliFemtoModelGausLCMSFreezeOutGenerator : public AliFemtoModelFreezeOutGenerator
-{
- public:
-  AliFemtoModelGausLCMSFreezeOutGenerator();
-  AliFemtoModelGausLCMSFreezeOutGenerator(const AliFemtoModelGausLCMSFreezeOutGenerator &aModel);
-  virtual ~AliFemtoModelGausLCMSFreezeOutGenerator();
-  virtual void GenerateFreezeOut(AliFemtoPair *aPair);;
-
-  void SetSizeOut(Double_t aSizeOut);
-  void SetSizeSide(Double_t aSizeSide);
-  void SetSizeLong(Double_t aSizeLong);
-  
-  Double_t GetSizeOut() const;
-  Double_t GetSizeSide() const;
-  Double_t GetSizeLong() const;
-
-  virtual AliFemtoModelFreezeOutGenerator* Clone() const;
-
- protected:
-  Double_t fSizeOut;
-  Double_t fSizeSide;
-  Double_t fSizeLong;
-
- private:
-  AliFemtoModelFreezeOutGenerator* GetGenerator() const;
-		
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelGausLCMSFreezeOutGenerator, 1)
-#endif
-
-    };
-  
-#endif
-
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelHiddenInfo.cxx b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelHiddenInfo.cxx
deleted file mode 100644
index a5136f258ff..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelHiddenInfo.cxx
+++ /dev/null
@@ -1,151 +0,0 @@
-#include "AliFemtoModelHiddenInfo.h"
-
-//_____________________________________________
-AliFemtoModelHiddenInfo::AliFemtoModelHiddenInfo() :
-  fTrueMomentum(0),
-  fEmissionPoint(0),
-  fPDGPid(0),
-  fMass(0)
-{
-};
-//_____________________________________________
-AliFemtoModelHiddenInfo::AliFemtoModelHiddenInfo(const AliFemtoModelHiddenInfo &aInfo) :
-  fTrueMomentum(0),
-  fEmissionPoint(0),
-  fPDGPid(0),
-  fMass(0)
-{
-  if (aInfo.GetTrueMomentum())
-    SetTrueMomentum(aInfo.GetTrueMomentum());
-  if (aInfo.GetEmissionPoint())
-    SetEmissionPoint(aInfo.GetEmissionPoint());
-  fPDGPid = aInfo.GetPDGPid();
-  fMass = aInfo.GetMass();
-}
-//_____________________________________________
-AliFemtoModelHiddenInfo::~AliFemtoModelHiddenInfo()
-{
-  if (fTrueMomentum) delete fTrueMomentum;
-  if (fEmissionPoint) delete fEmissionPoint;
-}
-//_____________________________________________
-AliFemtoModelHiddenInfo& AliFemtoModelHiddenInfo::operator=(const AliFemtoModelHiddenInfo& aInfo)
-{
-  if (this == &aInfo)
-    return *this;
-
-  if (aInfo.GetTrueMomentum())
-    SetTrueMomentum(aInfo.GetTrueMomentum());
-  else SetTrueMomentum(0);
-  if (aInfo.GetEmissionPoint())
-    SetEmissionPoint(aInfo.GetEmissionPoint());
-  else SetEmissionPoint(0);
-  fPDGPid = aInfo.GetPDGPid();
-  fMass = aInfo.GetMass();
-
-  return *this;
-}
-//_____________________________________________
-AliFemtoThreeVector   *AliFemtoModelHiddenInfo::GetTrueMomentum() const
-{
-  return fTrueMomentum;
-}
-//_____________________________________________
-AliFemtoLorentzVector *AliFemtoModelHiddenInfo::GetEmissionPoint() const
-{
-  return fEmissionPoint;
-}
-//_____________________________________________
-Int_t                  AliFemtoModelHiddenInfo::GetPDGPid() const
-{
-  return fPDGPid;
-}
-//_____________________________________________
-Double_t                  AliFemtoModelHiddenInfo::GetMass() const
-{
-  return fMass;
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetTrueMomentum(AliFemtoThreeVector *aMom)
-{
-  if (fTrueMomentum) {
-    fTrueMomentum->setX(aMom->x());
-    fTrueMomentum->setY(aMom->y());
-    fTrueMomentum->setZ(aMom->z());
-  }
-  else {
-    fTrueMomentum = new AliFemtoThreeVector(*aMom);
-  }
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetTrueMomentum(const AliFemtoThreeVector& aMom)
-{
-  if (fTrueMomentum) {
-    fTrueMomentum->setX(aMom.x());
-    fTrueMomentum->setY(aMom.y());
-    fTrueMomentum->setZ(aMom.z());
-  }
-  else {
-    fTrueMomentum = new AliFemtoThreeVector();
-    *fTrueMomentum = aMom;
-  }
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetTrueMomentum(Double_t aPx, Double_t aPy, Double_t aPz)
-{
-  if (!fTrueMomentum) fTrueMomentum = new AliFemtoThreeVector();
-    fTrueMomentum->setX(aPx);
-    fTrueMomentum->setY(aPy);
-    fTrueMomentum->setZ(aPz);
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetEmissionPoint(AliFemtoLorentzVector *aPos)
-{
-  if (fEmissionPoint) {
-    fEmissionPoint->setX(aPos->px());
-    fEmissionPoint->setY(aPos->py());
-    fEmissionPoint->setZ(aPos->pz());
-    fEmissionPoint->setT(aPos->e());
-  }
-  else {
-    fEmissionPoint = new AliFemtoLorentzVector(*aPos);
-  }
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetEmissionPoint(const AliFemtoLorentzVector& aPos)
-{
-  if (fEmissionPoint) {
-    fEmissionPoint->setX(aPos.px());
-    fEmissionPoint->setY(aPos.py());
-    fEmissionPoint->setZ(aPos.pz());
-    fEmissionPoint->setT(aPos.e());
-  }
-  else {
-    fEmissionPoint = new AliFemtoLorentzVector();
-    *fEmissionPoint = aPos;
-  }
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetPDGPid(Int_t aPid)
-{
-  fPDGPid = aPid;
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetMass(Double_t aMass)
-{
-  fMass = aMass;
-}
-//_____________________________________________
-void                   AliFemtoModelHiddenInfo::SetEmissionPoint(Double_t aRx, Double_t aRy, Double_t aRz, Double_t aT)
-{
-  fEmissionPoint->setX(aRx);
-  fEmissionPoint->setY(aRy);
-  fEmissionPoint->setZ(aRz);
-  fEmissionPoint->setT(aT);
-}
-//_____________________________________________
- AliFemtoHiddenInfo* AliFemtoModelHiddenInfo::getParticleHiddenInfo() const
-{
-  AliFemtoModelHiddenInfo* tBuf = new AliFemtoModelHiddenInfo(*this);
-  return tBuf;
-}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelHiddenInfo.h b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelHiddenInfo.h
deleted file mode 100644
index d707373efe4..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelHiddenInfo.h
+++ /dev/null
@@ -1,57 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelHiddenInfo - the hidden info for model calculations         ///
-/// Stores information needed for the weight generation - the true           ///
-/// simulated momenta, freeze-out coordinates from model and particle PID    ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-
-#ifndef AliFemtoModelHiddenInfo_hh
-#define AliFemtoModelHiddenInfo_hh
-
-#include 
-#include "Infrastructure/AliFemtoTypes.h"
-#include "Infrastructure/AliFemtoThreeVector.h"
-#include "Infrastructure/AliFemtoLorentzVector.h"
-#include "Base/AliFemtoHiddenInfo.h"
-
-class AliFemtoModelHiddenInfo : public AliFemtoHiddenInfo{
-
-public:
-  AliFemtoModelHiddenInfo();
-  AliFemtoModelHiddenInfo(const AliFemtoModelHiddenInfo &aInfo);
-  virtual ~AliFemtoModelHiddenInfo();
-
-  AliFemtoModelHiddenInfo& operator=(const AliFemtoModelHiddenInfo& aInfo);
-  AliFemtoThreeVector   *GetTrueMomentum() const;
-  AliFemtoLorentzVector *GetEmissionPoint() const;
-  Int_t                  GetPDGPid() const;
-  Double_t               GetMass() const;
-
-  void                   SetTrueMomentum(AliFemtoThreeVector *aMom);
-  void                   SetTrueMomentum(const AliFemtoThreeVector& aMom);
-  void                   SetTrueMomentum(Double_t aPx, Double_t aPy, Double_t aPz);
-  void                   SetEmissionPoint(AliFemtoLorentzVector *aPos);
-  void                   SetEmissionPoint(const AliFemtoLorentzVector& aPos);
-  void                   SetEmissionPoint(Double_t aRx, Double_t aRy, Double_t aRz, Double_t aT);
-  void                   SetPDGPid(Int_t aPid);
-  void                   SetMass(Double_t aMass);
-
-// !!! MANDATORY !!!
-// --- Copy the hidden info from AliFemtoTrack to AliFemtoParticle
-  virtual AliFemtoHiddenInfo* getParticleHiddenInfo() const;
-  virtual AliFemtoHiddenInfo* clone() const;
-
- protected:
-  AliFemtoThreeVector   *fTrueMomentum;  // True (simulated) momentum
-  AliFemtoLorentzVector *fEmissionPoint; // Emission point coordinates
-  Int_t                  fPDGPid;        // True PID of the particle
-  Double_t               fMass;
-};
-//_______________________________________
-inline AliFemtoHiddenInfo* AliFemtoModelHiddenInfo::clone() const{
-  // return exact copy of this hidden info
-  return getParticleHiddenInfo();
-}
-
-#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelManager.cxx b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelManager.cxx
deleted file mode 100644
index 541a4633396..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelManager.cxx
+++ /dev/null
@@ -1,108 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelManager - main helper class for femtoscopy calculations     ///
-/// Manages weight generation, freeze-out coordinates generation             ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelManager, 1)
-#endif
-
-#include "AliFemtoModelManager.h"
-#include "AliFemtoModelHiddenInfo.h"
-
-//_____________________________________________
-AliFemtoModelManager::AliFemtoModelManager():
-  fFreezeOutGenerator(0),
-  fWeightGenerator(0),
-  fCreateCopyHiddenInfo(kFALSE)
-{
-}
-//_____________________________________________
-AliFemtoModelManager::AliFemtoModelManager(const AliFemtoModelManager& aManager):
-  fFreezeOutGenerator(0),
-  fWeightGenerator(0),
-  fCreateCopyHiddenInfo(aManager.fCreateCopyHiddenInfo)
-{
-  if (aManager.fFreezeOutGenerator) {
-    fFreezeOutGenerator = aManager.fFreezeOutGenerator->Clone();
-  }
-  if (aManager.fWeightGenerator) {
-    fWeightGenerator = aManager.fWeightGenerator->Clone();
-  }
-}
-//_____________________________________________
-AliFemtoModelManager::~AliFemtoModelManager()
-{
-  if (fFreezeOutGenerator) delete fFreezeOutGenerator;
-  if (fWeightGenerator) delete fWeightGenerator;
-}
-//_____________________________________________
-AliFemtoModelManager& AliFemtoModelManager::operator=(const AliFemtoModelManager& aManager)
-{
-  if (this == &aManager)
-    return *this;
-  if (aManager.fFreezeOutGenerator) {
-    fFreezeOutGenerator = aManager.fFreezeOutGenerator->Clone();
-  }
-  else fFreezeOutGenerator = 0;
-  if (aManager.fWeightGenerator) {
-    fWeightGenerator = aManager.fWeightGenerator->Clone();
-  }
-  else fWeightGenerator = 0;
-  fCreateCopyHiddenInfo = aManager.fCreateCopyHiddenInfo;
-  
-  return *this;
-}
-//_____________________________________________
-void AliFemtoModelManager::AcceptFreezeOutGenerator(AliFemtoModelFreezeOutGenerator *aFreeze)
-{
-  fFreezeOutGenerator = aFreeze;
-}
-//_____________________________________________
-void AliFemtoModelManager::AcceptWeightGenerator(AliFemtoModelWeightGenerator *aWeight)
-{
-  fWeightGenerator = aWeight;
-}
-//_____________________________________________
-Double_t AliFemtoModelManager::GetWeight(AliFemtoPair *aPair)
-{
-  // Return femtoscopic weight for a fiven pair
-  if (fCreateCopyHiddenInfo) {
-    if (!(aPair->track1()->HiddenInfo())) {
-      AliFemtoModelHiddenInfo *inf1 = new AliFemtoModelHiddenInfo();
-      inf1->SetTrueMomentum(aPair->track1()->Track()->P());
-      inf1->SetMass(0.13957);
-      aPair->track1()->SetHiddenInfo(inf1);
-      delete inf1;
-    }
-    if (!(aPair->track2()->HiddenInfo())) {
-      AliFemtoModelHiddenInfo *inf2 = new AliFemtoModelHiddenInfo();
-      inf2->SetTrueMomentum(aPair->track2()->Track()->P());
-      inf2->SetMass(0.13957);
-      aPair->track2()->SetHiddenInfo(inf2);
-      delete inf2;
-    }
-  }
-
-  if (fFreezeOutGenerator) {
-    fFreezeOutGenerator->GenerateFreezeOut(aPair);
-  }
-  return fWeightGenerator->GenerateWeight(aPair);
-}
-//_____________________________________________
-void AliFemtoModelManager::CreateCopyHiddenInfo()
-{
-  fCreateCopyHiddenInfo = kTRUE;
-}
-//_____________________________________________
-AliFemtoModelFreezeOutGenerator* AliFemtoModelManager::GetFreezeOutGenerator()
-{
-  return fFreezeOutGenerator;
-}
-//_____________________________________________
-AliFemtoModelWeightGenerator*    AliFemtoModelManager::GetWeightGenerator()
-{
-  return fWeightGenerator;
-}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelManager.h b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelManager.h
deleted file mode 100644
index dcd5efd77fb..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelManager.h
+++ /dev/null
@@ -1,48 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelManager - main helper class for femtoscopy calculations     ///
-/// Manages weight generation, freeze-out coordinates generation             ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelManager_hh
-#define AliFemtoModelManager_hh
-
-#include "Infrastructure/AliFemtoEnumeration.h"
-#include "AliFemtoModelWeightGenerator.h"
-#include "AliFemtoModelFreezeOutGenerator.h"
-
-class AliFemtoModelManager 
-{
- public:
-  AliFemtoModelManager();
-  AliFemtoModelManager(const AliFemtoModelManager& aManager);
-  virtual  ~AliFemtoModelManager();
-
-  AliFemtoModelManager& operator=(const AliFemtoModelManager& aManager);
-
-  void AcceptFreezeOutGenerator(AliFemtoModelFreezeOutGenerator *aFreeze);
-  void AcceptWeightGenerator(AliFemtoModelWeightGenerator *aWeight);
-  void CreateCopyHiddenInfo();
-
-  AliFemtoModelFreezeOutGenerator* GetFreezeOutGenerator();
-  AliFemtoModelWeightGenerator*    GetWeightGenerator();
-
-  virtual Double_t GetWeight(AliFemtoPair *aPair);
-  
- protected:
-  AliFemtoModelFreezeOutGenerator *fFreezeOutGenerator;   // Freeze-out coordinates generator
-  AliFemtoModelWeightGenerator    *fWeightGenerator;      // Femtoscopic weight generator
-  Bool_t                           fCreateCopyHiddenInfo; // Switch to turn on hidden-info generation
-
- private:
-		
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelManager, 1)
-#endif
-
-    };
-  
-#endif
-
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGenerator.cxx b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGenerator.cxx
deleted file mode 100644
index 42432791744..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGenerator.cxx
+++ /dev/null
@@ -1,107 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelWeightGenerator - abstract base class for femtoscopic       ///
-/// weight generator                                                         ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelGausLCMSFreezeOutGenerator, 1)
-#endif
-
-#include "AliFemtoModelWeightGenerator.h"
-#include "AliFemtoModelHiddenInfo.h"
-
-const Int_t AliFemtoModelWeightGenerator::kPionPlusPionPlus = 1;
-const Int_t AliFemtoModelWeightGenerator::kPionPlusPionMinus = 2;
-const Int_t AliFemtoModelWeightGenerator::kKaonPlusKaonPlus = 3;
-const Int_t AliFemtoModelWeightGenerator::kKaonPlusKaonMinus = 4;
-const Int_t AliFemtoModelWeightGenerator::kProtonProton = 5;
-const Int_t AliFemtoModelWeightGenerator::kProtonAntiproton = 6;
-const Int_t AliFemtoModelWeightGenerator::kPionPlusKaonPlus = 7;
-const Int_t AliFemtoModelWeightGenerator::kPionPlusKaonMinus = 8;
-const Int_t AliFemtoModelWeightGenerator::kPionPlusProton = 9;
-const Int_t AliFemtoModelWeightGenerator::kPionPlusAntiproton = 10;
-const Int_t AliFemtoModelWeightGenerator::kKaonPlusProton = 11;
-const Int_t AliFemtoModelWeightGenerator::kKaonPlusAntiproton = 12;
-
-//_____________________________________________
-AliFemtoModelWeightGenerator::AliFemtoModelWeightGenerator() :
-  fPairType(0), 
-  fKStarOut(0), fKStarSide(0), fKStarLong(0), fKStar(0), 
-  fRStarOut(0), fRStarSide(0), fRStarLong(0), fRStar(0)
-{}
-//_____________________________________________
-AliFemtoModelWeightGenerator::AliFemtoModelWeightGenerator(const AliFemtoModelWeightGenerator &aModel) :
-  fPairType(0), 
-  fKStarOut(0), fKStarSide(0), fKStarLong(0), fKStar(0), 
-  fRStarOut(0), fRStarSide(0), fRStarLong(0), fRStar(0)
-{
-  fPairType = aModel.fPairType;
-}
-//_____________________________________________
-AliFemtoModelWeightGenerator::~AliFemtoModelWeightGenerator(){/* no-op */}
-//_____________________________________________
-void     AliFemtoModelWeightGenerator::SetPairType(Int_t aPairType)
-{
-  fPairType = aPairType;
-}
-
-//_____________________________________________
-Int_t    AliFemtoModelWeightGenerator::GetPairType()
-{
-  return fPairType;
-}
-
-//_____________________________________________
-void     AliFemtoModelWeightGenerator::SetPairTypeFromPair(AliFemtoPair *aPair)
-{
-  AliFemtoModelHiddenInfo *inf1 = ( AliFemtoModelHiddenInfo *) aPair->track1()->HiddenInfo();
-  AliFemtoModelHiddenInfo *inf2 = ( AliFemtoModelHiddenInfo *) aPair->track2()->HiddenInfo();
-
-  const Int_t tPid1 = inf1->GetPDGPid();
-  const Int_t tPid2 = inf2->GetPDGPid();
-
-  if      (((tPid1 ==   211) && (tPid2 ==   211)) ||
-           ((tPid1 ==  -211) && (tPid2 ==  -211)))
-    fPairType = kPionPlusPionPlus;
-  else if (((tPid1 ==  -211) && (tPid2 ==   211)) ||
-           ((tPid1 ==   211) && (tPid2 ==  -211)))
-    fPairType = kPionPlusPionMinus;
-  else if (((tPid1 ==   321) && (tPid2 ==   321)) ||
-           ((tPid1 ==  -321) && (tPid2 ==  -321)))
-    fPairType = kKaonPlusKaonPlus;
-  else if (((tPid1 ==  -321) && (tPid2 ==   321)) ||
-           ((tPid1 ==   321) && (tPid2 ==  -321)))
-    fPairType = kKaonPlusKaonMinus;
-  else if (((tPid1 ==  2212) && (tPid2 ==  2212)) ||
-           ((tPid1 == -2212) && (tPid2 == -2212)))
-    fPairType = kProtonProton;
-  else if (((tPid1 == -2212) && (tPid2 ==  2212)) ||
-           ((tPid1 ==  2212) && (tPid2 == -2212)))
-    fPairType = kProtonAntiproton;
-  else if (((tPid1 ==   211) && (tPid2 ==   321)) ||
-           ((tPid1 ==  -211) && (tPid2 ==  -321)))
-    fPairType = kPionPlusKaonPlus;
-  else if (((tPid1 ==  -211) && (tPid2 ==   321)) ||
-           ((tPid1 ==   211) && (tPid2 ==  -321)))
-    fPairType = kPionPlusKaonMinus;
-  else if (((tPid1 ==   211) && (tPid2 ==  2212)) ||
-           ((tPid1 ==  -211) && (tPid2 == -2212)))
-    fPairType = kPionPlusProton;
-  else if (((tPid1 ==  -211) && (tPid2 ==  2212)) ||
-           ((tPid1 ==   211) && (tPid2 == -2212)))
-    fPairType = kPionPlusAntiproton;
-  else if (((tPid1 ==   321) && (tPid2 ==  2212)) ||
-           ((tPid1 ==  -321) && (tPid2 == -2212)))
-    fPairType = kKaonPlusProton;
-  else if (((tPid1 ==  -321) && (tPid2 ==  2212)) ||
-           ((tPid1 ==   321) && (tPid2 == -2212)))
-    fPairType = kKaonPlusAntiproton;
-}
-
-//_____________________________________________
-AliFemtoModelWeightGenerator* AliFemtoModelWeightGenerator::Clone() const
-{
-  return 0;
-}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGenerator.h b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGenerator.h
deleted file mode 100644
index e6a6520684a..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGenerator.h
+++ /dev/null
@@ -1,82 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelWeightGenerator - abstract base class for femtoscopic       ///
-/// weight generator                                                         ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelWeightGenerator_hh
-#define AliFemtoModelWeightGenerator_hh
-
-#include "TRandom2.h"
-#include "AliFemtoPair.h"
-
-class AliFemtoModelWeightGenerator 
-{
- public:
-  AliFemtoModelWeightGenerator();
-  AliFemtoModelWeightGenerator(const AliFemtoModelWeightGenerator &aModel);
-  virtual ~AliFemtoModelWeightGenerator();
-  virtual Double_t GenerateWeight(AliFemtoPair *aPair) = 0;
-
-  virtual void     SetPairType(Int_t aPairType);
-  virtual void     SetPairTypeFromPair(AliFemtoPair *aPair);
-  virtual Int_t    GetPairType();
-
-  virtual Double_t GetKStar();
-  virtual Double_t GetKStarOut();
-  virtual Double_t GetKStarSide();
-  virtual Double_t GetKStarLong();
-  virtual Double_t GetRStar();
-  virtual Double_t GetRStarOut();
-  virtual Double_t GetRStarSide();
-  virtual Double_t GetRStarLong();
-
-  virtual AliFemtoModelWeightGenerator* Clone() const;
-
-  static const Int_t kPionPlusPionPlus;
-  static const Int_t kPionPlusPionMinus;
-  static const Int_t kKaonPlusKaonPlus;
-  static const Int_t kKaonPlusKaonMinus;
-  static const Int_t kProtonProton;
-  static const Int_t kProtonAntiproton;
-  static const Int_t kPionPlusKaonPlus;
-  static const Int_t kPionPlusKaonMinus;
-  static const Int_t kPionPlusProton;
-  static const Int_t kPionPlusAntiproton;
-  static const Int_t kKaonPlusProton;
-  static const Int_t kKaonPlusAntiproton;
-
- protected:
-  Int_t fPairType;
-
-  Double_t fKStarOut;  // relative momentum out component in PRF
-  Double_t fKStarSide; // relative momentum side component in PRF
-  Double_t fKStarLong; // relative momentum long component in PRF
-  Double_t fKStar;     // relative momentum magnitude
-
-  Double_t fRStarOut;  // relative separation out component in PRF
-  Double_t fRStarSide; // relative separation side component in PRF
-  Double_t fRStarLong; // relative separation long component in PRF
-  Double_t fRStar;     // relative separation magnitude
- private:
-  
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelWeightGenerator, 1)
-#endif
-
-    };
-  
-inline Double_t AliFemtoModelWeightGenerator::GetKStar() { return fKStar; }
-inline Double_t AliFemtoModelWeightGenerator::GetKStarOut() { return fKStarOut; }
-inline Double_t AliFemtoModelWeightGenerator::GetKStarSide() { return fKStarSide; }
-inline Double_t AliFemtoModelWeightGenerator::GetKStarLong() { return fKStarLong; }
-inline Double_t AliFemtoModelWeightGenerator::GetRStar() { return fRStar; }
-inline Double_t AliFemtoModelWeightGenerator::GetRStarOut() { return fRStarOut; }
-inline Double_t AliFemtoModelWeightGenerator::GetRStarSide() { return fRStarSide; }
-inline Double_t AliFemtoModelWeightGenerator::GetRStarLong() { return fRStarLong; }
-
-
-#endif
-
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGeneratorBasic.cxx b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGeneratorBasic.cxx
deleted file mode 100644
index 70e03aeca9f..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGeneratorBasic.cxx
+++ /dev/null
@@ -1,179 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelWeightGeneratorBasic -  basic femtoscopic weight generator  ///
-/// only return a simple                                                          ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelWeightGeneratorBasic, 1)
-#endif
-
-#include "AliFemtoModelWeightGeneratorBasic.h"
-#include "AliFemtoModelHiddenInfo.h"
-
-//________________________
-AliFemtoModelWeightGeneratorBasic::AliFemtoModelWeightGeneratorBasic():
-  AliFemtoModelWeightGenerator()
-{
-  /* no-op */
-}
-//________________________
-AliFemtoModelWeightGeneratorBasic::AliFemtoModelWeightGeneratorBasic(const AliFemtoModelWeightGeneratorBasic &aModel) :
-  AliFemtoModelWeightGenerator(aModel)
-{
-  /* no-op */
-}
-
-//________________________
-AliFemtoModelWeightGeneratorBasic::~AliFemtoModelWeightGeneratorBasic()
-{
-  /* no-op */
-}
-
-//________________________
-Double_t AliFemtoModelWeightGeneratorBasic::GenerateWeight(AliFemtoPair *aPair)
-{
-  // Generate a simple femtoscopic weight coming only from 
-  // quantum statistics - symmetrization or anti-symmetrization
-  // of the pair wave function
-
-  // Get hidden information pointers
-  AliFemtoModelHiddenInfo *inf1 = (AliFemtoModelHiddenInfo *) aPair->track1()->HiddenInfo();
-  AliFemtoModelHiddenInfo *inf2 = (AliFemtoModelHiddenInfo *) aPair->track2()->HiddenInfo();
-
-  // Calculate pair variables
-  Double_t tPx = inf1->GetTrueMomentum()->x()+inf2->GetTrueMomentum()->x();
-  Double_t tPy = inf1->GetTrueMomentum()->y()+inf2->GetTrueMomentum()->y();
-  Double_t tPz = inf1->GetTrueMomentum()->z()+inf2->GetTrueMomentum()->z();
-  //  double tE  = inf1->GetTrueMomentum()->e +inf2->GetTrueMomentum()->.e;
-  Double_t tM1 = inf1->GetMass();
-  Double_t tM2 = inf2->GetMass();
-  Double_t tE1 = sqrt(tM1*tM1 + inf1->GetTrueMomentum()->mag2());
-  Double_t tE2 = sqrt(tM2*tM2 + inf2->GetTrueMomentum()->mag2());
-  Double_t tE  = tE1 + tE2;
-  Double_t tPt = tPx*tPx + tPy*tPy;
-  Double_t tMt = tE*tE - tPz*tPz;//mCVK;
-  Double_t tM  = sqrt(tMt - tPt);
-  tMt = sqrt(tMt);
-  tPt = sqrt(tPt);
-  Double_t tBetat = tPt/tMt;
-
-  // Boost to LCMS
-  Double_t tBeta = tPz/tE;
-  Double_t tGamma = tE/tMt;	    
-  fKStarLong = tGamma * (inf1->GetTrueMomentum()->z() - tBeta * tE1);
-  Double_t tE1L = tGamma * (tE1  - tBeta * inf1->GetTrueMomentum()->z());
-  
-  // Transform positions to LCMS
-//   Double_t tP1zl = tGamma * (inf1->GetEmissionPoint()->z() - tBeta * inf1->GetEmissionPoint()->t());
-//   Double_t tP1tl = tGamma * (inf1->GetEmissionPoint()->t() - tBeta * inf1->GetEmissionPoint()->z());
-  
-//   Double_t tP2zl = tGamma * (inf2->GetEmissionPoint()->z() - tBeta * inf2->GetEmissionPoint()->t());
-//   Double_t tP2tl = tGamma * (inf2->GetEmissionPoint()->t() - tBeta * inf2->GetEmissionPoint()->z());
-  
-//   Double_t tP1pzl = tGamma * (inf1->GetTrueMomentum()->z() - tBeta * tE1);
-//   Double_t tP1el  = tGamma * (tE1  - tBeta * inf1->GetTrueMomentum()->z());
-  
-//   Double_t tP2pzl = tGamma * (inf2->GetTrueMomentum()->z() - tBeta * tE2);
-//   Double_t tP2el  = tGamma * (tE2  - tBeta * inf2->GetTrueMomentum()->z());
-  
-  // Rotate in transverse plane
-  fKStarOut  = ( inf1->GetTrueMomentum()->x()*tPx + inf1->GetTrueMomentum()->y()*tPy)/tPt;
-  fKStarSide = (-inf1->GetTrueMomentum()->x()*tPy + inf1->GetTrueMomentum()->y()*tPx)/tPt;
-      
-//   Double_t tP1pxl = fKStarOut;
-//   Double_t tP1pyl = fKStarSide;
-  
-//   Double_t tP2pxl = (inf2->GetTrueMomentum()->x()*tPx + inf2->GetTrueMomentum()->y()*tPy)/tPt;
-//   Double_t tP2pyl = (inf2->GetTrueMomentum()->y()*tPx - inf2->GetTrueMomentum()->x()*tPy)/tPt;;
-  
-//   Double_t tKO = tP1pxl - tP2pxl;
-//   Double_t tKS = tP1pyl - tP2pyl;
-//   Double_t tKL = tP1pzl - tP2pzl;
-//   Double_t tDE = tP1el  - tP2el;
-  
-  // save the rotated coordinates in LCMS variables
-//   Double_t tP1xl = ( inf1->GetEmissionPoint()->x()*tPx + inf1->GetEmissionPoint()->y()*tPy)/tPt;
-//   Double_t tP1yl = (-inf1->GetEmissionPoint()->x()*tPy + inf1->GetEmissionPoint()->y()*tPx)/tPt;
-
-//   Double_t tP2xl = ( inf2->GetEmissionPoint()->x()*tPx + inf2->GetEmissionPoint()->y()*tPy)/tPt;
-//   Double_t tP2yl = (-inf2->GetEmissionPoint()->x()*tPy + inf2->GetEmissionPoint()->y()*tPx)/tPt;
-  
-  // Boost to pair cms
-  fKStarOut = tMt/tM * (fKStarOut - tPt/tMt * tE1L);
-  
-  tBetat = tPt/tMt;
-//   Double_t tGammat = 1.0/sqrt(1.0-tBetat*tBetat);
-  
-//   Double_t tP1xp = tGammat*(tP1xl - tBetat*tP1tl);
-//   Double_t tP1tp = tGammat*(tP1tl - tBetat*tP1xl);
-  
-//   Double_t tP2xp = tGammat*(tP2xl - tBetat*tP2tl);
-//   Double_t tP2tp = tGammat*(tP2tl - tBetat*tP2xl);
-  
-//   Double_t tRO = (tP1xl - tP2xl)/0.197327;
-//   Double_t tRS = (tP1yl - tP2yl)/0.197327;
-//   Double_t tRL = (tP1zl - tP2zl)/0.197327;
-//   Double_t tDT = (tP1tl - tP2tl)/0.197327;
-  
-  Double_t tDX = inf1->GetEmissionPoint()->x()-inf2->GetEmissionPoint()->x();
-  Double_t tDY = inf1->GetEmissionPoint()->y()-inf2->GetEmissionPoint()->y();
-  Double_t tRLong = inf1->GetEmissionPoint()->z()-inf2->GetEmissionPoint()->z();
-  Double_t tDTime = inf1->GetEmissionPoint()->t()-inf2->GetEmissionPoint()->t();
-
-  Double_t tROut = (tDX*tPx + tDY*tPy)/tPt;
-  Double_t tRSide = (-tDX*tPy + tDY*tPx)/tPt;
-
-  fRStarSide = tRSide;
-  Double_t tRSS = fRStarSide/0.197327;
-
-  fRStarLong = tGamma*(tRLong - tBeta* tDTime);
-  Double_t tDTimePairLCMS = tGamma*(tDTime - tBeta* tRLong);
-
-  Double_t tRLS = fRStarLong/0.197327;
-  tBeta = tPt/tMt;
-  tGamma = tMt/tM;
-
-  fRStarOut = tGamma*(tROut - tBeta* tDTimePairLCMS);
-  Double_t tROS = fRStarOut/0.197327;
-//   Double_t tDTimePairCMS = tGamma*(tDTimePairLCMS - tBeta* tROut);
-  fRStar = ::sqrt(fRStarOut*fRStarOut + fRStarSide*fRStarSide +
-			   fRStarLong*fRStarLong);
-  fKStar = ::sqrt(fKStarOut*fKStarOut + fKStarSide*fKStarSide + fKStarLong*fKStarLong);
-//   Double_t tRSt = fRStar/0.197327;
-
-  if ((fPairType == kPionPlusPionPlus) || (fPairType == kKaonPlusKaonPlus))
-    return 1.0 + cos (2*(fKStarOut * tROS + fKStarSide * tRSS + fKStarLong * tRLS));
-  else if (fPairType == kProtonProton)
-    return 1.0 - 0.5 * cos (2*(fKStarOut * tROS + fKStarSide * tRSS + fKStarLong * tRLS));
-  else 
-    return 1.0;
-}
-
-//________________________
-void     AliFemtoModelWeightGeneratorBasic::SetPairType(Int_t aPairType)
-{
-  AliFemtoModelWeightGenerator::SetPairType(aPairType);
-}
-//________________________
-void     AliFemtoModelWeightGeneratorBasic::SetPairTypeFromPair(AliFemtoPair *aPair)
-{
-  AliFemtoModelWeightGenerator::SetPairTypeFromPair(aPair);
-}
-//________________________
-Int_t    AliFemtoModelWeightGeneratorBasic::GetPairType()
-{
-  return AliFemtoModelWeightGenerator::GetPairType();
-}
-//________________________
-AliFemtoModelWeightGenerator* AliFemtoModelWeightGeneratorBasic::Clone() const
-{
-  return GetGenerator();
-}
-//________________________
-AliFemtoModelWeightGenerator* AliFemtoModelWeightGeneratorBasic::GetGenerator() const
-{
-  AliFemtoModelWeightGeneratorBasic *tGen = new AliFemtoModelWeightGeneratorBasic(*this);
-  return tGen;
-}
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGeneratorBasic.h b/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGeneratorBasic.h
deleted file mode 100644
index def791b06e8..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGeneratorBasic.h
+++ /dev/null
@@ -1,41 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelWeightGeneratorBasic -  basic femtoscopic weight generator  ///
-/// only return a simple                                                          ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelWeightGeneratorBasic_hh
-#define AliFemtoModelWeightGeneratorBasic_hh
-
-#include "TRandom2.h"
-#include "AliFemtoPair.h"
-#include "AliFemtoModelWeightGenerator.h"
-
-class AliFemtoModelWeightGeneratorBasic : public AliFemtoModelWeightGenerator
-{
- public:
-  AliFemtoModelWeightGeneratorBasic();
-  AliFemtoModelWeightGeneratorBasic(const AliFemtoModelWeightGeneratorBasic &aModel);
-  virtual ~AliFemtoModelWeightGeneratorBasic();
-  virtual Double_t GenerateWeight(AliFemtoPair *aPair);
-
-  virtual void     SetPairType(Int_t aPairType);
-  virtual void     SetPairTypeFromPair(AliFemtoPair *aPair);
-  virtual Int_t    GetPairType();
-
-  virtual AliFemtoModelWeightGenerator* Clone() const;
- protected:
-  
- private:
-  AliFemtoModelWeightGenerator* GetGenerator() const;
-
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelWeightGeneratorBasic, 1)
-#endif
-
-    };
-  
-#endif
-
-
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx
index 969b12252f3..5dd915b9cb0 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx
@@ -1,28 +1,27 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoEventReaderESD - the reader class for the Alice ESD              ///
-/// Reads in ESD information and converts it into internal AliFemtoEvent     ///
-/// Reads in AliESDfriend to create shared hit/quality information           ///
-/// Authors: Marek Chojnacki mchojnacki@knf.pw.edu.pl                        ///
-///          Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-
 /*
  *$Id$
  *$Log$
- *Revision 1.5  2007/05/03 09:45:20  akisiel
- *Fixing Effective C++ warnings
- *
- *Revision 1.4  2007/04/27 07:28:34  akisiel
- *Remove event number reading due to interface changes
- *
  *Revision 1.3  2007/04/27 07:25:16  akisiel
  *Make revisions needed for compilation from the main AliRoot tree
  *
  *Revision 1.1.1.1  2007/04/25 15:38:41  panos
  *Importing the HBT code dir
  *
+ *Revision 1.5  2007-04-03 16:00:08  mchojnacki
+ *Changes to iprove memory managing
+ *
+ *Revision 1.4  2007/03/13 15:30:03  mchojnacki
+ *adding reader for simulated data
+ *
+ *Revision 1.3  2007/03/08 14:58:03  mchojnacki
+ *adding some alice stuff
+ *
+ *Revision 1.2  2007/03/07 13:36:16  mchojnacki
+ *Add some comments
+ *
+ *Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ *First version on CVS
+ *
  */
 
 #include "AliFemtoEventReaderESD.h"
@@ -57,13 +56,10 @@ AliFemtoEventReaderESD::AliFemtoEventReaderESD():
   fNumberofEvent(0),
   fCurEvent(0),
   fCurFile(0),
-  fListOfFiles(0x0),
   fTree(0x0),
   fEvent(0x0),
   fEsdFile(0x0),
-  fEventFriend(0),
-  fSharedList(0x0),
-  fClusterPerPadrow(0x0)
+  fEventFriend(0)
 {
   fClusterPerPadrow = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
   for (int tPad=0; tPadCloneTree();
-  //fEvent = new AliESD(*aReader.fEvent);
-  fEvent = new AliESD();
-  fEsdFile = new TFile(aReader.fEsdFile->GetName());
-  fEventFriend = aReader.fEventFriend;
-  fClusterPerPadrow = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fClusterPerPadrow[tPad]->begin(); iter!=aReader.fClusterPerPadrow[tPad]->end(); iter++) {
-      fClusterPerPadrow[tPad]->push_back(*iter);
-    }
-  }
-  fSharedList = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fSharedList[tPad]->begin(); iter!=aReader.fSharedList[tPad]->end(); iter++) {
-      fSharedList[tPad]->push_back(*iter);
-    }
-  }
-  for (unsigned int veciter = 0; veciterCloneTree();
-  if (fEvent) delete fEvent;
-  //fEvent = new AliESD(*aReader.fEvent);
-  fEvent = new AliESD();
-  if (fEsdFile) delete fEsdFile;
-  fEsdFile = new TFile(aReader.fEsdFile->GetName());
-
-  fEventFriend = aReader.fEventFriend;
-  
-  if (fClusterPerPadrow) {
-    for (int tPad=0; tPadclear();
-      delete fClusterPerPadrow[tPad];
-    }
-    delete [] fClusterPerPadrow;
-  }
-  
-  if (fSharedList) {
-    for (int tPad=0; tPadclear();
-      delete fSharedList[tPad];
-    }
-    delete [] fSharedList;
-  }
-
-  fClusterPerPadrow = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fClusterPerPadrow[tPad]->begin(); iter!=aReader.fClusterPerPadrow[tPad]->end(); iter++) {
-      fClusterPerPadrow[tPad]->push_back(*iter);
-    }
-  }
-  fSharedList = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fSharedList[tPad]->begin(); iter!=aReader.fSharedList[tPad]->end(); iter++) {
-      fSharedList[tPad]->push_back(*iter);
-    }
-  }
-  for (unsigned int veciter = 0; veciter= 0) {
 	tClustIter = find(fClusterPerPadrow[tNcl]->begin(), fClusterPerPadrow[tNcl]->end(), tTrackIndices[tNcl]);
-	  if (tClustIter == fClusterPerPadrow[tNcl]->end()) {
+	if (tClustIter == fClusterPerPadrow[tNcl]->end()) {
 	  fClusterPerPadrow[tNcl]->push_back(tTrackIndices[tNcl]);
 	}
 	else {
@@ -379,7 +271,7 @@ AliFemtoEvent* AliFemtoEventReaderESD::ReturnHbtEvent()
 		
       AliFemtoTrack* trackCopy = new AliFemtoTrack();	
       const AliESDtrack *esdtrack=fEvent->GetTrack(i);//getting next track
-      //      const AliESDfriendTrack *tESDfriendTrack = esdtrack->GetFriendTrack();
+      const AliESDfriendTrack *tESDfriendTrack = esdtrack->GetFriendTrack();
 
       trackCopy->SetCharge((short)esdtrack->GetSign());
 
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.h b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.h
index 0bb3ce33eff..b5ee133e49c 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.h
@@ -1,27 +1,27 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoEventReaderESD - the reader class for the Alice ESD              ///
-/// Reads in ESD information and converts it into internal AliFemtoEvent     ///
-/// Reads in AliESDfriend to create shared hit/quality information           ///
-/// Authors: Marek Chojnacki mchojnacki@knf.pw.edu.pl                        ///
-///          Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-
 /*
  *$Id$
  *$Log$
- *Revision 1.3  2007/04/27 07:25:16  akisiel
- *Make revisions needed for compilation from the main AliRoot tree
- *
  *Revision 1.1.1.1  2007/04/25 15:38:41  panos
  *Importing the HBT code dir
  *
+ *Revision 1.3  2007/03/13 15:30:03  mchojnacki
+ *adding reader for simulated data
+ *
+ *Revision 1.2  2007/03/07 13:36:17  mchojnacki
+ *Add some comments
+ *
+ *Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ *First version on CVS
+ *
  */
   
 
 #ifndef AliFemtoEventReaderESD_hh
 #define AliFemtoEventReaderESD_hh
+//Reader for ESD files for StHbt version 10 with hidden info part
+//made by Marek Chojnacki mchojnacki@knf.pw.edu.pl
+// Version 11 Added AliESDfriend reading
+// Adam Kisiel kisiel@mps.ohio-state.edu
 #include "Base/AliFemtoEventReader.h"
 #include "Infrastructure/AliFemtoEnumeration.h"
 
@@ -38,11 +38,7 @@ class AliFemtoEventReaderESD : public AliFemtoEventReader
 {
  public:
   AliFemtoEventReaderESD();
-  AliFemtoEventReaderESD(const AliFemtoEventReaderESD &aReader);
   ~AliFemtoEventReaderESD();
-
-  AliFemtoEventReaderESD& operator=(const AliFemtoEventReaderESD& aReader);
-
   AliFemtoEvent* ReturnHbtEvent();
   AliFemtoString Report();
   //void SetFileName(const char* fileName);
@@ -53,22 +49,22 @@ class AliFemtoEventReaderESD : public AliFemtoEventReader
  protected:
 
  private:
-  bool           GetNextFile();     // setting next file to read 
+  bool           GetNextFile();//setting next file to read 
 
-  string         fInputFile;        // name of input file with ESD filenames
-  string         fFileName;         // name of current ESD file
-  bool           fConstrained;      // flag to set which momentum from ESD file will be use
-  int            fNumberofEvent;    // number of Events in ESD file
-  int            fCurEvent;         // number of current event
-  unsigned int   fCurFile;          // number of current file
-  vector fListOfFiles;      // list of ESD files 		
-  TTree*         fTree;             // ESD tree
-  AliESD*        fEvent;            // ESD event
-  TFile*         fEsdFile;          // ESD file 
-  AliESDfriend*  fEventFriend;      // ESD friend informaion
+  string         fInputFile; //name of input file
+  string         fFileName; //name of current ESD file
+  bool           fConstrained; //flag to set which momentum from ESD file will be use
+  int            fNumberofEvent;//number of Events in ESD file
+  int            fCurEvent; //number of current event
+  unsigned int   fCurFile; //number of current file
+  vector fListOfFiles;//list of ESD files 		
+  TTree*         fTree;//ESD tree
+  AliESD*        fEvent;//ESD event
+  TFile*         fEsdFile;//ESD file 
+  AliESDfriend*  fEventFriend;
 
-  list  **fSharedList;       //! Table (one list per padrow) of clusters which are shared
-  list  **fClusterPerPadrow; //! Table (one list per padrow) of clusters in each padrow
+  list  **fSharedList;
+  list  **fClusterPerPadrow;
 		
 #ifdef __ROOT__
   ClassDef(AliFemtoEventReaderESD, 10)
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx
index 903bfc615b4..aaaacda3a81 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx
@@ -28,9 +28,7 @@ AliFemtoEventReaderESDChain::AliFemtoEventReaderESDChain():
   fCurEvent(0),
   fCurFile(0),
   fEvent(0x0),
-  fEventFriend(0),
-  fSharedList(0x0),
-  fClusterPerPadrow(0x0)
+  fEventFriend(0)
 {
   fClusterPerPadrow = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
   for (int tPad=0; tPad **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fClusterPerPadrow[tPad]->begin(); iter!=aReader.fClusterPerPadrow[tPad]->end(); iter++) {
-      fClusterPerPadrow[tPad]->push_back(*iter);
-    }
-  }
-  fSharedList = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fSharedList[tPad]->begin(); iter!=aReader.fSharedList[tPad]->end(); iter++) {
-      fSharedList[tPad]->push_back(*iter);
-    }
-  }
-}
 //__________________
 //Destructor
 AliFemtoEventReaderESDChain::~AliFemtoEventReaderESDChain()
@@ -97,58 +58,6 @@ AliFemtoEventReaderESDChain::~AliFemtoEventReaderESDChain()
   delete [] fSharedList;
 }
 
-//__________________
-// Assignment operator
-AliFemtoEventReaderESDChain& AliFemtoEventReaderESDChain::operator=(const AliFemtoEventReaderESDChain& aReader)
-{
-  if (this == &aReader)
-    return *this;
-
-  fConstrained = aReader.fConstrained;
-  fNumberofEvent = aReader.fNumberofEvent;
-  fCurEvent = aReader.fCurEvent;
-  fCurFile = aReader.fCurFile;
-  if (fEvent) delete fEvent;
-  //fEvent = new AliESD(*aReader.fEvent);
-  fEvent = new AliESD();
-
-  fEventFriend = aReader.fEventFriend;
-  
-  if (fClusterPerPadrow) {
-    for (int tPad=0; tPadclear();
-      delete fClusterPerPadrow[tPad];
-    }
-    delete [] fClusterPerPadrow;
-  }
-  
-  if (fSharedList) {
-    for (int tPad=0; tPadclear();
-      delete fSharedList[tPad];
-    }
-    delete [] fSharedList;
-  }
-
-  fClusterPerPadrow = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fClusterPerPadrow[tPad]->begin(); iter!=aReader.fClusterPerPadrow[tPad]->end(); iter++) {
-      fClusterPerPadrow[tPad]->push_back(*iter);
-    }
-  }
-  fSharedList = (list **) malloc(sizeof(list *) * AliESDfriendTrack::kMaxTPCcluster);
-  for (int tPad=0; tPad();
-    list::iterator iter;
-    for (iter=aReader.fSharedList[tPad]->begin(); iter!=aReader.fSharedList[tPad]->end(); iter++) {
-      fSharedList[tPad]->push_back(*iter);
-    }
-  }
-  
-  return *this;
-}
 //__________________
 // Simple report
 AliFemtoString AliFemtoEventReaderESDChain::Report()
@@ -246,7 +155,7 @@ AliFemtoEvent* AliFemtoEventReaderESDChain::ReturnHbtEvent()
 		
       AliFemtoTrack* trackCopy = new AliFemtoTrack();	
       const AliESDtrack *esdtrack=fEvent->GetTrack(i);//getting next track
-      //      const AliESDfriendTrack *tESDfriendTrack = esdtrack->GetFriendTrack();
+      const AliESDfriendTrack *tESDfriendTrack = esdtrack->GetFriendTrack();
 
       trackCopy->SetCharge((short)esdtrack->GetSign());
 
diff --git a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.h b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.h
index add8e747738..11e40b10574 100644
--- a/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.h
+++ b/PWG2/FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.h
@@ -1,11 +1,6 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoEventReaderESDChain - the reader class for the Alice ESD         ///
-/// tailored for the Analysis/Task framework                                 ///
-/// Reads in AliESDfriend to create shared hit/quality information           ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
+// AliFemto reader for the ESD objects given back by the chain
+// Version 1:
+// Adam Kisiel, OSU kisiel@mps.ohio-state.edu
 #ifndef AliFemtoEventReaderESDChain_hh
 #define AliFemtoEventReaderESDChain_hh
 #include "Base/AliFemtoEventReader.h"
@@ -24,11 +19,7 @@ class AliFemtoEventReaderESDChain : public AliFemtoEventReader
 {
  public:
   AliFemtoEventReaderESDChain();
-  AliFemtoEventReaderESDChain(const AliFemtoEventReaderESDChain& aReader);
   ~AliFemtoEventReaderESDChain();
-
-  AliFemtoEventReaderESDChain& operator=(const AliFemtoEventReaderESDChain& aReader);
-
   AliFemtoEvent* ReturnHbtEvent();
   AliFemtoString Report();
   void SetConstrained(const bool constrained);
@@ -48,8 +39,8 @@ class AliFemtoEventReaderESDChain : public AliFemtoEventReader
   AliESD*        fEvent;         //ESD event
   AliESDfriend*  fEventFriend;
 
-  list  **fSharedList;       //! Table (one list per padrow) of clusters which are shared
-  list  **fClusterPerPadrow; //! Table (one list per padrow) of clusters in each padrow
+  list  **fSharedList;
+  list  **fClusterPerPadrow;
 		
 #ifdef __ROOT__
   ClassDef(AliFemtoEventReaderESDChain, 1)
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx
index 8a9f4ccbe33..d93e323a280 100644
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx
@@ -1,10 +1,44 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoShareQualityCorrFctn - A correlation function that saves the     ///
-/// amount of sharing and splitting hits per pair as a function of qinv      ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a simple Q-invariant correlation function           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/04/25 15:38:41  panos
+ * Importing the HBT code dir
+ *
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.4  2000/01/25 17:34:45  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.3  1999/07/29 02:47:09  lisa
+ * 1) add OpeningAngle correlation function 2) add AliFemtoMcEventReader 3) make histos in CorrFctns do errors correctly
+ *
+ * Revision 1.2  1999/07/06 22:33:20  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
 
 #include "AliFemtoShareQualityCorrFctn.h"
 //#include "Infrastructure/AliFemtoHisto.hh"
@@ -15,12 +49,7 @@ ClassImp(AliFemtoShareQualityCorrFctn)
 #endif
 
 //____________________________
-AliFemtoShareQualityCorrFctn::AliFemtoShareQualityCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi):
-  fShareNumerator(0),
-  fShareDenominator(0),
-  fQualityNumerator(0),
-  fQualityDenominator(0)
-{
+AliFemtoShareQualityCorrFctn::AliFemtoShareQualityCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi){
   // set up numerator
   //  title = "Num Qinv (MeV/c)";
   char TitNum[100] = "NumShare";
@@ -56,22 +85,6 @@ AliFemtoShareQualityCorrFctn::AliFemtoShareQualityCorrFctn(char* title, const in
   fQualityDenominator->Sumw2();
 }
 
-//____________________________
-AliFemtoShareQualityCorrFctn::AliFemtoShareQualityCorrFctn(const AliFemtoShareQualityCorrFctn& aCorrFctn) :
-  fShareNumerator(0),
-  fShareDenominator(0),
-  fQualityNumerator(0),
-  fQualityDenominator(0)
-{
-  if (aCorrFctn.fShareNumerator)
-    fShareNumerator = new TH2D(*aCorrFctn.fShareNumerator);
-  if (aCorrFctn.fShareDenominator)
-    fShareDenominator = new TH2D(*aCorrFctn.fShareDenominator);
-  if (aCorrFctn.fQualityNumerator)
-    fQualityNumerator = new TH2D(*aCorrFctn.fQualityNumerator);
-  if (aCorrFctn.fQualityDenominator)
-    fQualityDenominator = new TH2D(*aCorrFctn.fQualityDenominator);
-}
 //____________________________
 AliFemtoShareQualityCorrFctn::~AliFemtoShareQualityCorrFctn(){
   delete fShareNumerator;
@@ -80,31 +93,6 @@ AliFemtoShareQualityCorrFctn::~AliFemtoShareQualityCorrFctn(){
   delete fQualityDenominator;
 }
 //_________________________
-AliFemtoShareQualityCorrFctn& AliFemtoShareQualityCorrFctn::operator=(const AliFemtoShareQualityCorrFctn& aCorrFctn)
-{
-  if (this == &aCorrFctn)
-    return *this;
-
-  if (aCorrFctn.fShareNumerator)
-    fShareNumerator = new TH2D(*aCorrFctn.fShareNumerator);
-  else
-    fShareNumerator = 0;
-  if (aCorrFctn.fShareDenominator)
-    fShareDenominator = new TH2D(*aCorrFctn.fShareDenominator);
-  else
-    fShareDenominator = 0;
-  if (aCorrFctn.fQualityNumerator)
-    fQualityNumerator = new TH2D(*aCorrFctn.fQualityNumerator);
-  else
-    fQualityNumerator = 0;
-  if (aCorrFctn.fQualityDenominator)
-    fQualityDenominator = new TH2D(*aCorrFctn.fQualityDenominator);
-  else
-    fQualityDenominator = 0;
-
-  return *this;
-}
-//_________________________
 void AliFemtoShareQualityCorrFctn::Finish(){
   // here is where we should normalize, fit, etc...
   // we should NOT Draw() the histos (as I had done it below),
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.h b/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.h
index 027077ace7f..4546a23f7d7 100644
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.h
+++ b/PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.h
@@ -1,10 +1,38 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoShareQualityCorrFctn - A correlation function that saves the     ///
-/// amount of sharing and splitting hits per pair as a function of qinv      ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
+/***************************************************************************
+ *
+ * $Id$
+ *
+ * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
+ ***************************************************************************
+ *
+ * Description: part of STAR HBT Framework: AliFemtoMaker package
+ *   a simple Q-invariant correlation function           
+ *
+ ***************************************************************************
+ *
+ * $Log$
+ * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
+ * First version on CVS
+ *
+ * Revision 1.3  2000/01/25 17:34:45  laue
+ * I. In order to run the stand alone version of the AliFemtoMaker the following
+ * changes have been done:
+ * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
+ * b) unnecessary includes of StMaker.h have been removed
+ * c) the subdirectory AliFemtoMaker/doc/Make has been created including everything
+ * needed for the stand alone version
+ *
+ * II. To reduce the amount of compiler warning
+ * a) some variables have been type casted
+ * b) some destructors have been declared as virtual
+ *
+ * Revision 1.2  1999/07/06 22:33:20  lisa
+ * Adjusted all to work in pro and new - dev itself is broken
+ *
+ * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
+ * Installation of AliFemtoMaker
+ *
+ **************************************************************************/
 
 #ifndef AliFemtoShareQualityCorrFctn_hh
 #define AliFemtoShareQualityCorrFctn_hh
@@ -16,11 +44,8 @@
 class AliFemtoShareQualityCorrFctn : public AliFemtoCorrFctn {
 public:
   AliFemtoShareQualityCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi);
-  AliFemtoShareQualityCorrFctn(const AliFemtoShareQualityCorrFctn& aCorrFctn);
   virtual ~AliFemtoShareQualityCorrFctn();
 
-  AliFemtoShareQualityCorrFctn& operator=(const AliFemtoShareQualityCorrFctn& aCorrFctn);
-
   virtual AliFemtoString Report();
   virtual void AddRealPair(const AliFemtoPair*);
   virtual void AddMixedPair(const AliFemtoPair*);
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx
index 9dcdd3fcdb6..175acf0180e 100644
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx
@@ -11,9 +11,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.3  2007/04/27 07:25:59  akisiel
- * Make revisions needed for compilation from the main AliRoot tree
- *
  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
  * Importing the HBT code dir
  *
@@ -38,14 +35,7 @@
 ClassImp(AliFemtoESDTrackCut)
 #endif
 
-AliFemtoESDTrackCut::AliFemtoESDTrackCut() :
-  fCharge(0),
-  fLabel(0),
-  fStatus(0),
-  fminTPCclsF(0),
-  fminITScls(0),
-  fNTracksPassed(0),
-  fNTracksFailed(0)
+AliFemtoESDTrackCut::AliFemtoESDTrackCut()
 {
     fNTracksPassed = fNTracksFailed = 0;
     fCharge = 0;  // takes both charges 0
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx
index c6ca6372455..dfad06b477e 100644
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx
@@ -7,9 +7,6 @@
  ***************************************************************************
  *
  * $Log$
- * Revision 1.3  2007/04/27 07:25:59  akisiel
- * Make revisions needed for compilation from the main AliRoot tree
- *
  * Revision 1.1.1.1  2007/04/25 15:38:41  panos
  * Importing the HBT code dir
  *
@@ -28,9 +25,7 @@ ClassImp(AliFemtoQPairCut)
 #endif
     
 //__________________
-AliFemtoQPairCut::AliFemtoQPairCut():
-  fNPairsPassed(0),
-  fNPairsFailed(0)
+AliFemtoQPairCut::AliFemtoQPairCut()
 {
   fNPairsPassed = fNPairsFailed = 0;
   fQlong[0]=-1.0; fQlong[1]=100.0;
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx
index f49f21494cb..08354fc56d4 100644
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx
+++ b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx
@@ -22,11 +22,9 @@ ClassImp(AliFemtoShareQualityPairCut)
 #endif
 
 //__________________
-AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut():
-  fNPairsPassed(0),
-  fNPairsFailed(0),
-  fShareQualityMax(1.0)
-{
+AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut(){
+  fNPairsPassed = fNPairsFailed = 0;
+  fShareQualityMax = 1.0;
 }
 //__________________
 AliFemtoShareQualityPairCut::~AliFemtoShareQualityPairCut(){
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.h b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.h
index edc3d26bf72..5544c94c09b 100644
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.h
+++ b/PWG2/FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.h
@@ -46,12 +46,11 @@ class AliFemtoShareQualityPairCut : public AliFemtoPairCut{
 #endif
 };
 
-inline AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut(const AliFemtoShareQualityPairCut& c) : 
-  AliFemtoPairCut(c),
-  fNPairsPassed(0),
-  fNPairsFailed(0),
-  fShareQualityMax(1.0) // no cut
-{ /* no-op */ }
+inline AliFemtoShareQualityPairCut::AliFemtoShareQualityPairCut(const AliFemtoShareQualityPairCut& c) : AliFemtoPairCut(c) {
+  fNPairsPassed = 0;
+  fNPairsFailed = 0;
+  fShareQualityMax = 1.0; // no cut
+}
 
 inline AliFemtoShareQualityPairCut* AliFemtoShareQualityPairCut::Clone() { AliFemtoShareQualityPairCut* c = new AliFemtoShareQualityPairCut(*this); return c;}
 
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelCorrFctnSource.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelCorrFctnSource.cxx
deleted file mode 100644
index 70f2670b6a7..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelCorrFctnSource.cxx
+++ /dev/null
@@ -1,146 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelCorrFctnSource - the class for correlation function which   ///
-/// uses the model framework and weight generation and saves the generated   ///
-/// emission source                                                          ///
-/// Authors: Adam Kisiel, kisiel@mps.ohio-state.edu                          ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelCorrFctnSource, 1)
-#endif
-
-#include "Model/AliFemtoModelGausLCMSFreezeOutGenerator.h"
-#include "Model/AliFemtoModelHiddenInfo.h"
-#include "Model/AliFemtoModelCorrFctnSource.h"
-    
-//_______________________
-AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(): 
-  AliFemtoModelCorrFctn(),
-  fHistROut(0),
-  fHistRSide(0),
-  fHistRLong(0),
-  fHistRStar(0),
-  fHistdNdR(0)
-{
-}
-//_______________________
-AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(const char *title, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi):
-  AliFemtoModelCorrFctn(title, aNbins, aQinvLo, aQinvHi),
-  fHistROut(0),
-  fHistRSide(0),
-  fHistRLong(0),
-  fHistRStar(0),
-  fHistdNdR(0)
-{
-  char buf[100];
-  sprintf(buf, "%sOut", title);
-  fHistROut = new TH1D(buf,buf,100,-50.0,50.0);
-  sprintf(buf, "%sSide", title);
-  fHistRSide = new TH1D(buf,buf,100,-50.0,50.0);
-  sprintf(buf, "%sLong", title);
-  fHistRLong = new TH1D(buf,buf,100,-50.0,50.0);
-  sprintf(buf, "%sInv", title);
-  fHistRStar = new TH1D(buf,buf,100,-50.0,50.0);
-  sprintf(buf, "%sdNdR", title);
-  fHistdNdR = new TH1D(buf,buf,100,-50.0,50.0);
-
-  fHistROut->Sumw2();
-  fHistRSide->Sumw2();
-  fHistRLong->Sumw2();
-  fHistRStar->Sumw2();
-  fHistdNdR->Sumw2();
-}
-//_______________________
-AliFemtoModelCorrFctnSource::AliFemtoModelCorrFctnSource(const AliFemtoModelCorrFctnSource& aCorrFctn):
-  AliFemtoModelCorrFctn(aCorrFctn),
-  fHistROut(0),
-  fHistRSide(0),
-  fHistRLong(0),
-  fHistRStar(0),
-  fHistdNdR(0)
-{
-  fHistROut = new TH1D (*aCorrFctn.fHistROut);
-  fHistRSide = new TH1D(*aCorrFctn.fHistRSide);
-  fHistRLong = new TH1D(*aCorrFctn.fHistRLong);
-  fHistRStar = new TH1D(*aCorrFctn.fHistRStar);
-  fHistdNdR = new TH1D(*aCorrFctn.fHistdNdR);
-}
-//_______________________
-AliFemtoModelCorrFctnSource::~AliFemtoModelCorrFctnSource()
-{
-  if (fHistROut) delete fHistROut;
-  if (fHistRSide) delete fHistRSide;
-  if (fHistRLong) delete fHistRLong;
-  if (fHistRStar) delete fHistRStar;
-  if (fHistdNdR) delete fHistdNdR;
-  if (fNumeratorTrue) delete fNumeratorTrue;
-  if (fNumeratorFake) delete fNumeratorFake;
-  if (fDenominator) delete fDenominator;
-}
-
-//_______________________
-AliFemtoModelCorrFctnSource& AliFemtoModelCorrFctnSource::operator=(const AliFemtoModelCorrFctnSource& aCorrFctn)
-{
-  if (this == &aCorrFctn) 
-    return *this;
-  if (aCorrFctn.fHistROut)
-    fHistROut = new TH1D (*aCorrFctn.fHistROut);
-  else fHistROut = 0;
-  if (aCorrFctn.fHistRSide)
-    fHistRSide = new TH1D(*aCorrFctn.fHistRSide);
-  else fHistRSide = 0;
-  if (aCorrFctn.fHistRLong)
-    fHistRLong = new TH1D(*aCorrFctn.fHistRLong);
-  else fHistRLong = 0;
-  if (aCorrFctn.fHistRStar)
-    fHistRStar = new TH1D(*aCorrFctn.fHistRStar);
-  fHistRStar = 0;
-  if (aCorrFctn.fHistdNdR)
-    fHistdNdR = new TH1D(*aCorrFctn.fHistdNdR);
-  else fHistdNdR = 0;
-
-  return *this;
-}
-//_______________________
-AliFemtoString AliFemtoModelCorrFctnSource::Report()
-{
-  AliFemtoString tStr = "AliFemtoModelCorrFctnSource report";
-
-  return tStr;
-}
-
-//_______________________
-void AliFemtoModelCorrFctnSource::AddRealPair(AliFemtoPair* aPair)
-{
-  AliFemtoModelCorrFctn::AddRealPair(aPair);
-}
-//_______________________
-void AliFemtoModelCorrFctnSource::AddMixedPair(AliFemtoPair* aPair)
-{
-  AliFemtoModelCorrFctn::AddMixedPair(aPair);
-  fHistROut->Fill (fManager->GetWeightGenerator()->GetRStarOut());
-  fHistRSide->Fill(fManager->GetWeightGenerator()->GetRStarSide());
-  fHistRLong->Fill(fManager->GetWeightGenerator()->GetRStarLong());
-  fHistRStar->Fill(fManager->GetWeightGenerator()->GetRStar());
-  fHistdNdR->Fill (fManager->GetWeightGenerator()->GetRStar(),1.0/(fManager->GetWeightGenerator()->GetRStar()*fManager->GetWeightGenerator()->GetRStar()));
-}
-//_______________________
-void AliFemtoModelCorrFctnSource::Write()
-{
-  fHistROut->Write();
-  fHistRSide->Write();
-  fHistRLong->Write();
-  fHistRStar->Write();
-  fHistdNdR->Write();
-  
-  AliFemtoModelCorrFctn::Write();
-}
-//_______________________
-AliFemtoModelCorrFctnSource* AliFemtoModelCorrFctnSource::Clone()
-{
-  AliFemtoModelCorrFctnSource *tCopy = new AliFemtoModelCorrFctnSource(*this);
-  
-  return tCopy;
-}
-
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelCorrFctnSource.h b/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelCorrFctnSource.h
deleted file mode 100644
index 3e1dc5501c1..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelCorrFctnSource.h
+++ /dev/null
@@ -1,51 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelCorrFctnSource - the class for correlation function which   ///
-/// uses the model framework and weight generation and saves the generated   ///
-/// emission source                                                          ///
-/// Authors: Adam Kisiel, kisiel@mps.ohio-state.edu                          ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelCorrFctnSource_hh
-#define AliFemtoModelCorrFctnSource_hh
-
-#include "Base/AliFemtoCorrFctn.h"
-#include "Infrastructure/AliFemtoPair.h"
-#include "Model/AliFemtoModelManager.h"
-#include "Model/AliFemtoModelCorrFctn.h"
-
-class AliFemtoModelCorrFctnSource: public AliFemtoModelCorrFctn {
-
-public:
-  AliFemtoModelCorrFctnSource();
-  AliFemtoModelCorrFctnSource(const char *title, Int_t aNbins, Double_t aQinvLo, Double_t aQinvHi);
-  AliFemtoModelCorrFctnSource(const AliFemtoModelCorrFctnSource& aCorrFctn);
-  virtual ~AliFemtoModelCorrFctnSource();
-  
-  AliFemtoModelCorrFctnSource& operator=(const AliFemtoModelCorrFctnSource& aCorrFctn);
-
-  virtual AliFemtoString Report();
-
-  virtual void AddRealPair(AliFemtoPair* aPair);
-  virtual void AddMixedPair(AliFemtoPair* aPir);
-
-  virtual void Write();
-
-  virtual AliFemtoModelCorrFctnSource* Clone();
-
-protected:
-
-  TH1D *fHistROut;
-  TH1D *fHistRSide;
-  TH1D *fHistRLong;
-  TH1D *fHistRStar;
-  TH1D *fHistdNdR;
-
-private:
-
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelCorrFctnSource, 1)
-#endif
-};
-
-#endif
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelGausRinvFreezeOutGenerator.cxx b/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelGausRinvFreezeOutGenerator.cxx
deleted file mode 100644
index 95166cde772..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelGausRinvFreezeOutGenerator.cxx
+++ /dev/null
@@ -1,123 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelGausRinvFreezeOutGenerator - freeze-out                     ///
-/// coordinates generator, generating a 3D gaussian ellipsoid in LCMS        ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifdef __ROOT__
-  ClassImp(AliFemtoModelGausRinvFreezeOutGenerator, 1)
-#endif
-
-#include "math.h"
-#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
-#include "Model/AliFemtoModelHiddenInfo.h"
-#include "AliFemtoLorentzVector.h"
-
-//_______________________
-AliFemtoModelGausRinvFreezeOutGenerator::AliFemtoModelGausRinvFreezeOutGenerator() :
-  fSizeInv(0)
-{
-  // Default constructor
-  fRandom = new TRandom2();
-}
-
-//_______________________
-AliFemtoModelGausRinvFreezeOutGenerator::AliFemtoModelGausRinvFreezeOutGenerator(const AliFemtoModelGausRinvFreezeOutGenerator &aModel):
-  fSizeInv(0)
-{
-  // Copy constructor
-  fRandom = new TRandom2();
-  SetSizeInv(aModel.GetSizeInv());
-}
-//_______________________
-AliFemtoModelGausRinvFreezeOutGenerator::~AliFemtoModelGausRinvFreezeOutGenerator()
-{
-  if (fRandom) delete fRandom;
-}
-//_______________________
-void AliFemtoModelGausRinvFreezeOutGenerator::GenerateFreezeOut(AliFemtoPair *aPair)
-{
-  // Generate two particle emission points with respect
-  // to their pair momentum 
-  // The source is the 3D Gaussian ellipsoid in the LCMS frame
-  AliFemtoModelHiddenInfo *inf1 = (AliFemtoModelHiddenInfo *) aPair->track1()->HiddenInfo();
-  AliFemtoModelHiddenInfo *inf2 = (AliFemtoModelHiddenInfo *) aPair->track2()->HiddenInfo();
-
-  if ((!inf1) || (!inf2)) { cout << "Hidden info not created! "  << endl; exit(kFALSE); }
-
-  // Calculate sum momenta
-  Double_t tPx = inf1->GetTrueMomentum()->x() + inf2->GetTrueMomentum()->x();
-  Double_t tPy = inf1->GetTrueMomentum()->y() + inf2->GetTrueMomentum()->y();
-  Double_t tPz = inf1->GetTrueMomentum()->z() + inf2->GetTrueMomentum()->z();
-  Double_t tM1 = inf1->GetMass();
-  Double_t tM2 = inf2->GetMass();
-  Double_t tE1 = sqrt(tM1*tM1 + inf1->GetTrueMomentum()->mag2());
-  Double_t tE2 = sqrt(tM2*tM2 + inf2->GetTrueMomentum()->mag2());
-  Double_t tEs = tE1 + tE2;
-
-  Double_t tPt = sqrt(tPx*tPx + tPy*tPy);
-  Double_t tMt = sqrt(tEs*tEs - tPz*tPz);
-
-  // Generate positions in PRF from a Gaussian
-  Double_t tROutS =  fRandom->Gaus(0,fSizeInv); // reuse of long
-  Double_t tRSideS = fRandom->Gaus(0,fSizeInv);
-  Double_t tRLongS = fRandom->Gaus(0,fSizeInv);
-  Double_t tRTimeS = 0;
-      
-  Double_t tBetat  = tPt/tMt;
-  Double_t tGammat = 1.0/sqrt(1.0-tBetat*tBetat);
-
-  Double_t tBetaz  = tPz/tEs;
-  Double_t tGammaz = 1.0/sqrt(1.0-tBetaz*tBetaz);
-
-  Double_t tROut = tGammat * (tROutS + tBetat * tRTimeS);
-  Double_t tDtL  = tGammat * (tRTimeS + tBetat * tROutS);
-  Double_t tRSide = tRSideS;
-
-  Double_t tRLong = tGammaz * (tRLongS + tBetaz * tDtL);
-  Double_t tDt    = tGammaz * (tDtL + tBetaz * tRLongS);
-	  
-  tPx /= tPt;
-  tPy /= tPt;
-	  
-  Double_t tXout  = tROut*tPx-tRSide*tPy;
-  Double_t tXside = tROut*tPy+tRSide*tPx;
-  Double_t tXlong = tRLong;
-  Double_t tXtime = tDt;
-  
-  if (!(inf1->GetEmissionPoint())) {
-    AliFemtoLorentzVector tPos(0,0,0,0);
-    inf1->SetEmissionPoint(&tPos);
-  }
-  else
-    inf1->SetEmissionPoint(0,0,0,0);
-  if (!(inf2->GetEmissionPoint())) {
-    AliFemtoLorentzVector tPos(tXout,tXside,tXlong,tXtime);
-    inf2->SetEmissionPoint(&tPos);
-  }
-  else
-    inf2->SetEmissionPoint(tXout, tXside, tXlong, tXtime);
-}
-
-//_______________________
-void AliFemtoModelGausRinvFreezeOutGenerator::SetSizeInv(Double_t aSizeInv)
-{
-  fSizeInv = aSizeInv;
-}
-//_______________________
-Double_t AliFemtoModelGausRinvFreezeOutGenerator::GetSizeInv() const
-{
-  return fSizeInv;
-}
-//_______________________
-AliFemtoModelFreezeOutGenerator* AliFemtoModelGausRinvFreezeOutGenerator::Clone() const
-{ 
-  return GetGenerator(); 
-}
-//_______________________
-inline AliFemtoModelFreezeOutGenerator* AliFemtoModelGausRinvFreezeOutGenerator::GetGenerator() const 
-{ 
-  AliFemtoModelFreezeOutGenerator* tModel = new AliFemtoModelGausRinvFreezeOutGenerator(*this); 
-  return tModel; 
-}
diff --git a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelGausRinvFreezeOutGenerator.h b/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelGausRinvFreezeOutGenerator.h
deleted file mode 100644
index 9868bb426c7..00000000000
--- a/PWG2/FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelGausRinvFreezeOutGenerator.h
+++ /dev/null
@@ -1,43 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-///                                                                          ///
-/// AliFemtoModelGausRinvFreezeOutGenerator - freeze-out                     ///
-/// coordinates generator, generating a 3D gaussian spheroid in PRF          ///
-/// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
-///                                                                          ///
-////////////////////////////////////////////////////////////////////////////////
-#ifndef AliFemtoModelGausRinvFreezeOutGenerator_hh
-#define AliFemtoModelGausRinvFreezeOutGenerator_hh
-
-#include "Model/AliFemtoModelFreezeOutGenerator.h"
-
-#include "TRandom.h"
-
-class AliFemtoModelGausRinvFreezeOutGenerator : public AliFemtoModelFreezeOutGenerator
-{
- public:
-  AliFemtoModelGausRinvFreezeOutGenerator();
-  AliFemtoModelGausRinvFreezeOutGenerator(const AliFemtoModelGausRinvFreezeOutGenerator &aModel);
-  virtual ~AliFemtoModelGausRinvFreezeOutGenerator();
-  virtual void GenerateFreezeOut(AliFemtoPair *aPair);;
-
-  void SetSizeInv(Double_t aSizeInv);
-  
-  Double_t GetSizeInv() const;
-
-  virtual AliFemtoModelFreezeOutGenerator* Clone() const;
-
- protected:
-  Double_t fSizeInv;
-
- private:
-  AliFemtoModelFreezeOutGenerator* GetGenerator() const;
-		
-#ifdef __ROOT__
-  ClassDef(AliFemtoModelGausRinvFreezeOutGenerator, 1)
-#endif
-
-    };
-  
-#endif
-
-
diff --git a/PWG2/PWG2femtoscopyLinkDef.h b/PWG2/PWG2femtoscopyLinkDef.h
index 6e54663455b..c4601cb3403 100644
--- a/PWG2/PWG2femtoscopyLinkDef.h
+++ b/PWG2/PWG2femtoscopyLinkDef.h
@@ -27,10 +27,3 @@
 #pragma link C++ class AliFmThreeVectorF;
 #pragma link C++ class AliFemtoEventReaderESD;
 #pragma link C++ class AliFemtoEventReaderESDChain;
-#pragma link C++ class AliFemtoModelManager;
-#pragma link C++ class AliFemtoModelWeightGenerator;
-#pragma link C++ class AliFemtoModelWeightGeneratorBasic;
-#pragma link C++ class AliFemtoModelFreezeOutGenerator;
-#pragma link C++ class AliFemtoModelGausLCMSFreezeOutGenerator;
-#pragma link C++ class AliFemtoModelHiddenInfo;
-#pragma link C++ class AliFemtoModelCorrFctn;
diff --git a/PWG2/PWG2femtoscopyUserLinkDef.h b/PWG2/PWG2femtoscopyUserLinkDef.h
index f2cab46f46b..8ee88d862c9 100644
--- a/PWG2/PWG2femtoscopyUserLinkDef.h
+++ b/PWG2/PWG2femtoscopyUserLinkDef.h
@@ -17,8 +17,6 @@
 #pragma link C++ class AliFemtoESDTrackCut;
 #pragma link C++ class AliFemtoQPairCut;
 #pragma link C++ class AliFemtoShareQualityCorrFctn;
-#pragma link C++ class AliFemtoModelCorrFctnSource;
-#pragma link C++ class AliFemtoModelGausRinvFreezeOutGenerator;
 //#pragma link C++ class AliStHbtEvent;
 //#pragma link C++ class AliStHbtEventReader;
 //#pragma link C++ class AliStHbtPythiaOnFlyEventReader;
diff --git a/PWG2/libPWG2.pkg b/PWG2/libPWG2.pkg
index fdda89a0540..a3710f34deb 100644
--- a/PWG2/libPWG2.pkg
+++ b/PWG2/libPWG2.pkg
@@ -8,4 +8,4 @@ EXPORT:=
 
 EINCLUDE:= PYTHIA6
 
-all-PWG2: all-PWG2ebye all-PWG2resonances all-PWG2flow all-PWG2femtoscopy all-PWG2femtoscopyUser
+all-PWG2: all-PWG2ebye all-PWG2resonances all-PWG2flow all-PWG2femtoscopy
diff --git a/PWG2/libPWG2femtoscopy.pkg b/PWG2/libPWG2femtoscopy.pkg
index 85cb5f8c622..0b68f0c4148 100644
--- a/PWG2/libPWG2femtoscopy.pkg
+++ b/PWG2/libPWG2femtoscopy.pkg
@@ -24,14 +24,7 @@ SRCS= FEMTOSCOPY/AliFemto/Analysis/AliFemtoAnalysis.cxx \
       FEMTOSCOPY/AliFemto/Infrastructure/TpcLocalTransform.cxx \
       FEMTOSCOPY/AliFemto/Base/AliFemtoEventReader.cxx \
       FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESD.cxx \
-      FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx \
-      FEMTOSCOPY/AliFemto/Model/AliFemtoModelHiddenInfo.cxx \
-      FEMTOSCOPY/AliFemto/Model/AliFemtoModelGausLCMSFreezeOutGenerator.cxx \
-      FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGenerator.cxx \
-      FEMTOSCOPY/AliFemto/Model/AliFemtoModelWeightGeneratorBasic.cxx\
-      FEMTOSCOPY/AliFemto/Model/AliFemtoModelManager.cxx \
-      FEMTOSCOPY/AliFemto/Model/AliFemtoModelCorrFctn.cxx \
-      FEMTOSCOPY/AliFemto/Model/AliFemtoModelFreezeOutGenerator.cxx
+      FEMTOSCOPY/AliFemto/Reader/AliFemtoEventReaderESDChain.cxx 
 
 HDRS= $(SRCS:.cxx=.h) 
 HDRS += FEMTOSCOPY/AliFemto/Infrastructure/AliFmThreeVector.h \
@@ -49,5 +42,5 @@ DHDR:= PWG2femtoscopyLinkDef.h
 
 EXPORT:=
 
-EINCLUDE:= PWG2/FEMTOSCOPY/AliFemto PWG2/FEMTOSCOPY/AliFemto/Base PWG2/FEMTOSCOPY/AliFemto/Infrastructure PWG2/FEMTOSCOPY/AliFemto/Reader PWG2/FEMTOSCOPY/AliFemto/Cut PWG2/FEMTOSCOPY/AliFemto/CorrFctn PWG2/FEMTOSCOPY/AliFemto/Model
+EINCLUDE:= PWG2/FEMTOSCOPY/AliFemto PWG2/FEMTOSCOPY/AliFemto/Base PWG2/FEMTOSCOPY/AliFemto/Infrastructure PWG2/FEMTOSCOPY/AliFemto/Reader PWG2/FEMTOSCOPY/AliFemto/Cut PWG2/FEMTOSCOPY/AliFemto/CorrFctn 
 
diff --git a/PWG2/libPWG2femtoscopyUser.pkg b/PWG2/libPWG2femtoscopyUser.pkg
index a462d1bd32e..e2554b693ee 100644
--- a/PWG2/libPWG2femtoscopyUser.pkg
+++ b/PWG2/libPWG2femtoscopyUser.pkg
@@ -1,9 +1,7 @@
 SRCS= FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoQPairCut.cxx \
       FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoShareQualityPairCut.cxx \
       FEMTOSCOPY/AliFemtoUser/Cut/AliFemtoESDTrackCut.cxx \
-      FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx \
-      FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelCorrFctnSource.cxx \
-      FEMTOSCOPY/AliFemtoUser/Model/AliFemtoModelGausRinvFreezeOutGenerator.cxx 
+      FEMTOSCOPY/AliFemtoUser/CorrFctn/AliFemtoShareQualityCorrFctn.cxx 
 
 HDRS= $(SRCS:.cxx=.h) 
 
@@ -11,5 +9,5 @@ DHDR:= PWG2femtoscopyUserLinkDef.h
 
 EXPORT:=
 
-EINCLUDE:= PWG2/FEMTOSCOPY/AliFemto PWG2/FEMTOSCOPY/AliFemto/Base PWG2/FEMTOSCOPY/AliFemto/Infrastructure PWG2/FEMTOSCOPY/AliFemto/Reader PWG2/FEMTOSCOPY/AliFemto/Cut PWG2/FEMTOSCOPY/AliFemto/CorrFctn PWG2/FEMTOSCOPY/AliFemtoUser PWG2/FEMTOSCOPY/AliFemtoUser/Cut PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn PWG2/FEMTOSCOPY/AliFemtoUser/Model
+EINCLUDE:= PWG2/FEMTOSCOPY/AliFemto PWG2/FEMTOSCOPY/AliFemto/Base PWG2/FEMTOSCOPY/AliFemto/Infrastructure PWG2/FEMTOSCOPY/AliFemto/Reader PWG2/FEMTOSCOPY/AliFemto/Cut PWG2/FEMTOSCOPY/AliFemto/CorrFctn PWG2/FEMTOSCOPY/AliFemtoUser PWG2/FEMTOSCOPY/AliFemtoUser/Cut PWG2/FEMTOSCOPY/AliFemtoUser/CorrFctn
 
diff --git a/PWG3/AliAODRecoDecayHF.cxx b/PWG3/AliAODRecoDecayHF.cxx
deleted file mode 100644
index 4c27ac4159e..00000000000
--- a/PWG3/AliAODRecoDecayHF.cxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2006, 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.                  *
- **************************************************************************/
-
-/////////////////////////////////////////////////////////////
-//
-// Base class for AOD reconstructed heavy-flavour decay
-//
-// Author: A.Dainese, andrea.dainese@lnl.infn.it
-/////////////////////////////////////////////////////////////
-
-#include 
-#include 
-#include "AliAODRecoDecay.h"
-#include "AliAODRecoDecayHF.h"
-
-ClassImp(AliAODRecoDecayHF)
-
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF::AliAODRecoDecayHF() :
-  AliAODRecoDecay(),
-  fOwnPrimaryVtx(0x0),
-  fd0err(0x0) 
-{
-  //
-  // Default Constructor
-  //
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF::AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
-				     Double_t *px,Double_t *py,Double_t *pz,
-				     Double_t *d0,Double_t *d0err) :
-  AliAODRecoDecay(vtx2,nprongs,charge,px,py,pz,d0),
-  fOwnPrimaryVtx(0x0),
-  fd0err(0x0)
-{
-  //
-  // Constructor with AliAODVertex for decay vertex
-  //
-  fd0err = new Double_t[GetNProngs()];
-  for(Int_t i=0; i0) {
-    fd0err = new Double_t[GetNProngs()];
-    memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
-  }
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF &AliAODRecoDecayHF::operator=(const AliAODRecoDecayHF &source)
-{
-  //
-  // assignment operator
-  //
-  if(&source == this) return *this;
-  fOwnPrimaryVtx = source.fOwnPrimaryVtx;
-  fSecondaryVtx = source.fSecondaryVtx;
-  fNProngs = source.fNProngs;
-  fNDCA = source.fNDCA;
-  fNPID = source.fNPID;
-  fEventNumber = source.fEventNumber;
-  fRunNumber = source.fRunNumber;
-  if(source.GetNProngs()>0) {
-    fd0 = new Double_t[GetNProngs()];
-    fd0err = new Double_t[GetNProngs()];
-    memcpy(fd0,source.fd0,GetNProngs()*sizeof(Double_t));
-    memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
-    if(source.fPx) {
-      fPx = new Double_t[GetNProngs()];
-      fPy = new Double_t[GetNProngs()];
-      fPz = new Double_t[GetNProngs()];
-      memcpy(fPx,source.fPx,GetNProngs()*sizeof(Double_t));
-      memcpy(fPy,source.fPy,GetNProngs()*sizeof(Double_t));
-      memcpy(fPz,source.fPz,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fPID) {
-      fPID = new Double_t[5*GetNProngs()];
-      memcpy(fPID,source.fPID,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fDCA) {
-      fDCA = new Float_t[GetNProngs()*(GetNProngs()-1)/2];
-      memcpy(fDCA,source.fDCA,(GetNProngs()*(GetNProngs()-1)/2)*sizeof(Float_t));
-    }
-  }
-  return *this;
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF::~AliAODRecoDecayHF() {
-  //  
-  // Default Destructor
-  //
-  if(fOwnPrimaryVtx) delete fOwnPrimaryVtx;
-  if(fd0err) delete [] fd0err;
-}
-//---------------------------------------------------------------------------
diff --git a/PWG3/AliAODRecoDecayHF.h b/PWG3/AliAODRecoDecayHF.h
deleted file mode 100644
index f9c05f64653..00000000000
--- a/PWG3/AliAODRecoDecayHF.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef ALIAODRECODECAYHF_H
-#define ALIAODRECODECAYHF_H
-/* Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-//***********************************************************
-// Class AliAODRecoDecayHF
-// base class for AOD reconstructed heavy-flavour decays
-// Author: A.Dainese, andrea.dainese@lnl.infn.it
-//***********************************************************
-
-#include "AliAODRecoDecay.h"
-
-class AliAODRecoDecayHF : public AliAODRecoDecay {
-
- public:
-
-  AliAODRecoDecayHF();
-  AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
-		    Double_t *px,Double_t *py,Double_t *pz,
-		    Double_t *d0,Double_t *d0err);
-  AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
-		    Double_t *d0,Double_t *d0err);
-  virtual ~AliAODRecoDecayHF();
-
-  AliAODRecoDecayHF(const AliAODRecoDecayHF& source);
-  AliAODRecoDecayHF& operator=(const AliAODRecoDecayHF& source); 
-   
-
-  // primary vertex
-  void SetOwnPrimaryVtx(AliAODVertex *vtx2) {fOwnPrimaryVtx = vtx2;}
-  void CheckOwnPrimaryVtx() const 
-    {if(!fOwnPrimaryVtx) printf("fOwnPrimaryVtx not set"); return;}
-  AliAODVertex* GetOwnPrimaryVtx() const {return fOwnPrimaryVtx;}
-  void GetOwnPrimaryVtx(Double_t vtx[3]) const 
-    {CheckOwnPrimaryVtx();fOwnPrimaryVtx->GetPosition(vtx);}
-
-  // kinematics & topology
-  Double_t DecayLength() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::DecayLength(fOwnPrimaryVtx);}
-  Double_t DecayLengthError() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::DecayLengthError(fOwnPrimaryVtx);}
-  Double_t NormalizedDecayLength() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::NormalizedDecayLength(fOwnPrimaryVtx);}
-  Double_t DecayLengthXY() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::DecayLengthXY(fOwnPrimaryVtx);}
-  Double_t DecayLengthXYError() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::DecayLengthXYError(fOwnPrimaryVtx);}
-  Double_t NormalizedDecayLengthXY() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::NormalizedDecayLengthXY(fOwnPrimaryVtx);}
-  Double_t Ct(UInt_t pdg) const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::Ct(pdg,fOwnPrimaryVtx);}
-  Double_t CosPointingAngle() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::CosPointingAngle(fOwnPrimaryVtx);}
-  Double_t CosPointingAngleXY() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::CosPointingAngleXY(fOwnPrimaryVtx);}
-  Double_t ImpParXY() const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::ImpParXY(fOwnPrimaryVtx);}
-  Double_t QtProngFlightLine(Int_t ip) const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::QtProngFlightLine(ip,fOwnPrimaryVtx);}
-  Double_t QlProngFlightLine(Int_t ip) const 
-    {CheckOwnPrimaryVtx();return AliAODRecoDecay::QlProngFlightLine(ip,fOwnPrimaryVtx);}
-
-  // prongs
-  Double_t Getd0errProng(Int_t ip) const {return fd0err[ip];}
-  Double_t Normalizedd0Prong(Int_t ip) const 
-    {return Getd0Prong(ip)/Getd0errProng(ip);}
-  
-
- protected:
-
-  AliAODVertex *fOwnPrimaryVtx; // primary vertex for this candidate
-  Double_t      *fd0err;  //[fNProngs] error on prongs rphi impact param [cm]
-
-  ClassDef(AliAODRecoDecayHF,1)  // base class for AOD reconstructed 
-                                 // heavy-flavour decays
-};
-
-#endif
diff --git a/PWG3/AliAODRecoDecayHF2Prong.cxx b/PWG3/AliAODRecoDecayHF2Prong.cxx
deleted file mode 100644
index 799625ba581..00000000000
--- a/PWG3/AliAODRecoDecayHF2Prong.cxx
+++ /dev/null
@@ -1,204 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2006, 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.                  *
- **************************************************************************/
-
-/////////////////////////////////////////////////////////////
-//
-// Base class for AOD reconstructed heavy-flavour 2-prong decay
-//
-// Author: A.Dainese, andrea.dainese@lnl.infn.it
-/////////////////////////////////////////////////////////////
-
-#include 
-#include "AliAODRecoDecayHF.h"
-#include "AliAODRecoDecayHF2Prong.h"
-
-ClassImp(AliAODRecoDecayHF2Prong)
-
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong() :
-  AliAODRecoDecayHF()
-{
-  //
-  // Default Constructor
-  //
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong(AliAODVertex *vtx2,
-						 Double_t *px,Double_t *py,Double_t *pz,
-						 Double_t *d0,Double_t *d0err,Float_t dca) :
-  AliAODRecoDecayHF(vtx2,2,0,px,py,pz,d0,d0err)
-{
-  //
-  // Constructor with AliAODVertex for decay vertex
-  //
-  SetDCA(dca);
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong(AliAODVertex *vtx2,
-						 Double_t *d0,Double_t *d0err,Float_t dca) :
-  AliAODRecoDecayHF(vtx2,2,0,d0,d0err)
-{
-  //
-  // Constructor with AliAODVertex for decay vertex and without prongs momenta
-  //
-  SetDCA(dca);
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF2Prong::AliAODRecoDecayHF2Prong(const AliAODRecoDecayHF2Prong &source) :
-  AliAODRecoDecayHF(source)
-{
-  //
-  // Copy constructor
-  //
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF2Prong &AliAODRecoDecayHF2Prong::operator=(const AliAODRecoDecayHF2Prong &source)
-{
-  //
-  // assignment operator
-  //
-  if(&source == this) return *this;
-  fOwnPrimaryVtx = source.fOwnPrimaryVtx;
-  fSecondaryVtx = source.fSecondaryVtx;
-  fCharge = source.fCharge;
-  fNProngs = source.fNProngs;
-  fNDCA = source.fNDCA;
-  fNPID = source.fNPID;
-  fEventNumber = source.fEventNumber;
-  fRunNumber = source.fRunNumber;
-  if(source.GetNProngs()>0) {
-    fd0 = new Double_t[GetNProngs()];
-    fd0err = new Double_t[GetNProngs()];
-    memcpy(fd0,source.fd0,GetNProngs()*sizeof(Double_t));
-    memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
-    if(source.fPx) {
-      fPx = new Double_t[GetNProngs()];
-      fPy = new Double_t[GetNProngs()];
-      fPz = new Double_t[GetNProngs()];
-      memcpy(fPx,source.fPx,GetNProngs()*sizeof(Double_t));
-      memcpy(fPy,source.fPy,GetNProngs()*sizeof(Double_t));
-      memcpy(fPz,source.fPz,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fPID) {
-      fPID = new Double_t[5*GetNProngs()];
-      memcpy(fPID,source.fPID,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fDCA) {
-      fDCA = new Float_t[GetNProngs()*(GetNProngs()-1)/2];
-      memcpy(fDCA,source.fDCA,(GetNProngs()*(GetNProngs()-1)/2)*sizeof(Float_t));
-    }
-  }
-  return *this;
-}
-//--------------------------------------------------------------------------
-Bool_t AliAODRecoDecayHF2Prong::SelectD0(const Double_t *cuts,Int_t &okD0,Int_t &okD0bar) 
-  const {
-//
-// This function compares the D0 with a set of cuts:
-//
-// cuts[0] = inv. mass half width [GeV]   
-// cuts[1] = dca [cm]
-// cuts[2] = cosThetaStar 
-// cuts[3] = pTK [GeV/c]
-// cuts[4] = pTPi [GeV/c]
-// cuts[5] = d0K [cm]   upper limit!
-// cuts[6] = d0Pi [cm]  upper limit!
-// cuts[7] = d0d0 [cm^2]
-// cuts[8] = cosThetaPoint
-//
-// If the D0/D0bar doesn't pass the cuts it sets the weights to 0
-// If neither D0 nor D0bar pass the cuts return kFALSE
-//
-  Double_t mD0,mD0bar,ctsD0,ctsD0bar;
-  okD0=1; okD0bar=1;
-
-  Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
-
-  if(PtProng(1) < cuts[3] || PtProng(0) < cuts[4]) okD0 = 0;
-  if(PtProng(0) < cuts[3] || PtProng(1) < cuts[4]) okD0bar = 0;
-  if(!okD0 && !okD0bar) return kFALSE;
-
-  if(TMath::Abs(Getd0Prong(1)) > cuts[5] || 
-     TMath::Abs(Getd0Prong(0)) > cuts[6]) okD0 = 0;
-  if(TMath::Abs(Getd0Prong(0)) > cuts[6] ||
-     TMath::Abs(Getd0Prong(1)) > cuts[5]) okD0bar = 0;
-  if(!okD0 && !okD0bar) return kFALSE;
-
-  if(GetDCA() > cuts[1]) { okD0 = okD0bar = 0; return kFALSE; }
-
-  InvMassD0(mD0,mD0bar);
-  if(TMath::Abs(mD0-mD0PDG)    > cuts[0]) okD0 = 0;
-  if(TMath::Abs(mD0bar-mD0PDG) > cuts[0]) okD0bar = 0;
-  if(!okD0 && !okD0bar) return kFALSE;
-
-  CosThetaStarD0(ctsD0,ctsD0bar);
-  if(TMath::Abs(ctsD0)    > cuts[2]) okD0 = 0;
-  if(TMath::Abs(ctsD0bar) > cuts[2]) okD0bar = 0;
-  if(!okD0 && !okD0bar) return kFALSE;
-
-  if(Prodd0d0() > cuts[7]) { okD0 = okD0bar = 0; return kFALSE; }
-
-  if(CosPointingAngle()   < cuts[8]) { okD0 = okD0bar = 0; return kFALSE; }
-
-  return kTRUE;
-}
-//-----------------------------------------------------------------------------
-Bool_t AliAODRecoDecayHF2Prong::SelectBtoJPSI(const Double_t *cuts,Int_t &okB)
-  const {
-//
-// This function compares the Secondary JPSI candidates with a set of cuts:
-//
-// cuts[0] = inv. mass half width [GeV]
-// cuts[1] = dca [cm]
-// cuts[2] = cosThetaStar (negative electron)
-// cuts[3] = pTP [GeV/c]
-// cuts[4] = pTN [GeV/c]
-// cuts[5] = d0P [cm]   upper limit!
-// cuts[6] = d0N [cm]  upper limit!
-// cuts[7] = d0d0 [cm^2]
-// cuts[8] = cosThetaPoint
-//
-// If the candidate doesn't pass the cuts it sets the weight to 0
-// and return kFALSE
-//
-  Double_t mJPsi,ctsJPsi;
-  okB=1;
-
-  Double_t mJPSIPDG = TDatabasePDG::Instance()->GetParticle(443)->Mass();
-
-  if(PtProng(1) < cuts[3] || PtProng(0) < cuts[4]) okB = 0;
-  if(!okB) return kFALSE;
-
-  if(TMath::Abs(Getd0Prong(1)) > cuts[5] ||
-     TMath::Abs(Getd0Prong(0)) > cuts[6]) okB = 0;
-  if(!okB) return kFALSE;
-
-  if(GetDCA() > cuts[1]) { okB = 0; return kFALSE; }
-
-  mJPsi=InvMassJPSIee();
-  if(TMath::Abs(mJPsi-mJPSIPDG)    > cuts[0]) okB = 0;
-  if(!okB) return kFALSE;
-
-  ctsJPsi=CosThetaStarJPSI();
-  if(TMath::Abs(ctsJPsi)    > cuts[2]) okB = 0;
-  if(!okB) return kFALSE;
-
-  if(Prodd0d0() > cuts[7]) { okB = 0; return kFALSE; }
-
-  if(CosPointingAngle()   < cuts[8]) { okB = 0; return kFALSE; }
-
-  return kTRUE;
-}
-//-----------------------------------------------------------------------------
diff --git a/PWG3/AliAODRecoDecayHF2Prong.h b/PWG3/AliAODRecoDecayHF2Prong.h
deleted file mode 100644
index 60d556a3a7e..00000000000
--- a/PWG3/AliAODRecoDecayHF2Prong.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef ALIAODRECODECAYHF2PRONG_H
-#define ALIAODRECODECAYHF2PRONG_H
-/* Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-//***********************************************************
-// Class AliAODRecoDecayHF2Prong
-// base class for AOD reconstructed 2-prong heavy-flavour decays
-// (D0->Kpi, J/psi->ee, ...)
-// Author: A.Dainese, andrea.dainese@lnl.infn.it
-//         G.E.Bruno, giuseppe.bruno@ba.infn.it 
-//***********************************************************
-
-#include "AliAODRecoDecay.h"
-#include "AliAODRecoDecayHF.h"
-
-class AliAODRecoDecayHF2Prong : public AliAODRecoDecayHF {
-
- public:
-
-  AliAODRecoDecayHF2Prong();
-  AliAODRecoDecayHF2Prong(AliAODVertex *vtx2,
-			  Double_t *px,Double_t *py,Double_t *pz,
-			  Double_t *d0,Double_t *d0err,Float_t dca);
-  AliAODRecoDecayHF2Prong(AliAODVertex *vtx2,
-			  Double_t *d0,Double_t *d0err,Float_t dca);    
-  AliAODRecoDecayHF2Prong(const AliAODRecoDecayHF2Prong& source);
-  AliAODRecoDecayHF2Prong& operator=(const AliAODRecoDecayHF2Prong& source); 
-
-  virtual ~AliAODRecoDecayHF2Prong() {}  
- 
-  Double_t Prodd0d0() const {return AliAODRecoDecay::Prodd0d0(0,1);} 
-
-  // D0->Kpi
-  Double_t ED0() const {return E(421);} 
-  Double_t YD0() const {return Y(421);} 
-
-  Double_t CtD0() const {return Ct(421);} 
-  Double_t CtD0(Double_t point[3]) const {return AliAODRecoDecay::Ct(421,point);}
-  Double_t CtD0(AliAODVertex *vtx1) const {return AliAODRecoDecay::Ct(421,vtx1);}
-
-  Double_t CosThetaStarD0() const {return CosThetaStar(1,421,211,321);} // angle of K
-  Double_t CosThetaStarD0bar() const {return CosThetaStar(0,421,321,211);} // angle of K
-  void CosThetaStarD0(Double_t &ctsD0,Double_t &ctsD0bar) const 
-    {ctsD0=CosThetaStarD0();ctsD0bar=CosThetaStarD0bar();return;}
-
-  Double_t InvMassD0() const {UInt_t pdg[2]={211,321};return InvMass(2,pdg);}
-  Double_t InvMassD0bar() const {UInt_t pdg[2]={321,211};return InvMass(2,pdg);}
-  void InvMassD0(Double_t &mD0,Double_t &mD0bar) const 
-    {mD0=InvMassD0();mD0bar=InvMassD0bar();return;}
-
-  Bool_t   SelectD0(const Double_t* cuts,Int_t &okD0,Int_t &okD0bar) const;
-
-  // Jpsi (from B) -> ee
-  Double_t EJPSI() const {return E(443);}
-  Double_t YJPSI() const {return Y(443);}
-
-  Double_t CtJPSI() const {return Ct(443);}
-  Double_t CtJPSI(Double_t point[3]) const {return AliAODRecoDecay::Ct(443,point);}
-  Double_t CtJPSI(AliAODVertex *vtx1) const {return AliAODRecoDecay::Ct(443,vtx1);}
-
-  Double_t CosThetaStarJPSI() const {return CosThetaStar(1,443,11,11);} // angle of e-
-
-  Double_t InvMassJPSIee() const {UInt_t pdg[2]={11,11};return InvMass(2,pdg);}
-
-  Bool_t   SelectBtoJPSI(const Double_t* cuts,Int_t &okB) const;
-  
-
- private:
-
-  ClassDef(AliAODRecoDecayHF2Prong,1)  // base class for AOD reconstructed 
-                                       // heavy-flavour 2-prong decays
-};
-
-#endif
diff --git a/PWG3/AliAODRecoDecayHF3Prong.cxx b/PWG3/AliAODRecoDecayHF3Prong.cxx
deleted file mode 100644
index 67f54f1da4a..00000000000
--- a/PWG3/AliAODRecoDecayHF3Prong.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2006, 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.                  *
- **************************************************************************/
-
-/////////////////////////////////////////////////////////////
-//
-// Base class for AOD reconstructed heavy-flavour 3-prong decay
-//
-// Author: E.Bruna bruna@to.infn.it, F.Prino prino@to.infn.it
-/////////////////////////////////////////////////////////////
-
-#include 
-#include "AliAODRecoDecayHF.h"
-#include "AliAODRecoDecayHF3Prong.h"
-
-ClassImp(AliAODRecoDecayHF3Prong)
-
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong() :
-  AliAODRecoDecayHF(), 
-  fSigmaVert(0),
-  fDist12toPrim(0),
-  fDist23toPrim(0)
-{
-  //
-  // Default Constructor
-  //
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
-						 Double_t *px,Double_t *py,Double_t *pz,
-						 Double_t *d0,Double_t *d0err,
-						 Double_t *dca, Double_t sigvert,
-						 Double_t dist12,Double_t dist23,Short_t charge) :
-  AliAODRecoDecayHF(vtx2,3,charge,px,py,pz,d0,d0err),
-  fSigmaVert(sigvert),
-  fDist12toPrim(dist12),
-  fDist23toPrim(dist23)
-{
-  //
-  // Constructor with AliAODVertex for decay vertex
-  //
-  Float_t dcafloat[3];
-  for(Int_t i=0;i<3;i++)dcafloat[i]=dca[i];
-  SetDCAs(3,dcafloat);
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
-						 Double_t *d0,Double_t *d0err,
-						 Double_t *dca, Double_t sigvert,
-						 Double_t dist12,Double_t dist23, Short_t charge) :
-  AliAODRecoDecayHF(vtx2,3,charge,d0,d0err),
-  fSigmaVert(sigvert),
-  fDist12toPrim(dist12),
-  fDist23toPrim(dist23)
-{
-  //
-  // Constructor with AliAODVertex for decay vertex and without prongs momenta
-  //
-  Float_t dcafloat[3];
-  for(Int_t i=0;i<3;i++)dcafloat[i]=dca[i];
-  SetDCAs(3,dcafloat);
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF3Prong::AliAODRecoDecayHF3Prong(const AliAODRecoDecayHF3Prong &source) :
-  AliAODRecoDecayHF(source),
-  fSigmaVert(source.fSigmaVert),
-  fDist12toPrim(source.fDist12toPrim),
-  fDist23toPrim(source.fDist23toPrim)
-{
-  //
-  // Copy constructor
-  //
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF3Prong &AliAODRecoDecayHF3Prong::operator=(const AliAODRecoDecayHF3Prong &source)
-{
-  //
-  // assignment operator
-  //
-  if(&source == this) return *this;
-  fOwnPrimaryVtx = source.fOwnPrimaryVtx;
-  fSecondaryVtx = source.fSecondaryVtx;
-  fCharge = source.fCharge;
-  fNProngs = source.fNProngs;
-  fNDCA = source.fNDCA;
-  fNPID = source.fNPID;
-  fEventNumber = source.fEventNumber;
-  fRunNumber = source.fRunNumber;
-  fDist12toPrim= source.fDist12toPrim;
-  fDist23toPrim= source.fDist23toPrim;
-  fSigmaVert= source.fSigmaVert;
-  if(source.GetNProngs()>0) {
-    fd0 = new Double_t[GetNProngs()];
-    fd0err = new Double_t[GetNProngs()];
-    memcpy(fd0,source.fd0,GetNProngs()*sizeof(Double_t));
-    memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
-    if(source.fPx) {
-      fPx = new Double_t[GetNProngs()];
-      fPy = new Double_t[GetNProngs()];
-      fPz = new Double_t[GetNProngs()];
-      memcpy(fPx,source.fPx,GetNProngs()*sizeof(Double_t));
-      memcpy(fPy,source.fPy,GetNProngs()*sizeof(Double_t));
-      memcpy(fPz,source.fPz,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fPID) {
-      fPID = new Double_t[5*GetNProngs()];
-      memcpy(fPID,source.fPID,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fDCA) {
-      fDCA = new Float_t[GetNProngs()*(GetNProngs()-1)/2];
-      memcpy(fDCA,source.fDCA,(GetNProngs()*(GetNProngs()-1)/2)*sizeof(Float_t));
-    }
-  }
-  return *this;
-}
-//--------------------------------------------------------------------------
-Bool_t AliAODRecoDecayHF3Prong::SelectDplus(const Double_t *cuts)
-  const {
-//
-// This function compares the Dplus with a set of cuts:
-//
-// cuts[0] = inv. mass half width [GeV]   
-// cuts[1] = pTK [GeV/c]
-// cuts[2] = pTPi [GeV/c]
-// cuts[3] = d0K [cm]   lower limit!
-// cuts[4] = d0Pi [cm]  lower limit!
-// cuts[5] = dist12 (cm)
-// cuts[6] = sigmavert (cm)
-// cuts[7] = dist prim-sec (cm)
-// cuts[8] = pM=Max{pT1,pT2,pT3} (GeV/c)
-// cuts[9] = cosThetaPoint
-// cuts[10] = Sum d0^2 (cm^2)
-// cuts[11] = dca cut (cm)
-//
-// If candidate Dplus does not pass the cuts return kFALSE
-//
-
-  Double_t mDplusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
-  Double_t mDplus=InvMassDplus();
-  if(TMath::Abs(mDplus-mDplusPDG)>cuts[0])return kFALSE;
-  //single track
-  if(TMath::Abs(PtProng(1)) < cuts[1] || TMath::Abs(Getd0Prong(1))0 && GetDCA(i)>cuts[11])return kFALSE;
-
-  //2track cuts
-  if(fDist12toPrimcuts[6])return kFALSE;
-
-  if(DecayLength()Kpipi, Ds->KKpi ...)
-// Author: E.Bruna bruna@to.infn.it, F.Prino prino@to.infn.it
-//***********************************************************
-
-#include "AliAODRecoDecay.h"
-#include "AliAODRecoDecayHF.h"
-
-class AliAODRecoDecayHF3Prong : public AliAODRecoDecayHF {
-
- public:
-
-  AliAODRecoDecayHF3Prong();
-   AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
-			   Double_t *px,Double_t *py,Double_t *pz,
-			   Double_t *d0,Double_t *d0err,
-			   Double_t *dca, Double_t sigvert,
-			   Double_t dist12,Double_t dist23,Short_t charge);
-   AliAODRecoDecayHF3Prong(AliAODVertex *vtx2,
-			   Double_t *d0,Double_t *d0err,
-			   Double_t *dca, Double_t sigvert,
-			   Double_t dist12,Double_t dist23, Short_t charge);
-
-  AliAODRecoDecayHF3Prong(const AliAODRecoDecayHF3Prong& source);
-  AliAODRecoDecayHF3Prong& operator=(const AliAODRecoDecayHF3Prong& source); 
-
-  virtual ~AliAODRecoDecayHF3Prong() {}  
- 
-  void GetDCAs(Float_t dca[3]) const 
-    {for(Int_t i=0;i<3;i++) dca[i]=GetDCA(i);}
-
-
-  // D+->Kpipi
-  Double_t EDplus() const {return E(411);} 
-  Double_t YDplus() const {return Y(411);} 
-  Double_t CtDplus() const {return Ct(411);} 
-  Double_t CtDplus(Double_t point[3]) const {return AliAODRecoDecay::Ct(411,point);}
-  Double_t CtDplus(AliAODVertex *vtx1) const {return AliAODRecoDecay::Ct(411,vtx1);}
-  Double_t InvMassDplus() const {UInt_t pdg[3]={211,321,211};return InvMass(3,pdg);}
-  Bool_t   SelectDplus(const Double_t* cuts) const;
-
- // Ds+->KKpi
-  Double_t EDs() const {return E(431);} 
-  Double_t YDs() const {return Y(431);} 
-  Double_t CtDs() const {return Ct(431);} 
-  Double_t CtDs(Double_t point[3]) const {return AliAODRecoDecay::Ct(431,point);}
-  Double_t CtDs(AliAODVertex *vtx1) const {return AliAODRecoDecay::Ct(431,vtx1);}
-  Double_t InvMassDsKKpi() const {UInt_t pdg[3]={321,321,211};return InvMass(3,pdg);}
-  Double_t InvMassDspiKK() const {UInt_t pdg[3]={211,321,321};return InvMass(3,pdg);}
-  Bool_t   SelectDs(const Double_t* cuts,Int_t &okDsKKpi,Int_t &okDspiKK) 
-    const;//to be implemented
-
- private:
-
-  Double_t fSigmaVert; // track dispersion around the secondary vertex
-  Double_t fDist12toPrim; //distance prim vert - 2 opposite sign track vertex 
-  Double_t fDist23toPrim; //distance prim vert - 2 opposite sign track vertex
-
-
-
-  ClassDef(AliAODRecoDecayHF3Prong,1)  // base class for AOD reconstructed 
-                                       // heavy-flavour 3-prong decays
-};
-
-#endif
diff --git a/PWG3/AliAODRecoDecayHF4Prong.cxx b/PWG3/AliAODRecoDecayHF4Prong.cxx
deleted file mode 100644
index 11e6261c269..00000000000
--- a/PWG3/AliAODRecoDecayHF4Prong.cxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2006, 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.                  *
- **************************************************************************/
-
-/////////////////////////////////////////////////////////////
-//
-// Base class for AOD reconstructed heavy-flavour 4-prong decay
-//
-// Authors: G.E.Bruno Giuseppe.Bruno@to.infn.it, R.Romita Rossella.Romita@ba.infn.it
-/////////////////////////////////////////////////////////////
-
-#include 
-#include "AliAODRecoDecayHF.h"
-#include "AliAODRecoDecayHF4Prong.h"
-#include "TRandom.h" // for the time being
-
-ClassImp(AliAODRecoDecayHF4Prong)
-
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF4Prong::AliAODRecoDecayHF4Prong() :
-  AliAODRecoDecayHF(), 
-  //fSigmaVert(0),
-  fDist12toPrim(0),
-  fDist23toPrim(0),
-  fDist14toPrim(0),
-  fDist34toPrim(0)
-{
-  //
-  // Default Constructor
-  //
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF4Prong::AliAODRecoDecayHF4Prong(AliAODVertex *vtx2,
-						 Double_t *px,Double_t *py,Double_t *pz,
-						 Double_t *d0,Double_t *d0err,
-						 Double_t *dca, //Double_t sigvert,
-						 Double_t dist12,Double_t dist23,
-						 Double_t dist14,Double_t dist34,
-						 Short_t charge) :
-  AliAODRecoDecayHF(vtx2,4,charge,px,py,pz,d0,d0err),
-  // fSigmaVert(sigvert),
-  fDist12toPrim(dist12),
-  fDist23toPrim(dist23),
-  fDist14toPrim(dist14),
-  fDist34toPrim(dist34)
-{
-  //
-  // Constructor with AliAODVertex for decay vertex
-  //
-  Float_t dcafloat[6];
-  for(Int_t i=0;i<6;i++) dcafloat[i]=dca[i];
-  SetDCAs(6,dcafloat);
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF4Prong::AliAODRecoDecayHF4Prong(AliAODVertex *vtx2,
-						 Double_t *d0,Double_t *d0err,
-						 Double_t *dca, //Double_t sigvert,
-						 Double_t dist12,Double_t dist23, 
-						 Double_t dist14,Double_t dist34, 
-						 Short_t charge) :
-  AliAODRecoDecayHF(vtx2,4,charge,d0,d0err),
-  //fSigmaVert(sigvert),
-  fDist12toPrim(dist12),
-  fDist23toPrim(dist23),
-  fDist14toPrim(dist14),
-  fDist34toPrim(dist34)
-{
-  //
-  // Constructor with AliAODVertex for decay vertex and without prongs momenta
-  //
-  Float_t dcafloat[6];
-  for(Int_t i=0;i<6;i++) dcafloat[i]=dca[i];
-  SetDCAs(6,dcafloat);
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF4Prong::AliAODRecoDecayHF4Prong(const AliAODRecoDecayHF4Prong &source) :
-  AliAODRecoDecayHF(source),
-  //fSigmaVert(source.fSigmaVert),
-  fDist12toPrim(source.fDist12toPrim),
-  fDist23toPrim(source.fDist23toPrim),
-  fDist14toPrim(source.fDist14toPrim),
-  fDist34toPrim(source.fDist34toPrim)
-{
-  //
-  // Copy constructor
-  //
-}
-//--------------------------------------------------------------------------
-AliAODRecoDecayHF4Prong &AliAODRecoDecayHF4Prong::operator=(const AliAODRecoDecayHF4Prong &source)
-{
-  //
-  // assignment operator
-  //
-  if(&source == this) return *this;
-  fOwnPrimaryVtx = source.fOwnPrimaryVtx;
-  fSecondaryVtx = source.fSecondaryVtx;
-  fCharge = source.fCharge;
-  fNProngs = source.fNProngs;
-  fNDCA = source.fNDCA;
-  fNPID = source.fNPID;
-  fEventNumber = source.fEventNumber;
-  fRunNumber = source.fRunNumber;
-  fDist12toPrim= source.fDist12toPrim;
-  fDist23toPrim= source.fDist23toPrim;
-  fDist14toPrim= source.fDist14toPrim;
-  fDist34toPrim= source.fDist34toPrim;
-  //fSigmaVert= source.fSigmaVert;
-  if(source.GetNProngs()>0) {
-    fd0 = new Double_t[GetNProngs()];
-    fd0err = new Double_t[GetNProngs()];
-    memcpy(fd0,source.fd0,GetNProngs()*sizeof(Double_t));
-    memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
-    if(source.fPx) {
-      fPx = new Double_t[GetNProngs()];
-      fPy = new Double_t[GetNProngs()];
-      fPz = new Double_t[GetNProngs()];
-      memcpy(fPx,source.fPx,GetNProngs()*sizeof(Double_t));
-      memcpy(fPy,source.fPy,GetNProngs()*sizeof(Double_t));
-      memcpy(fPz,source.fPz,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fPID) {
-      fPID = new Double_t[5*GetNProngs()];
-      memcpy(fPID,source.fPID,GetNProngs()*sizeof(Double_t));
-    }
-    if(source.fDCA) {
-      fDCA = new Float_t[GetNProngs()*(GetNProngs()-1)/2];
-      memcpy(fDCA,source.fDCA,(GetNProngs()*(GetNProngs()-1)/2)*sizeof(Float_t));
-    }
-  }
-  return *this;
-}
-//--------------------------------------------------------------------------
-Bool_t AliAODRecoDecayHF4Prong::SelectD0(const Double_t *cuts,Int_t &okD0,Int_t &okD0bar)
-  const {
-//
-// This function compares the D0 with a set of cuts:
-// 
-// to be implemented 
-//
-// cuts[1] = ... 
-// cuts[2] = ...
-// cuts[3] = ...
-// cuts[4] = ...
-//
-// If candidate D0 does not pass the cuts return kFALSE
-//
-
-  Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
-  Double_t mD0=InvMassD0();
-  if(TMath::Abs(mD0-mD0PDG)>cuts[0]) return kFALSE;
-
-  //single track
-  //if(TMath::Abs(PtProng(2)) < cuts[2] || TMath::Abs(Getd0Prong(2))0 && GetDCA(i)>cuts[11])return kFALSE;
-
-  //2track cuts
-  //if(fDist12toPrimcuts[6])return kFALSE;
-
-  //if(DecayLength()Kpipipi, etc...)
-// Authors: G.E.Bruno Giuseppe.Bruno@ba.infn.it, R.Romita Rossella.Romita@ba.infn.it
-//***********************************************************
-
-#include "AliAODRecoDecay.h"
-#include "AliAODRecoDecayHF.h"
-
-class AliAODRecoDecayHF4Prong : public AliAODRecoDecayHF {
-
- public:
-
-  AliAODRecoDecayHF4Prong();
-  AliAODRecoDecayHF4Prong(AliAODVertex *vtx2,
-			   Double_t *px,Double_t *py,Double_t *pz,
-			   Double_t *d0,Double_t *d0err,
-			   Double_t *dca, //Double_t sigvert,
-			   Double_t dist12,Double_t dist23, 
-			   Double_t dist14,Double_t dist34, 
-                           Short_t charge);
-   AliAODRecoDecayHF4Prong(AliAODVertex *vtx2,
-			   Double_t *d0,Double_t *d0err,
-			   Double_t *dca, //Double_t sigvert,
-			   Double_t dist12,Double_t dist23, 
-			   Double_t dist14,Double_t dist34, 
-			   Short_t charge);
-
-  AliAODRecoDecayHF4Prong(const AliAODRecoDecayHF4Prong& source);
-  AliAODRecoDecayHF4Prong& operator=(const AliAODRecoDecayHF4Prong& source); 
-
-  virtual ~AliAODRecoDecayHF4Prong() {}  
- 
-  void GetDCAs(Float_t dca[6]) const 
-    {for(Int_t i=0;i<6;i++) dca[i]=GetDCA(i);} // convention:fDCA[0]=p0p1,fDCA[1]=p0p2,fDCA[2]=p0p3,fDCA[3]=p1p2...
-
-
-  // D0->pi+K- pipi and D0bar->K+pi- pipi (in the order given) 
-  Double_t ED0() const {return E(421);}
-  Double_t YD0() const {return Y(421);} 
-  Double_t CtD0() const {return Ct(421);} 
-  Double_t CtD0(Double_t point[3]) const {return AliAODRecoDecay::Ct(421,point);}
-  Double_t CtD0(AliAODVertex *vtx1) const {return AliAODRecoDecay::Ct(421,vtx1);}
-  Double_t InvMassRho() const {return InvMass2Prongs(2,3,211,211);} 
-  Double_t InvMassD0() const {UInt_t pdg[4]={211,321,211,211};return InvMass(4,pdg);}
-  Double_t InvMassD0bar() const {UInt_t pdg[4]={321,211,211,211};return InvMass(4,pdg);}
-  void InvMassD0(Double_t &mD0,Double_t &mD0bar) const
-    {mD0=InvMassD0();mD0bar=InvMassD0bar();return;}
-
-
-  Bool_t   SelectD0(const Double_t* cuts,Int_t &okD0,Int_t &okD0bar) const;
-
-
- private:
-
-  //Double_t fSigmaVert; // track dispersion around the secondary vertex
-  Double_t fDist12toPrim; //distance prim vert - 2 opposite sign track vertex 
-  Double_t fDist23toPrim; //distance prim vert - 2 opposite sign track vertex 
-  Double_t fDist14toPrim; //distance prim vert - 2 opposite sign track vertex 
-  Double_t fDist34toPrim; //distance prim vert - 2 opposite sign track vertex 
-  //Double_t fDist123toPrim;  //distance 
-
-  ClassDef(AliAODRecoDecayHF4Prong,1)  // base class for AOD reconstructed 
-                                       // heavy-flavour 3-prong decays
-};
-
-#endif
diff --git a/PWG3/AliAnalysisVertexingHF.cxx b/PWG3/AliAnalysisVertexingHF.cxx
deleted file mode 100644
index fb86899dd4e..00000000000
--- a/PWG3/AliAnalysisVertexingHF.cxx
+++ /dev/null
@@ -1,981 +0,0 @@
-/**************************************************************************
- * Copyright(c) 1998-2007, 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.                  *
- **************************************************************************/
-
-//----------------------------------------------------------------------------
-//    Implementation of the heavy-flavour vertexing analysis class
-// Candidates are store as objects deriving from AliAODRecoDecay.
-// An example of usage can be found in the macro AliVertexingHFTest.C.
-// Can be used as a task of AliAnalysisManager by means of the interface
-// class AliAnalysisTaskVertexingHF. 
-//
-//  Origin: E.Bruna, G.E.Bruno, A.Dainese, F.Prino, R.Romita
-//----------------------------------------------------------------------------
-#include 
-#include 
-#include 
-#include "AliESD.h"
-#include "AliVertexerTracks.h"
-#include "AliESDVertex.h"
-#include "AliESDv0.h"
-#include "AliAODRecoDecay.h"
-#include "AliAODRecoDecayHF.h"
-#include "AliAODRecoDecayHF2Prong.h"
-#include "AliAODRecoDecayHF3Prong.h"
-#include "AliAODRecoDecayHF4Prong.h"
-#include "AliAnalysisVertexingHF.h"
-
-ClassImp(AliAnalysisVertexingHF)
-
-//----------------------------------------------------------------------------
-AliAnalysisVertexingHF::AliAnalysisVertexingHF():
-fRecoPrimVtxSkippingTrks(kFALSE),
-fRmTrksFromPrimVtx(kFALSE),
-fV1(0x0),
-fDebug(0),
-fD0toKpi(kTRUE),fJPSItoEle(kTRUE),f3Prong(kTRUE),f4Prong(kTRUE),
-fITSrefit(kFALSE),fBothSPD(kTRUE),fMinITSCls(5),
-fMinPtCut(0.),fMind0rphiCut(0.)
-{
-  // Default constructor
-
-  SetD0toKpiCuts();
-  SetBtoJPSICuts();
-  SetDplusCuts();
-}
-//----------------------------------------------------------------------------
-AliAnalysisVertexingHF::~AliAnalysisVertexingHF() {
-  // Destructor
-  if(fV1) delete fV1;
-}
-//----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::FindCandidates(AliESD *esd,TTree treeout[])
-{
-  // Find heavy-flavour vertex candidates
-
-  
-  AliAODRecoDecayHF2Prong *io2Prong = new AliAODRecoDecayHF2Prong;
-  AliAODRecoDecayHF3Prong *io3Prong = new AliAODRecoDecayHF3Prong;
-  AliAODRecoDecayHF4Prong *io4Prong = new AliAODRecoDecayHF4Prong;
-  Int_t itree=0;
-  Int_t itreeD0toKpi=-1,itreeJPSItoEle=-1,itree3Prong=-1,itree4Prong=-1;
-  Int_t initEntriesD0toKpi=0,initEntriesJPSItoEle=0,initEntries3Prong=0,initEntries4Prong=0;
-  if(fD0toKpi) {
-    itreeD0toKpi=itree;
-    //treeout[itree].Print();
-    treeout[itree].SetBranchAddress("D0toKpi",&io2Prong);
-    itree++;
-    initEntriesD0toKpi = treeout[itreeD0toKpi].GetEntries();
-  }
-  if(fJPSItoEle) {
-    itreeJPSItoEle=itree;
-    //treeout[itree].Print();
-    treeout[itree].SetBranchAddress("JPSItoEle",&io2Prong);
-    itree++;
-    initEntriesJPSItoEle = treeout[itreeJPSItoEle].GetEntries();
-  }
-  if(f3Prong) {
-    itree3Prong=itree;
-    treeout[itree].SetBranchAddress("Charmto3Prong",&io3Prong);
-    itree++;
-    initEntries3Prong = treeout[itree3Prong].GetEntries();
-  }
-  if(f4Prong) {
-    itree4Prong=itree;
-    treeout[itree].SetBranchAddress("D0to4Prong",&io4Prong);
-    itree++;
-    initEntries4Prong = treeout[itree4Prong].GetEntries();
-  }
-  delete io2Prong; io2Prong = NULL;
-  delete io3Prong; io3Prong = NULL;
-  delete io4Prong; io4Prong = NULL;
-
-  Int_t    iTrkP1,iTrkP2,iTrkN1,iTrkN2,trkEntries;
-  Int_t    nTrksP=0,nTrksN=0;
-  Double_t xdummy,ydummy,dcap1n1,dcap1n2,dcap2n1,dcap1p2,dcan1n2;
-  Bool_t   okD0=kFALSE,okJPSI=kFALSE,ok3Prong=kFALSE,ok4Prong=kFALSE;
-  AliESDtrack *postrack1 = 0;
-  AliESDtrack *postrack2 = 0;
-  AliESDtrack *negtrack1 = 0;
-  AliESDtrack *negtrack2 = 0;
-  Double_t dcaMax = fD0toKpiCuts[1];
-  if(dcaMaxGetMagneticField());
-  vertexer2->SetDebug(0);
-
-  Int_t ev = (Int_t)esd->GetEventNumberInFile();
-  printf("--- Finding candidates in event %d\n",ev);
-
-  Double_t bfieldkG=(Double_t)esd->GetMagneticField(); 
-
-  trkEntries = (Int_t)esd->GetNumberOfTracks();
-  printf(" Number of tracks: %d\n",trkEntries);
-  if(trkEntries<2) return;
-
-  // retrieve primary vertex from the AliESD
-  if(!esd->GetPrimaryVertex()) { 
-    printf(" No vertex in AliESD\n");
-    return;
-  }
-  AliESDVertex copy(*(esd->GetPrimaryVertex()));
-  SetPrimaryVertex(©);
-  vertexer2->SetVtxStart(©);
-
-  // call function which applies sigle-track selection and
-  // separetes positives and negatives
-  TObjArray trksP(trkEntries/2); // will become TClonesArray
-  TObjArray trksN(trkEntries/2); // will become TClonesArray
-  SelectTracks(esd,trksP,nTrksP,
-	           trksN,nTrksN);
-
-  printf(" Pos. tracks: %d    Neg. tracks: %d\n",nTrksP,nTrksN);
-
-  TObjArray *twoTrackArray1 = new TObjArray(2);
-  TObjArray *twoTrackArray2 = new TObjArray(2);
-  TObjArray *threeTrackArray = new TObjArray(3);
-  TObjArray *fourTrackArray = new TObjArray(4);
-
-  // LOOP ON  POSITIVE  TRACKS
-  for(iTrkP1=0; iTrkP1GetDCA(negtrack1,bfieldkG,xdummy,ydummy);
-      if(dcap1n1>dcaMax) { negtrack1=0; continue; }
-      // Vertexing with AliVertexerTracks
-      twoTrackArray1->AddAt(postrack1,0);
-      twoTrackArray1->AddAt(negtrack1,1);
-      AliESDVertex *vertexp1n1 = vertexer2->VertexForSelectedTracks(twoTrackArray1);
-      if(vertexp1n1->GetNContributors()!=2) { 
-	if(fDebug) printf("two-track vertexing failed\n"); 
-	negtrack1=0; continue; 
-      }
-      if(fD0toKpi || fJPSItoEle) { 
-	io2Prong = Make2Prong(twoTrackArray1,esd,vertexp1n1,dcap1n1,okD0,okJPSI);
-	if(okD0) treeout[itreeD0toKpi].Fill();
-	if(okJPSI) treeout[itreeJPSItoEle].Fill();
-        delete io2Prong; io2Prong=NULL; 
-      }
-
-      twoTrackArray1->Clear(); 
-      if(!f3Prong && !f4Prong)  { 
-	negtrack1=0; 
-	delete vertexp1n1; 
-	continue; 
-      }
-      
-      // 2nd LOOP  ON  POSITIVE  TRACKS 
-      for(iTrkP2=iTrkP1+1; iTrkP2GetDCA(negtrack1,bfieldkG,xdummy,ydummy);
-	if(dcap2n1>dcaMax) { postrack2=0; continue; }
-	dcap1p2 = postrack2->GetDCA(postrack1,bfieldkG,xdummy,ydummy);
-	if(dcap1p2>dcaMax) { postrack2=0; continue; }
-
-	// Vertexing with AliVertexerTracks
-	twoTrackArray2->AddAt(postrack2,0);
-	twoTrackArray2->AddAt(negtrack1,1);
-	AliESDVertex *vertexp2n1 = vertexer2->VertexForSelectedTracks(twoTrackArray2);
-	if(f3Prong) { 
-	  threeTrackArray->AddAt(postrack1,0);
-	  threeTrackArray->AddAt(negtrack1,1);
-	  threeTrackArray->AddAt(postrack2,2);
-	  io3Prong = Make3Prong(threeTrackArray,esd,vertexp1n1,vertexp2n1,dcap1n1,dcap2n1,dcap1p2,ok3Prong);
-	  if(ok3Prong) treeout[itree3Prong].Fill();
-	  if(io3Prong) delete io3Prong; io3Prong=NULL; 
-	}
-	if(f4Prong) {
-	  // 3rd LOOP  ON  NEGATIVE  TRACKS (for 4 prong) 
-	  for(iTrkN2=iTrkN1+1; iTrkN2GetDCA(negtrack2,bfieldkG,xdummy,ydummy);
-	    if(dcap1n2>dcaMax) { negtrack2=0; continue; }
-	    // Vertexing with AliVertexerTracks
-	    fourTrackArray->AddAt(postrack1,0);
-	    fourTrackArray->AddAt(negtrack1,1);
-	    fourTrackArray->AddAt(postrack2,2);
-	    fourTrackArray->AddAt(negtrack2,3);
-	    io4Prong = Make4Prong(fourTrackArray,esd,vertexp1n1,vertexp2n1,dcap1n1,dcap1n2,dcap2n1,ok4Prong);
-	    if(ok4Prong) treeout[itree4Prong].Fill();
-	    delete io4Prong; io4Prong=NULL; 
-            fourTrackArray->Clear();
-	    negtrack2 = 0;
-	  } // end loop on negative tracks
-	}
-	postrack2 = 0;
-	delete vertexp2n1;
-      } // end 2nd loop on positive tracks
-      twoTrackArray2->Clear();
-      
-      // 2nd LOOP  ON  NEGATIVE  TRACKS 
-      for(iTrkN2=iTrkN1+1; iTrkN2GetDCA(negtrack2,bfieldkG,xdummy,ydummy);
-	if(dcap1n2>dcaMax) { negtrack2=0; continue; }
-	dcan1n2 = negtrack1->GetDCA(negtrack2,bfieldkG,xdummy,ydummy);
-	if(dcan1n2>dcaMax) { negtrack2=0; continue; }
-
-	// Vertexing with AliVertexerTracks
-	twoTrackArray2->AddAt(postrack1,0);
-	twoTrackArray2->AddAt(negtrack2,1);
-	AliESDVertex *vertexp1n2 = vertexer2->VertexForSelectedTracks(twoTrackArray2);
-	if(f3Prong) { 
-	  threeTrackArray->AddAt(negtrack1,0);
-	  threeTrackArray->AddAt(postrack1,1);
-	  threeTrackArray->AddAt(negtrack2,2);
-	  io3Prong = Make3Prong(threeTrackArray,esd,vertexp1n1,vertexp1n2,dcap1n1,dcap1n2,dcan1n2,ok3Prong);
-	  if(ok3Prong) treeout[itree3Prong].Fill();
-	  if(io3Prong) delete io3Prong; io3Prong=NULL; 
-	  }
-	negtrack2 = 0;
-	delete vertexp1n2;
-      } // end 2nd loop on negative tracks
-      twoTrackArray2->Clear();
-
-      negtrack1 = 0;
-      delete vertexp1n1; 
-    } // end 1st loop on negative tracks
-
-    postrack1 = 0;
-  }  // end 1st loop on positive tracks
-    
-
-
-  delete vertexer2;
-  //printf("delete twoTr 1\n");
-  twoTrackArray1->Delete(); delete twoTrackArray1;
-  //printf("delete twoTr 2\n");
-  twoTrackArray2->Delete(); delete twoTrackArray2;
-  //printf("delete threeTr 1\n");
-  threeTrackArray->Clear(); 
-  threeTrackArray->Delete(); delete threeTrackArray;
-  //printf("delete fourTr 1\n");
-  fourTrackArray->Delete(); delete fourTrackArray;
-
-
-  // create a copy of this class to be written to output file
-  //AliAnalysisVertexingHF *copy = (AliAnalysisVertexingHF*)this->Clone("AnalysisVertexingHF");
-
-  // print statistics
-  if(fD0toKpi) {
-    printf(" D0->Kpi: event %d = %d; total = %d;\n",
-	   (Int_t)esd->GetEventNumberInFile(),
-	   (Int_t)treeout[itreeD0toKpi].GetEntries()-initEntriesD0toKpi,
-	   (Int_t)treeout[itreeD0toKpi].GetEntries());
-  }
-  if(fJPSItoEle) {
-    printf(" JPSI->ee: event %d = %d; total = %d;\n",
-	   (Int_t)esd->GetEventNumberInFile(),
-	   (Int_t)treeout[itreeJPSItoEle].GetEntries()-initEntriesJPSItoEle,
-	   (Int_t)treeout[itreeJPSItoEle].GetEntries());
-  }
-  if(f3Prong) {
-    printf(" Charm->3Prong: event %d = %d; total = %d;\n",
-	   (Int_t)esd->GetEventNumberInFile(),
-	   (Int_t)treeout[itree3Prong].GetEntries()-initEntries3Prong,
-	   (Int_t)treeout[itree3Prong].GetEntries());
-  }
-  if(f4Prong) {
-    printf(" Charm->4Prong: event %d = %d; total = %d;\n",
-	   (Int_t)esd->GetEventNumberInFile(),
-	   (Int_t)treeout[itree4Prong].GetEntries()-initEntries4Prong,
-	   (Int_t)treeout[itree4Prong].GetEntries());
-  }
-
-
-  return;
-}
-//----------------------------------------------------------------------------
-AliAODRecoDecayHF2Prong *AliAnalysisVertexingHF::Make2Prong(
-				   TObjArray *twoTrackArray1,AliESD *esd,
-				   AliESDVertex *secVertexESD,Double_t dca,
-				   Bool_t &okD0,Bool_t &okJPSI) const
-{
-  // Make 2Prong candidates and check if they pass D0toKpi or BtoJPSI
-  // reconstruction cuts
-  // G.E.Bruno (J/psi), A.Dainese (D0->Kpi)
-
-  okD0=kFALSE; okJPSI=kFALSE;
-
-  Double_t px[2],py[2],pz[2],d0[2],d0err[2];
-  Double_t bfieldkG=(Double_t)esd->GetMagneticField(); 
-
-  AliESDtrack *postrack = (AliESDtrack*)twoTrackArray1->UncheckedAt(0);
-  AliESDtrack *negtrack = (AliESDtrack*)twoTrackArray1->UncheckedAt(1);
-
-  // propagate tracks to secondary vertex, to compute inv. mass
-  postrack->RelateToVertex(secVertexESD,bfieldkG,10.);
-  negtrack->RelateToVertex(secVertexESD,bfieldkG,10.);
-
-  Double_t momentum[3];
-  postrack->GetPxPyPz(momentum);
-  px[0] = momentum[0]; py[0] = momentum[1]; pz[0] = momentum[2]; 
-  negtrack->GetPxPyPz(momentum);
-  px[1] = momentum[0]; py[1] = momentum[1]; pz[1] = momentum[2]; 
-
-
-  // invariant mass cut (try to improve coding here..)
-  Bool_t okMassCut=kFALSE;
-  if(!okMassCut && fD0toKpi) if(SelectInvMass(0,2,px,py,pz)) okMassCut=kTRUE;
-  if(!okMassCut && fJPSItoEle) if(SelectInvMass(1,2,px,py,pz)) okMassCut=kTRUE;
-  if(!okMassCut) {
-    if(fDebug) printf(" candidate didn't pass mass cut\n");
-    return 0x0;    
-  }
-
-
-  AliESDVertex *primVertex = fV1;  
-  AliESDVertex *ownPrimVertex=0;
-
-  // primary vertex from *other* tracks in the event
-  if(fRecoPrimVtxSkippingTrks || fRmTrksFromPrimVtx) {
-    ownPrimVertex = OwnPrimaryVertex(2,twoTrackArray1,esd);
-    if(!ownPrimVertex) {
-      return 0x0;
-    } else {
-      if(ownPrimVertex->GetNContributors()<2) {
-	delete ownPrimVertex;
-	return 0x0;
-      } else {
-	primVertex = ownPrimVertex;
-      }
-    }
-  }
-
-  Float_t d0z0[2],covd0z0[3];
-  postrack->RelateToVertex(primVertex,bfieldkG,10.);
-  postrack->GetImpactParameters(d0z0,covd0z0);
-  d0[0] = d0z0[0];
-  d0err[0] = TMath::Sqrt(covd0z0[0]);
-  negtrack->RelateToVertex(primVertex,bfieldkG,10.);
-  negtrack->GetImpactParameters(d0z0,covd0z0);
-  d0[1] = d0z0[0];
-  d0err[1] = TMath::Sqrt(covd0z0[0]);
-
-  // create the object AliAODRecoDecayHF2Prong
-  Double_t pos[3],cov[6];
-  secVertexESD->GetXYZ(pos); // position
-  secVertexESD->GetCovMatrix(cov); //covariance matrix
-  AliAODVertex *secVertexAOD = new AliAODVertex(pos,cov,secVertexESD->GetChi2toNDF());
-  primVertex->GetXYZ(pos); // position
-  primVertex->GetCovMatrix(cov); //covariance matrix
-  AliAODVertex *primVertexAOD = new AliAODVertex(pos,cov,primVertex->GetChi2toNDF());
-  AliAODRecoDecayHF2Prong *the2Prong = new AliAODRecoDecayHF2Prong(secVertexAOD,px,py,pz,d0,d0err,dca);
-  the2Prong->SetOwnPrimaryVtx(primVertexAOD);
-
-  // select D0->Kpi
-  Int_t checkD0,checkD0bar;
-  if(fD0toKpi) okD0 = the2Prong->SelectD0(fD0toKpiCuts,checkD0,checkD0bar);
-  //if(fDebug && fD0toKpi) printf("   %d\n",(Int_t)okD0);
-  // select J/psi from B
-  Int_t checkJPSI;
-  if(fJPSItoEle) okJPSI = the2Prong->SelectBtoJPSI(fBtoJPSICuts,checkJPSI);
-  //if(fDebug && fJPSItoEle) printf("   %d\n",(Int_t)okJPSI);
-
-
-  if(okD0 || okJPSI) {
-    // get PID info from ESD
-    Double_t esdpid0[5];
-    postrack->GetESDpid(esdpid0);
-    Double_t esdpid1[5];
-    negtrack->GetESDpid(esdpid1);
-    Double_t esdpid[10];
-    for(Int_t i=0;i<5;i++) {
-      esdpid[i]   = esdpid0[i];
-      esdpid[5+i] = esdpid1[i];
-    }
-    the2Prong->SetPID(2,esdpid);
-  }
-
-  if(ownPrimVertex) delete ownPrimVertex;	
-
-  return the2Prong;  
-}
-//----------------------------------------------------------------------------
-AliAODRecoDecayHF3Prong* AliAnalysisVertexingHF::Make3Prong(
-                             TObjArray *threeTrackArray,AliESD *esd,
-			     AliESDVertex *vertexp1n1,AliESDVertex *vertexp2n1,
-			     Double_t dcap1n1,Double_t dcap2n1,Double_t dcap1p2,
-			     Bool_t &ok3Prong) const
-{
-  // Make 3Prong candidates and check if they pass Dplus or Ds or Lambdac
-  // reconstruction cuts 
-  // E.Bruna, F.Prino
-
-  ok3Prong=kFALSE;
-  Double_t px[3],py[3],pz[3],d0[3],d0err[3];//d0z[3];  
-  Float_t d0z0[2],covd0z0[3];
-
-  Double_t bfieldkG=(Double_t)esd->GetMagneticField(); 
-
-  AliESDtrack *postrack1 = (AliESDtrack*)threeTrackArray->UncheckedAt(0);
-  AliESDtrack *negtrack = (AliESDtrack*)threeTrackArray->UncheckedAt(1);
-  AliESDtrack *postrack2 = (AliESDtrack*)threeTrackArray->UncheckedAt(2);
-
-  AliESDVertex *primVertex = fV1;  
-
-  postrack1->RelateToVertex(primVertex,bfieldkG,10.);
-  negtrack->RelateToVertex(primVertex,bfieldkG,10.);
-  postrack2->RelateToVertex(primVertex,bfieldkG,10.);
-
-  Double_t momentum[3];
-  postrack1->GetPxPyPz(momentum);
-  px[0] = momentum[0]; py[0] = momentum[1]; pz[0] = momentum[2]; 
-  negtrack->GetPxPyPz(momentum);
-  px[1] = momentum[0]; py[1] = momentum[1]; pz[1] = momentum[2]; 
-  postrack2->GetPxPyPz(momentum);
-  px[2] = momentum[0]; py[2] = momentum[1]; pz[2] = momentum[2]; 
-
-  postrack1->GetImpactParameters(d0z0,covd0z0);
-  d0[0]=d0z0[0];
-  d0err[0] = TMath::Sqrt(covd0z0[0]);
-  negtrack->GetImpactParameters(d0z0,covd0z0);
-  d0[1]=d0z0[0];
-  d0err[1] = TMath::Sqrt(covd0z0[0]);
-  postrack2->GetImpactParameters(d0z0,covd0z0);
-  d0[2]=d0z0[0];
-  d0err[2] = TMath::Sqrt(covd0z0[0]);
-
-
-  // invariant mass cut for D+ (try to improve coding here..)
-  Bool_t okMassCut=kFALSE;
-  if(!okMassCut && f3Prong) if(SelectInvMass(2,3,px,py,pz)) okMassCut=kTRUE;
-  if(!okMassCut) {
-    if(fDebug) printf(" candidate didn't pass mass cut\n");
-    return 0x0;    
-  }
-
-  //charge
-  Short_t charge=(Short_t)(postrack1->GetSign()*postrack2->GetSign()*negtrack->GetSign());
-
-  AliESDVertex *ownPrimVertex = 0;  
-  // primary vertex from *other* tracks in the event
-  if(fRecoPrimVtxSkippingTrks || fRmTrksFromPrimVtx) {
-    ownPrimVertex = OwnPrimaryVertex(3,threeTrackArray,esd);
-    if(!ownPrimVertex) {
-      return 0x0;
-    } else {
-      if(ownPrimVertex->GetNContributors()<2) {
-	delete ownPrimVertex;
-	return 0x0;
-      } else {
-	primVertex = ownPrimVertex;
-      }
-    }
-  }
-
-  // create the object AliAODRecoDecayHF3Prong
-  AliVertexerTracks *vertexer = new AliVertexerTracks(esd->GetMagneticField());
-  AliESDVertex* secVert3Prong=(AliESDVertex*)vertexer->VertexForSelectedTracks(threeTrackArray,kTRUE,kTRUE);
-  delete vertexer; vertexer=NULL;
-  Double_t pos[3],cov[6],sigmavert;
-  secVert3Prong->GetXYZ(pos); // position
-  secVert3Prong->GetCovMatrix(cov); //covariance matrix
-  sigmavert=secVert3Prong->GetDispersion();
-
-  AliAODVertex *secVert3PrAOD = new AliAODVertex(pos,cov,secVert3Prong->GetChi2toNDF());
-  primVertex->GetXYZ(pos); // position
-  primVertex->GetCovMatrix(cov); //covariance matrix
-  AliAODVertex *primVertexAOD = new AliAODVertex(pos,cov,primVertex->GetChi2toNDF());
-  Double_t dca[3]={dcap1n1,dcap2n1,dcap1p2};
-
-  Double_t dist12=TMath::Sqrt((vertexp1n1->GetXv()-pos[0])*(vertexp1n1->GetXv()-pos[0])+(vertexp1n1->GetYv()-pos[1])*(vertexp1n1->GetYv()-pos[1])+(vertexp1n1->GetZv()-pos[2])*(vertexp1n1->GetZv()-pos[2]));
-  Double_t dist23=TMath::Sqrt((vertexp2n1->GetXv()-pos[0])*(vertexp2n1->GetXv()-pos[0])+(vertexp2n1->GetYv()-pos[1])*(vertexp2n1->GetYv()-pos[1])+(vertexp2n1->GetZv()-pos[2])*(vertexp2n1->GetZv()-pos[2]));
-
-  AliAODRecoDecayHF3Prong *the3Prong = new AliAODRecoDecayHF3Prong(secVert3PrAOD,px,py,pz,d0,d0err,dca,sigmavert,dist12,dist23,charge);
-  the3Prong->SetOwnPrimaryVtx(primVertexAOD);
-
-
-  // select D+->Kpipi
-  if(f3Prong) ok3Prong = the3Prong->SelectDplus(fDplusCuts);
-  //if(fDebug) printf("ok3Prong: %d\n",(Int_t)ok3Prong);
-  if(ok3Prong) {
-    // get PID info from ESD
-    Double_t esdpid0[5];
-    postrack1->GetESDpid(esdpid0);
-    Double_t esdpid1[5];
-    negtrack->GetESDpid(esdpid1);
-    Double_t esdpid2[5];
-    postrack2->GetESDpid(esdpid2);
-
-
-    Double_t esdpid[15];
-    for(Int_t i=0;i<5;i++) {
-      esdpid[i]   = esdpid0[i];
-      esdpid[5+i] = esdpid1[i];
-      esdpid[10+i] = esdpid2[i];
-    }
-    the3Prong->SetPID(3,esdpid);
-  }
-
-  if(ownPrimVertex) delete ownPrimVertex;	
-
-  return the3Prong;
-}
-//----------------------------------------------------------------------------
-AliAODRecoDecayHF4Prong* AliAnalysisVertexingHF::Make4Prong(
-                             TObjArray *fourTrackArray,AliESD *esd,
-			     AliESDVertex *vertexp1n1,AliESDVertex *vertexp2n1,
-			     Double_t dcap1n1,Double_t dcap1n2,Double_t dcap2n1,
-			     Bool_t &ok4Prong) const
-{
-  // Make 4Prong candidates and check if they pass D0toKpipipi
-  // reconstruction cuts
-  // G.E.Bruno, R.Romita
-
-  ok4Prong=kFALSE;
-
-  Double_t px[4],py[4],pz[4],d0[4],d0err[4];//d0z[3];
-  //Float_t d0z0[2],covd0z0[3];
-
-  Double_t bfieldkG=(Double_t)esd->GetMagneticField();
-
-  //charge
-  Short_t charge=0;
-
-  AliESDtrack *postrack1 = (AliESDtrack*)fourTrackArray->UncheckedAt(0);
-  AliESDtrack *negtrack1 = (AliESDtrack*)fourTrackArray->UncheckedAt(1);
-  AliESDtrack *postrack2 = (AliESDtrack*)fourTrackArray->UncheckedAt(2);
-  AliESDtrack *negtrack2 = (AliESDtrack*)fourTrackArray->UncheckedAt(3);
-
-  AliESDVertex *primVertex = fV1;
-
-  postrack1->RelateToVertex(primVertex,bfieldkG,10.);
-  negtrack1->RelateToVertex(primVertex,bfieldkG,10.);
-  postrack2->RelateToVertex(primVertex,bfieldkG,10.);
-  negtrack2->RelateToVertex(primVertex,bfieldkG,10.);
-
-  Double_t momentum[3];
-  postrack1->GetPxPyPz(momentum);
-  px[0] = momentum[0]; py[0] = momentum[1]; pz[0] = momentum[2];
-  negtrack1->GetPxPyPz(momentum);
-  px[1] = momentum[0]; py[1] = momentum[1]; pz[1] = momentum[2];
-  postrack2->GetPxPyPz(momentum);
-  px[2] = momentum[0]; py[2] = momentum[1]; pz[2] = momentum[2];
-  negtrack2->GetPxPyPz(momentum);
-  px[3] = momentum[0]; py[3] = momentum[1]; pz[3] = momentum[2];
-
-  // invariant mass cut for rho or D0 (try to improve coding here..)
-  //Bool_t okMassCut=kFALSE;
-  //if(!okMassCut) if(SelectInvMass(2,3,px,py,pz)) okMassCut=kTRUE;
-  //if(!okMassCut) {
-  //  if(fDebug) printf(" candidate didn't pass mass cut\n");
-  //  return 0x0;
-  //}
-
-  AliESDVertex *ownPrimVertex = 0;
-  // primary vertex from *other* tracks in the event
-  if(fRecoPrimVtxSkippingTrks || fRmTrksFromPrimVtx) {
-    ownPrimVertex = OwnPrimaryVertex(4,fourTrackArray,esd);
-    if(!ownPrimVertex) {
-      return 0x0;
-    } else {
-      if(ownPrimVertex->GetNContributors()<2) {
-        delete ownPrimVertex;
-        return 0x0;
-      } else {
-        primVertex = ownPrimVertex;
-      }
-    }
-  }
-
-  // create the object AliAODRecoDecayHF4Prong
-  AliVertexerTracks *vertexer = new AliVertexerTracks(esd->GetMagneticField());
-  AliESDVertex* secVert4Prong=(AliESDVertex*)vertexer->VertexForSelectedTracks(fourTrackArray,kTRUE,kTRUE);
-  delete vertexer; vertexer=NULL;
-  Double_t pos[3],cov[6],sigmavert;
-  secVert4Prong->GetXYZ(pos); // position
-  secVert4Prong->GetCovMatrix(cov); //covariance matrix
-  sigmavert=secVert4Prong->GetDispersion();
-
-  AliAODVertex *secVert4PrAOD = new AliAODVertex(pos,cov,secVert4Prong->GetChi2toNDF());
-  primVertex->GetXYZ(pos); // position
-  primVertex->GetCovMatrix(cov); //covariance matrix
-  AliAODVertex *primVertexAOD = new AliAODVertex(pos,cov,primVertex->GetChi2toNDF());
-  //Double_t dca[6]={dcap1n1,dcap2n1,dcap1p2,0.,0.,0.}; //
-  Double_t dca[6]={0.,0.,0.,0.,0.,0.}; //  modify it
-
-  Double_t dist12=TMath::Sqrt((vertexp1n1->GetXv()-pos[0])*(vertexp1n1->GetXv()-pos[0])+(vertexp1n1->GetYv()-pos[1])*(vertexp1n1->GetYv()-pos[1])+(vertexp1n1->GetZv()-pos[2])*(vertexp1n1->GetZv()-pos[2]));
-  Double_t dist23=TMath::Sqrt((vertexp2n1->GetXv()-pos[0])*(vertexp2n1->GetXv()-pos[0])+(vertexp2n1->GetYv()-pos[1])*(vertexp2n1->GetYv()-pos[1])+(vertexp2n1->GetZv()-pos[2])*(vertexp2n1->GetZv()-pos[2]));
-  Double_t dist14=0.; // to be implemented
-  Double_t dist34=0.; // to be implemented
-
-  //AliAODRecoDecayHF4Prong *the4Prong = new AliAODRecoDecayHF4Prong(secVert4PrAOD,px,py,pz,d0,d0err,dca,sigmavert,dist12,dist23,charge);
-  AliAODRecoDecayHF4Prong *the4Prong = new AliAODRecoDecayHF4Prong(secVert4PrAOD,px,py,pz,d0,d0err,dca,dist12,dist23,dist14,dist34,charge);
-  the4Prong->SetOwnPrimaryVtx(primVertexAOD);
-
-
-  // use the following two lines once AliAODRecoDecayHF4Prong::SelectD0 is available
-  // select D0->Kpipipi
-  //Int_t checkD0,checkD0bar;   
-  // ok4Prong=the4Prong->SelectD0(fD04pCuts,checkD0,checkD0bar); 
-  ok4Prong=kFALSE;  //for the time being ...
-
-
-  // get PID info from ESD
-  Double_t esdpid0[5];
-  postrack1->GetESDpid(esdpid0);
-  Double_t esdpid1[5];
-  negtrack1->GetESDpid(esdpid1);
-  Double_t esdpid2[5];
-  postrack2->GetESDpid(esdpid2);
-  Double_t esdpid3[5];
-  negtrack2->GetESDpid(esdpid3);
-
-  Double_t esdpid[20];
-  for(Int_t i=0;i<5;i++) {
-    esdpid[i]   = esdpid0[i];
-    esdpid[5+i] = esdpid1[i];
-    esdpid[10+i] = esdpid2[i];
-    esdpid[15+i] = esdpid3[i];
-  }
-  the4Prong->SetPID(4,esdpid);
-
-  if(ownPrimVertex) delete ownPrimVertex;
-
-  return the4Prong;
-}
-//-----------------------------------------------------------------------------
-AliESDVertex* AliAnalysisVertexingHF::OwnPrimaryVertex(Int_t ntrks,
-						       TObjArray *trkArray,
-						       AliESD *esd) const
-{
-  // Returns primary vertex specific to this candidate
- 
-  AliVertexerTracks *vertexer1 = new AliVertexerTracks(esd->GetMagneticField());
-  AliESDVertex *ownPrimVertex = 0;
-
-  // recalculating the vertex
-  if(fRecoPrimVtxSkippingTrks) { 
-    if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraint")) {
-      Float_t diamondcovxy[3];
-      esd->GetDiamondCovXY(diamondcovxy);
-      Double_t pos[3]={esd->GetDiamondX(),esd->GetDiamondY(),0.};
-      Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.};
-      AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
-      vertexer1->SetVtxStart(diamond);
-      delete diamond; diamond=NULL;
-      if(strstr(fV1->GetTitle(),"VertexerTracksWithConstraintOnlyFitter")) 
-	vertexer1->SetOnlyFitter();
-    }
-    Int_t skipped[ntrks];
-    AliESDtrack *t = 0;
-    for(Int_t i=0; iUncheckedAt(i);
-      skipped[i] = t->GetID();
-    }
-    vertexer1->SetSkipTracks(ntrks,skipped);
-    ownPrimVertex = (AliESDVertex*)vertexer1->FindPrimaryVertex(esd); 
-  }
-
-  // removing the prongs tracks
-  if(fRmTrksFromPrimVtx) { 
-    TTree *rmTree = new TTree("trksTree","tree with tracks to be removed");
-    AliESDtrack *esdTrack = 0;
-    rmTree->Branch("tracks","AliESDtrack",&esdTrack);
-    AliESDtrack *t = 0;
-    for(Int_t i=0; iUncheckedAt(i);
-      esdTrack = new AliESDtrack(*t);
-      rmTree->Fill();
-      delete esdTrack;
-    }
-    Float_t diamondxy[2]={esd->GetDiamondX(),esd->GetDiamondY()};
-    ownPrimVertex = vertexer1->RemoveTracksFromVertex(fV1,rmTree,diamondxy);
-    delete rmTree; rmTree=NULL;
-  }
-
-  delete vertexer1; vertexer1=NULL;
-
-  return ownPrimVertex;
-}
-//-----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::PrintStatus() const {
-  // Print parameters being used
-
-  printf("Preselections:\n");
-  printf("    fITSrefit   = %d\n",(Int_t)fITSrefit);
-  printf("    fBothSPD   = %d\n",(Int_t)fBothSPD);
-  printf("    fMinITSCls   = %d\n",fMinITSCls);
-  printf("    fMinPtCut   = %f GeV/c\n",fMinPtCut);
-  printf("    fMind0rphiCut   = %f cm\n",fMind0rphiCut);
-  if(fRecoPrimVtxSkippingTrks) printf("RecoPrimVtxSkippingTrks\n");
-  if(fRmTrksFromPrimVtx) printf("RmTrksFromPrimVtx\n");
-  if(fD0toKpi) {
-    printf("Reconstruct D0->Kpi candidates with cuts:\n");
-    printf("    |M-MD0| [GeV]    < %f\n",fD0toKpiCuts[0]);
-    printf("    dca    [cm]  < %f\n",fD0toKpiCuts[1]);
-    printf("    cosThetaStar     < %f\n",fD0toKpiCuts[2]);
-    printf("    pTK     [GeV/c]    > %f\n",fD0toKpiCuts[3]);
-    printf("    pTpi    [GeV/c]    > %f\n",fD0toKpiCuts[4]);
-    printf("    |d0K|  [cm]  < %f\n",fD0toKpiCuts[5]);
-    printf("    |d0pi| [cm]  < %f\n",fD0toKpiCuts[6]);
-    printf("    d0d0  [cm^2] < %f\n",fD0toKpiCuts[7]);
-    printf("    cosThetaPoint    > %f\n",fD0toKpiCuts[8]);
-  }
-  if(fJPSItoEle) {
-    printf("Reconstruct J/psi from B candidates with cuts:\n");
-    printf("    |M-MJPSI| [GeV]    < %f\n",fBtoJPSICuts[0]);
-    printf("    dca    [cm]  < %f\n",fBtoJPSICuts[1]);
-    printf("    cosThetaStar     < %f\n",fBtoJPSICuts[2]);
-    printf("    pTP     [GeV/c]    > %f\n",fBtoJPSICuts[3]);
-    printf("    pTN    [GeV/c]    > %f\n",fBtoJPSICuts[4]);
-    printf("    |d0P|  [cm]  < %f\n",fBtoJPSICuts[5]);
-    printf("    |d0N| [cm]  < %f\n",fBtoJPSICuts[6]);
-    printf("    d0d0  [cm^2] < %f\n",fBtoJPSICuts[7]);
-    printf("    cosThetaPoint    > %f\n",fBtoJPSICuts[8]);
-  }
-  if(f3Prong) {
-    printf("Reconstruct 3 prong candidates.\n");
-    printf("  D+ cuts:\n");
-    printf("    |M-MD+| [GeV]    < %f\n",fDplusCuts[0]);
-    printf("    pTK     [GeV/c]    > %f\n",fDplusCuts[1]);
-    printf("    pTPi    [GeV/c]    > %f\n",fDplusCuts[2]);
-    printf("    |d0K|  [cm]  > %f\n",fDplusCuts[3]);
-    printf("    |d0Pi| [cm]  > %f\n",fDplusCuts[4]);
-    printf("    dist12    [cm]  < %f\n",fDplusCuts[5]);
-    printf("    sigmavert [cm]   < %f\n",fDplusCuts[6]);
-    printf("    dist prim-sec [cm] > %f\n",fDplusCuts[7]);
-    printf("    pM=Max{pT1,pT2,pT3} [GeV/c] > %f\n",fDplusCuts[8]);
-    printf("    cosThetaPoint    > %f\n",fDplusCuts[9]);
-    printf("    Sum d0^2 [cm^2]  > %f\n",fDplusCuts[10]);
-    printf("    dca cut [cm]  < %f\n",fDplusCuts[11]);
-  }
-
-  return;
-}
-//-----------------------------------------------------------------------------
-Bool_t AliAnalysisVertexingHF::SelectInvMass(Int_t decay,
-					     Int_t nprongs,
-					     Double_t *px,
-					     Double_t *py,
-					     Double_t *pz) const {
-  // Check invariant mass cut
-
-  Short_t dummycharge=0;
-  Double_t *dummyd0 = new Double_t[nprongs];
-  AliAODRecoDecay *rd = new AliAODRecoDecay(0x0,nprongs,dummycharge,px,py,pz,dummyd0);
-  delete [] dummyd0;
-
-  UInt_t pdg2[2],pdg3[3];
-  Double_t mPDG,minv;
-
-  Bool_t retval=kFALSE;
-  switch (decay) 
-    { 
-    case 0:                  // D0->Kpi
-      pdg2[0]=211; pdg2[1]=321;
-      mPDG=TDatabasePDG::Instance()->GetParticle(421)->Mass();
-      minv = rd->InvMass(nprongs,pdg2);
-      if(TMath::Abs(minv-mPDG)InvMass(nprongs,pdg2);
-      if(TMath::Abs(minv-mPDG)ee
-      pdg2[0]=11; pdg2[1]=11;
-      mPDG=TDatabasePDG::Instance()->GetParticle(443)->Mass();
-      minv = rd->InvMass(nprongs,pdg2);
-      if(TMath::Abs(minv-mPDG)Kpipi
-      pdg3[0]=211; pdg3[1]=321; pdg3[2]=211;
-      mPDG=TDatabasePDG::Instance()->GetParticle(411)->Mass();
-      minv = rd->InvMass(nprongs,pdg3);
-      if(TMath::Abs(minv-mPDG)GetNumberOfTracks();
- 
-  // transfer ITS tracks from ESD to arrays and to a tree
-  for(Int_t i=0; iGetTrack(i);
-    UInt_t status = esdtrack->GetStatus();
-
-    // require refit in ITS 
-    if(fITSrefit && !(status&AliESDtrack::kITSrefit)) {
-      if(fDebug) printf("track %d is not kITSrefit\n",i);
-      continue;
-    }
-
-    // require minimum # of ITS points    
-    if(esdtrack->GetNcls(0)GetNcls(0));
-      continue;
-    }
-    // require points on the 2 pixel layers
-    if(fBothSPD) 
-      if(!TESTBIT(esdtrack->GetITSClusterMap(),0) || 
-	 !TESTBIT(esdtrack->GetITSClusterMap(),1)) continue;
-
-    // single track selection
-    if(!SingleTrkCuts(*esdtrack,esd->GetMagneticField())) continue;
-
-    if(esdtrack->GetSign()<0) { // negative track
-      trksN.AddLast(esdtrack);
-      nTrksN++;
-    } else {                 // positive track
-      trksP.AddLast(esdtrack);
-      nTrksP++;
-    }
-
-  } // loop on ESD tracks
-
-  return;
-}
-//-----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::SetD0toKpiCuts(Double_t cut0,Double_t cut1,
-				   Double_t cut2,Double_t cut3,Double_t cut4,
-				   Double_t cut5,Double_t cut6,
-				   Double_t cut7,Double_t cut8) 
-{
-  // Set the cuts for D0 selection
-  fD0toKpiCuts[0] = cut0;
-  fD0toKpiCuts[1] = cut1;
-  fD0toKpiCuts[2] = cut2;
-  fD0toKpiCuts[3] = cut3;
-  fD0toKpiCuts[4] = cut4;
-  fD0toKpiCuts[5] = cut5;
-  fD0toKpiCuts[6] = cut6;
-  fD0toKpiCuts[7] = cut7;
-  fD0toKpiCuts[8] = cut8;
-
-  return;
-}
-//-----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::SetD0toKpiCuts(const Double_t cuts[9]) 
-{
-  // Set the cuts for D0 selection
-
-  for(Int_t i=0; i<9; i++) fD0toKpiCuts[i] = cuts[i];
-
-  return;
-}
-//-----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::SetBtoJPSICuts(Double_t cut0,Double_t cut1,
-				   Double_t cut2,Double_t cut3,Double_t cut4,
-				   Double_t cut5,Double_t cut6,
-				   Double_t cut7,Double_t cut8) 
-{
-  // Set the cuts for J/psi from B selection
-  fBtoJPSICuts[0] = cut0;
-  fBtoJPSICuts[1] = cut1;
-  fBtoJPSICuts[2] = cut2;
-  fBtoJPSICuts[3] = cut3;
-  fBtoJPSICuts[4] = cut4;
-  fBtoJPSICuts[5] = cut5;
-  fBtoJPSICuts[6] = cut6;
-  fBtoJPSICuts[7] = cut7;
-  fBtoJPSICuts[8] = cut8;
-
-  return;
-}
-//-----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::SetBtoJPSICuts(const Double_t cuts[9]) 
-{
-  // Set the cuts for J/psi from B selection
-
-  for(Int_t i=0; i<9; i++) fBtoJPSICuts[i] = cuts[i];
-
-  return;
-}
-//-----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::SetDplusCuts(Double_t cut0,Double_t cut1,
-				   Double_t cut2,Double_t cut3,Double_t cut4,
-				   Double_t cut5,Double_t cut6,
-				   Double_t cut7,Double_t cut8,
-				   Double_t cut9,Double_t cut10,Double_t cut11)
-{
-  // Set the cuts for Dplus->Kpipi selection
-  fDplusCuts[0] = cut0;
-  fDplusCuts[1] = cut1;
-  fDplusCuts[2] = cut2;
-  fDplusCuts[3] = cut3;
-  fDplusCuts[4] = cut4;
-  fDplusCuts[5] = cut5;
-  fDplusCuts[6] = cut6;
-  fDplusCuts[7] = cut7;
-  fDplusCuts[8] = cut8;
-  fDplusCuts[9] = cut9;
-  fDplusCuts[10] = cut10;
-  fDplusCuts[11] = cut11;
-
-  return;
-}
-//-----------------------------------------------------------------------------
-void AliAnalysisVertexingHF::SetDplusCuts(const Double_t cuts[12]) 
-{
-  // Set the cuts for Dplus selection
-
-  for(Int_t i=0; i<12; i++) fDplusCuts[i] = cuts[i];
-
-  return;
-}
-//-----------------------------------------------------------------------------
-Bool_t AliAnalysisVertexingHF::SingleTrkCuts(AliESDtrack& trk, 
-					     Double_t bfieldkG) const 
-{
-  // Check if track passes some kinematical cuts  
-  // Magnetic field "bfieldkG" (kG)
-
-  if(TMath::Abs(1./trk.GetParameter()[4]) < fMinPtCut) {
-    printf("pt %f\n",1./trk.GetParameter()[4]);
-    return kFALSE;
-  }
-  trk.RelateToVertex(fV1,bfieldkG,10.);
-  Float_t d0z0[2],covd0z0[3];
-  trk.GetImpactParameters(d0z0,covd0z0);
-  if(TMath::Abs(d0z0[0]) < fMind0rphiCut) {
-    printf("d0rphi %f\n",TMath::Abs(d0z0[0]));
-    return kFALSE;
-  }
-
-  return kTRUE;
-}
-//-----------------------------------------------------------------------------
-
-
-
diff --git a/PWG3/AliAnalysisVertexingHF.h b/PWG3/AliAnalysisVertexingHF.h
deleted file mode 100644
index eef7b819825..00000000000
--- a/PWG3/AliAnalysisVertexingHF.h
+++ /dev/null
@@ -1,168 +0,0 @@
-#ifndef AliAnalysisVertexingHF_H
-#define AliAnalysisVertexingHF_H
-/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-//-------------------------------------------------------------------------
-//                      Class AliAnalysisVertexingHF
-//            Reconstruction of heavy-flavour decay candidates
-//      
-//  Origin: E.Bruna, G.E.Bruno, A.Dainese, F.Prino, R.Romita
-//-------------------------------------------------------------------------
-
-#include 
-#include 
-#include "AliESD.h"
-#include "AliESDVertex.h"
-#include "AliAODRecoDecayHF.h"
-#include "AliAODRecoDecayHF2Prong.h"
-#include "AliAODRecoDecayHF3Prong.h"
-#include "AliAODRecoDecayHF4Prong.h"
-
-//-----------------------------------------------------------------------------
-class AliAnalysisVertexingHF : public TNamed {
- public:
-  //
-  AliAnalysisVertexingHF();
-  virtual ~AliAnalysisVertexingHF();
-
-  void FindCandidates(AliESD *esd,TTree treeout[]);
-  AliAODRecoDecayHF2Prong* Make2Prong(TObjArray *twoTrackArray1,AliESD *esd,
-				     AliESDVertex *vertexp1n1,Double_t dcap1n1,
-				     Bool_t &okD0,Bool_t &okJPSI) const;
-  AliAODRecoDecayHF3Prong* Make3Prong(TObjArray *threeTrackArray,AliESD *esd,
-				     AliESDVertex *vertexp1n1,
-				     AliESDVertex *vertexp2n1,
-				     Double_t dcap1n1,Double_t dcap2n1,Double_t dcap1p2,
-				     Bool_t &ok3Prong) const;
-  AliAODRecoDecayHF4Prong* Make4Prong(TObjArray *fourTrackArray,AliESD *esd,
-			       AliESDVertex *vertexp1n1,
-			       AliESDVertex *vertexp2n1,
-			       Double_t dcap1n1,Double_t dcap1n2,
-			       Double_t dcap2n1,
-			       Bool_t &ok4Prong) const;
-
-
-  void SetDebug(Int_t debug=0) {fDebug=debug;}
-  void PrintStatus() const;
-  void SetD0toKpiOn() { fD0toKpi=kTRUE; }
-  void SetD0toKpiOff() { fD0toKpi=kFALSE; }
-  void SetJPSItoEleOn() { fJPSItoEle=kTRUE; }
-  void SetJPSItoEleOff() { fJPSItoEle=kFALSE; }
-  void Set3ProngOn() { f3Prong=kTRUE; }
-  void Set3ProngOff() { f3Prong=kFALSE; }
-  void Set4ProngOn() { f4Prong=kTRUE; }
-  void Set4ProngOff() { f4Prong=kFALSE; }
-  void SetRecoPrimVtxSkippingTrks() 
-    { fRecoPrimVtxSkippingTrks=kTRUE; fRmTrksFromPrimVtx=kFALSE;}
-  void SetRmTrksFromPrimVtx() 
-    {fRmTrksFromPrimVtx=kTRUE; fRecoPrimVtxSkippingTrks=kFALSE; }
-  void SetITSrefitRequired() { fITSrefit=kTRUE; }
-  void SetITSrefitNotRequired() { fITSrefit=kFALSE; }
-  void SetBothSPDRequired() { fBothSPD=kTRUE; }
-  void SetBothSPDNotRequired() {fBothSPD=kFALSE;}
-  void SetMinITSCls(Int_t n=6) { fMinITSCls=n; }
-  void SetMinPtCut(Double_t pt=0.) { fMinPtCut=pt; }
-  void SetMind0Cut(Double_t d0=0.) { fMind0rphiCut=d0; } 
-  void SetD0toKpiCuts(Double_t cut0=1000.,Double_t cut1=100000.,
-		      Double_t cut2=1.1,Double_t cut3=0.,Double_t cut4=0.,
-		      Double_t cut5=100000.,Double_t cut6=100000.,
-		      Double_t cut7=100000000.,Double_t cut8=-1.1); 
-  void SetD0toKpiCuts(const Double_t cuts[9]); 
-  void SetBtoJPSICuts(Double_t cut0=1000.,Double_t cut1=100000.,
-		      Double_t cut2=1.1,Double_t cut3=0.,Double_t cut4=0.,
-		      Double_t cut5=100000.,Double_t cut6=100000.,
-		      Double_t cut7=100000000.,Double_t cut8=-1.1); 
-  void SetBtoJPSICuts(const Double_t cuts[9]); 
-  void SetDplusCuts(Double_t cut0=1000.,Double_t cut1=0.,
-		    Double_t cut2=0.,Double_t cut3=0.,Double_t cut4=0.,
-		    Double_t cut5=0.,Double_t cut6=10000000000.,
-		    Double_t cut7=0.,Double_t cut8=0.,
-		    Double_t cut9=-1.1,Double_t cut10=0.,
-		    Double_t cut11=0.); 
-  void SetDplusCuts(const Double_t cuts[12]); 
-  //
- private:
-  //
-  Bool_t fRecoPrimVtxSkippingTrks; // flag for primary vertex reco on the fly
-                                   // for each candidate, w/o its daughters
-  Bool_t fRmTrksFromPrimVtx; // flag for fast removal of daughters from 
-                             // the primary vertex
-
-  AliESDVertex *fV1; // primary vertex
-
-  Int_t  fDebug; // enable verbose mode
-
-  // flag to enable candidates production
-  Bool_t fD0toKpi; 
-  Bool_t fJPSItoEle;
-  Bool_t f3Prong;
-  Bool_t f4Prong;
-
-  // single-track cuts
-  Bool_t   fITSrefit;   // require kITSrefit
-  Bool_t   fBothSPD;    // require both SPD layers
-  Int_t    fMinITSCls;  // minimum number of ITS clusters
-  Double_t fMinPtCut;   // minimum track pt [GeV/c]
-  Double_t fMind0rphiCut;  // minimum track |rphi impact parameter| [cm] 
-  // candidates cuts
-  Double_t fD0toKpiCuts[9]; // cuts on D0->Kpi candidates
-                  // (to be passed to AliAODRecoDecayHF2Prong::SelectD0())
-                          // 0 = inv. mass half width [GeV]   
-                          // 1 = dca [cm]
-                          // 2 = cosThetaStar 
-                          // 3 = pTK [GeV/c]
-                          // 4 = pTPi [GeV/c]
-                          // 5 = d0K [cm]   upper limit!
-                          // 6 = d0Pi [cm]  upper limit!
-                          // 7 = d0d0 [cm^2]
-                          // 8 = cosThetaPoint
-  Double_t fBtoJPSICuts[9]; // cuts on JPSI candidates
-                  // (to be passed to AliAODRecoDecayHF2Prong::SelectBtoJPSI())
-                          // 0 = inv. mass half width [GeV]   
-                          // 1 = dca [cm]
-                          // 2 = cosThetaStar (negative electron)
-                          // 3 = pTP [GeV/c]
-                          // 4 = pTN [GeV/c]
-                          // 5 = d0O [cm]   upper limit!
-                          // 6 = d0N [cm]  upper limit!
-                          // 7 = d0d0 [cm^2]
-                          // 8 = cosThetaPoint
-  Double_t fDplusCuts[12]; // cuts on Dplus candidates
-                  // (to be passed to AliAODRecoDecayHF2Prong::SelectDplus())
-                          // 0 = inv. mass half width [GeV]   
-                          // 1 = pTK [GeV/c]
-                          // 2 = pTPi [GeV/c]
-                          // 3 = d0K [cm]   lower limit!
-                          // 4 = d0Pi [cm]  lower limit!
-                          // 5 = dist12 (cm)
-                          // 6 = sigmavert (cm)
-                          // 7 = dist prim-sec (cm)
-                          // 8 = pM=Max{pT1,pT2,pT3} (GeV/c)
-                          // 9 = cosThetaPoint
-                          // 10 = Sum d0^2 (cm^2)
-                          // 11 = dca cut (cm)
-
-  //
-  AliESDVertex* OwnPrimaryVertex(Int_t ntrks,TObjArray *trkArray,AliESD *esd) const;
-  Bool_t SelectInvMass(Int_t decay,Int_t nprongs,
-		       Double_t *px,Double_t *py,Double_t *pz) const;
-  void SelectTracks(AliESD *esd,
-		    TObjArray &trksP,Int_t &nTrksP,
-		    TObjArray &trksN,Int_t &nTrksN) const;
-  void SetPrimaryVertex(AliESDVertex* v1) { fV1 = v1; }
-  Bool_t SingleTrkCuts(AliESDtrack& trk, Double_t b) const;
-  //
-  ClassDef(AliAnalysisVertexingHF,1)  // Reconstruction of HF decay candidates
-};
-
-
-#endif
-
-
-
-
-
-
-
-
diff --git a/PWG3/AliAnalysisVertexingHFTest.C b/PWG3/AliAnalysisVertexingHFTest.C
deleted file mode 100644
index df9407abfb9..00000000000
--- a/PWG3/AliAnalysisVertexingHFTest.C
+++ /dev/null
@@ -1,79 +0,0 @@
-//--------------------------------------------------------------------------
-// Test macro for reconstruction of heavy-flavour vertexing candidates
-//
-//     Andrea Dainese, andrea.dainese@lnl.infn.it
-//--------------------------------------------------------------------------
-
-void AliAnalysisVertexingHFTest(Int_t evFirst=0,
-				Int_t evLast=99,
-				TString infile="AliESDs.root",
-				TString outfile="VertexingHF.root") {
-  
-  gSystem->Load("libAOD.so");
-  gSystem->Load("libPWG3base.so");
-
-  AliAnalysisVertexingHF *vHF = new AliAnalysisVertexingHF();
-  //--- switch-off candidates finding (default: all on)
-  //vHF->SetD0toKpiOff();
-  //vHF->SetJPSItoEleOff();
-  //vHF->Set3ProngOff();
-  //vHF->Set4ProngOff();
-  //--- set cuts for single-track selection
-  vHF->SetITSrefitRequired();
-  vHF->SetBothSPDNotRequired();
-  vHF->SetMinITSCls(5);
-  vHF->SetMinPtCut(0.);
-  vHF->SetMind0Cut(0.);
-  //--- set cuts for candidates selection
-  //vHF->SetD0toKpiCuts(); 
-  //vHF->SetBtoJPSICuts(); 
-  //vHF->SetDplusCuts(); 
-  //--- set this if you want to reconstruct primary vertex candidate by
-  //    candidate using other tracks in the event (for pp, broad 
-  //    interaction region)
-  //vHF->SetRecoPrimVtxSkippingTrks();
-  //--- OR set this if you want to remove the candidate daughters from 
-  //    the primary vertex, without recostructing it from scratch
-  //vHF->SetRmTrksFromPrimVtx();
-
-  //--- check the settings
-  vHF->PrintStatus();
-  //--- verbose
-  vHF->SetDebug(1);
-
-  TTree *trees = new TTree[4];
-  AliAODRecoDecayHF2Prong *rd2=0;
-  AliAODRecoDecayHF3Prong *rd3=0;
-  AliAODRecoDecayHF4Prong *rd4=0;
-  trees[0].Branch("D0toKpi","AliAODRecoDecayHF2Prong",&rd2);
-  trees[1].Branch("JPSItoEle","AliAODRecoDecayHF2Prong",&rd2);
-  trees[2].Branch("Charmto3Prong","AliAODRecoDecayHF3Prong",&rd3);
-  trees[3].Branch("D0to4Prong","AliAODRecoDecayHF4Prong",&rd4);
-
-  TFile *inesd=new TFile(infile.Data());
-  TTree *esdTree = (TTree*)inesd->Get("esdTree");
-  AliESD *esd=0;
-  esdTree->SetBranchAddress("ESD",&esd);
-
-  if(esdTree->GetEntries()GetEntries()-1;
-  for(Int_t i=evFirst; i<=evLast; i++) {
-    esdTree->GetEvent(i);
-    vHF->FindCandidates(esd,trees);
-    //if(i==evLast) i=evFirst;
-  }
-
-  delete esdTree;
-  inesd->Close();
-  delete inesd;
-
-  // Write trees with candidates
-  TFile *fout = new TFile("AliAnalysisVertexingHF.root","recreate");
-  trees[0].Write("TreeD0toKpi");
-  trees[1].Write("TreeJPSItoEle");
-  trees[2].Write("TreeCharm3Prong");
-  trees[3].Write("TreeD0to4Prong");
-  fout->Close();
-  delete fout;
-
-  return;
-}
diff --git a/PWG3/PWG3baseLinkDef.h b/PWG3/PWG3baseLinkDef.h
index 1443bc17ee2..fc2bb312978 100644
--- a/PWG3/PWG3baseLinkDef.h
+++ b/PWG3/PWG3baseLinkDef.h
@@ -13,11 +13,6 @@
 #pragma link C++ class AliBtoJPSItoEle+;
 #pragma link C++ class AliBtoJPSItoEleAnalysis+;
 
-#pragma link C++ class AliAODRecoDecayHF+;
-#pragma link C++ class AliAODRecoDecayHF2Prong+;
-#pragma link C++ class AliAODRecoDecayHF3Prong+;
-#pragma link C++ class AliAODRecoDecayHF4Prong+;
-#pragma link C++ class AliAnalysisVertexingHF+;
 
 #endif
 
diff --git a/PWG3/libPWG3base.pkg b/PWG3/libPWG3base.pkg
index 4d859bee1b3..75e376562e5 100644
--- a/PWG3/libPWG3base.pkg
+++ b/PWG3/libPWG3base.pkg
@@ -2,11 +2,7 @@ SRCS:= AliQuarkoniaAcceptance.cxx \
        AliQuarkoniaEfficiency.cxx \
        AliPWG3TrackExtrapInterface.cxx \
        AliD0toKpi.cxx  AliD0toKpiAnalysis.cxx \
-       AliBtoJPSItoEle.cxx  AliBtoJPSItoEleAnalysis.cxx \
-       AliAODRecoDecayHF.cxx \
-       AliAODRecoDecayHF2Prong.cxx  AliAODRecoDecayHF3Prong.cxx \
-       AliAODRecoDecayHF4Prong.cxx \
-       AliAnalysisVertexingHF.cxx
+       AliBtoJPSItoEle.cxx  AliBtoJPSItoEleAnalysis.cxx
      
 HDRS:= $(SRCS:.cxx=.h)
 
diff --git a/RAW/binalimdc.pkg b/RAW/binalimdc.pkg
index 33a25767575..6e973852320 100644
--- a/RAW/binalimdc.pkg
+++ b/RAW/binalimdc.pkg
@@ -14,8 +14,7 @@ EINCLUDE+= TPC ITS RAW HLT/src HLT/hough HLT/comp HLT/ITS
 
 PACKBLIBS := $(ROOTCLIBS) $(SYSLIBS)
 
-#ELIBS:=ESD AOD RAWDatabase RAWDatarec RAWDatasim MDC MDCFilter CDB STEER TPCbase TPCsim TPCrec HLTbase AliHLTSrc AliHLTMisc AliHLTHough AliHLTComp AliHLTITS AliHLTMUON ITSbase ITSsim ITSrec MUONsim MUONrec MUONbase MUONgeometry MUONraw MUONcalib MUONmapping
-ELIBS:=ESD AOD RAWDatabase RAWDatarec RAWDatasim MDC MDCFilter CDB STEER TPCbase TPCsim TPCrec HLTbase AliHLTSrc AliHLTMisc AliHLTHough AliHLTComp AliHLTITS AliHLTMUON ITSbase ITSsim ITSrec MUONevaluation MUONsim MUONrec MUONbase MUONtrigger MUONgeometry MUONraw MUONcalib MUONmapping
+ELIBS:=ESD AOD RAWDatabase RAWDatarec RAWDatasim MDC MDCFilter CDB STEER TPCbase TPCsim TPCrec HLTbase AliHLTSrc AliHLTMisc AliHLTHough AliHLTComp AliHLTITS AliHLTMUON ITSbase ITSsim ITSrec MUONsim MUONrec MUONbase MUONgeometry MUONraw MUONcalib MUONmapping
 
 ifneq (,$(findstring macosx,$(ALICE_TARGET)))
 PACKLDFLAGS:=$(LDFLAGS) $(@PACKAGE@LIBSINIT:%=-Wl,-u,_G__cpp_setupG__%)
diff --git a/RAW/bindateStream.pkg b/RAW/bindateStream.pkg
index 571e6679331..843518c08bb 100644
--- a/RAW/bindateStream.pkg
+++ b/RAW/bindateStream.pkg
@@ -13,8 +13,7 @@ EINCLUDE+= TPC ITS RAW HLT/src HLT/hough HLT/comp HLT/ITS
 
 PACKBLIBS := $(ROOTCLIBS) $(SYSLIBS)
 
-#ELIBS:=ESD AOD RAWDatabase RAWDatarec RAWDatasim MDC MDCFilter CDB STEER TPCbase TPCsim TPCrec HLTbase AliHLTSrc AliHLTMisc AliHLTHough AliHLTComp AliHLTITS AliHLTMUON ITSbase ITSsim ITSrec MUONsim MUONrec MUONbase MUONgeometry MUONraw MUONcalib MUONmapping
-ELIBS:=ESD AOD RAWDatabase RAWDatarec RAWDatasim MDC MDCFilter CDB STEER TPCbase TPCsim TPCrec HLTbase AliHLTSrc AliHLTMisc AliHLTHough AliHLTComp AliHLTITS AliHLTMUON ITSbase ITSsim ITSrec MUONevaluation MUONsim MUONrec MUONbase MUONtrigger MUONgeometry MUONraw MUONcalib MUONmapping
+ELIBS:=ESD AOD RAWDatabase RAWDatarec RAWDatasim MDC MDCFilter CDB STEER TPCbase TPCsim TPCrec HLTbase AliHLTSrc AliHLTMisc AliHLTHough AliHLTComp AliHLTITS AliHLTMUON ITSbase ITSsim ITSrec MUONsim MUONrec MUONbase MUONgeometry MUONraw MUONcalib MUONmapping
 
 ifneq (,$(findstring macosx,$(ALICE_TARGET)))
 PACKLDFLAGS:=$(LDFLAGS) $(@PACKAGE@LIBSINIT:%=-Wl,-u,_G__cpp_setupG__%)
diff --git a/SHUTTLE/AliShuttle.cxx b/SHUTTLE/AliShuttle.cxx
index 21d20da8906..d73677f6155 100644
--- a/SHUTTLE/AliShuttle.cxx
+++ b/SHUTTLE/AliShuttle.cxx
@@ -15,13 +15,6 @@
 
 /*
 $Log$
-Revision 1.41  2007/05/03 08:00:48  jgrosseo
-fixing log message when pp want to skip dcs value retrieval
-
-Revision 1.40  2007/04/27 07:06:48  jgrosseo
-GetFileSources returns empty list in case of no files, but successful query
-No mails sent in testmode
-
 Revision 1.39  2007/04/17 12:43:57  acolla
 Correction in StoreOCDB; change of text in mail to detector expert
 
@@ -1338,11 +1331,7 @@ Bool_t AliShuttle::ProcessCurrentDetector()
 
 	Bool_t processDCS = aPreprocessor->ProcessDCS();
 
-	if (!processDCS)
-	{
-		Log(fCurrentDetector, "The preprocessor requested to skip the retrieval of DCS values");
-	}
-	else if (fTestMode & kSkipDCS)
+	if (!processDCS || (fTestMode & kSkipDCS))
 	{
 		Log(fCurrentDetector, "In TESTMODE - Skipping DCS processing!");
 	} 
diff --git a/STEER/AliDetectorTag.cxx b/STEER/AliDetectorTag.cxx
index f497408f54a..0844621d05a 100644
--- a/STEER/AliDetectorTag.cxx
+++ b/STEER/AliDetectorTag.cxx
@@ -22,59 +22,45 @@
 //-----------------------------------------------------------------
 
 #include "AliDetectorTag.h"
-#include "AliLog.h"
-#include "TObjString.h"
 
 ClassImp(AliDetectorTag)
 
 //___________________________________________________________________________
 AliDetectorTag::AliDetectorTag() :
   TObject(),
-  fDetectorArray(new TObjArray()),
-  fMask(0),
-  fITSSPD(kFALSE),
-  fITSSDD(kFALSE),
-  fITSSSD(kFALSE),
+  fITS(kFALSE),
   fTPC(kFALSE),
   fTRD(kFALSE),
   fTOF(kFALSE),
   fHMPID(kFALSE),
   fPHOS(kFALSE),
-  fPMD(kFALSE),
+  fZDC(kFALSE),
   fMUON(kFALSE),
-  fFMD(kFALSE),
-  fTZERO(kFALSE),
+  fPMD(kFALSE),
+  fEMCAL(kFALSE),
   fVZERO(kFALSE),
-  fZDC(kFALSE),
-  fEMCAL(kFALSE)
+  fTZERO(kFALSE)
 {
   // Default constructor
-  for(Int_t k = 0; k < 20; k++) fDetectors[k] = 0;
 }
 
 //___________________________________________________________________________
 AliDetectorTag::AliDetectorTag(const AliDetectorTag & detTag) :
   TObject(detTag),
-  fDetectorArray(detTag.fDetectorArray),
-  fMask(detTag.fMask),
-  fITSSPD(detTag.fITSSPD),
-  fITSSDD(detTag.fITSSDD),
-  fITSSSD(detTag.fITSSSD),
+  fITS(detTag.fITS),
   fTPC(detTag.fTPC),
   fTRD(detTag.fTRD),
   fTOF(detTag.fTOF),
   fHMPID(detTag.fHMPID),
   fPHOS(detTag.fPHOS),
-  fPMD(detTag.fPMD),
+  fZDC(detTag.fZDC),
   fMUON(detTag.fMUON),
-  fFMD(detTag.fFMD),
-  fTZERO(detTag.fTZERO),
+  fPMD(detTag.fPMD),
+  fEMCAL(detTag.fEMCAL),
   fVZERO(detTag.fVZERO),
-  fZDC(detTag.fZDC),
-  fEMCAL(detTag.fEMCAL)
+  fTZERO(detTag.fTZERO)
  {
   // DetectorTag copy constructor
-  for(Int_t k = 0; k < 20; k++) fDetectors[k] = detTag.fDetectors[k];
 }
 
 //___________________________________________________________________________
@@ -83,99 +69,24 @@ AliDetectorTag & AliDetectorTag::operator=(const AliDetectorTag &detTag) {
   if (this != &detTag) {
     TObject::operator=(detTag);
     
-    fDetectorArray = detTag.fDetectorArray;
-    fMask = detTag.fMask;   
-    fITSSPD = detTag.fITSSPD;
-    fITSSDD = detTag.fITSSDD;
-    fITSSSD = detTag.fITSSSD;
+    fITS = detTag.fITS;
     fTPC = detTag.fTPC;
     fTRD = detTag.fTRD;
     fTOF = detTag.fTOF;
     fHMPID = detTag.fHMPID;
     fPHOS = detTag.fPHOS;
-    fPMD = detTag.fPMD;
-    fMUON = detTag.fMUON;
-    fFMD = detTag.fFMD;
-    fTZERO = detTag.fTZERO;
-    fVZERO = detTag.fVZERO;
     fZDC = detTag.fZDC;
+    fMUON = detTag.fMUON;
+    fPMD = detTag.fPMD;
     fEMCAL = detTag.fEMCAL;
-    for(Int_t k = 0; k < 20; k++) fDetectors[k] = detTag.fDetectors[k];
+    fVZERO = detTag.fVZERO;
+    fTZERO = detTag.fTZERO;
   }
   return *this;
 }
 
+
 //___________________________________________________________________________
 AliDetectorTag::~AliDetectorTag() {
   // Destructor
-  delete fDetectorArray;
-}
-
-//___________________________________________________________________________
-void AliDetectorTag::Int2Bin() {
-  // Convert the integer into binary
-  Int_t j=0; 
-  UInt_t mask = fMask;
-  for(Int_t k = 0; k < 20; k++) fDetectors[k] = 0;
-  while(mask > 0) {
-   fDetectors[j] = mask%2;
-   mask = mask/2;
-   j++; 
-  }
-  SetDetectorConfiguration();
-}
-
-//___________________________________________________________________________
-void AliDetectorTag::SetDetectorConfiguration() {
-  //sets the detector configuration
-  if(fDetectors[0] == 1) {
-    SetITSSPD(); fDetectorArray->Add(new TObjString("SPD"));}
-  if(fDetectors[1] == 1) {
-    SetITSSDD(); fDetectorArray->Add(new TObjString("SDD"));}
-  if(fDetectors[2] == 1) {
-    SetITSSSD(); fDetectorArray->Add(new TObjString("SSD"));}
-  if(fDetectors[3] == 1) {
-    SetTPC(); fDetectorArray->Add(new TObjString("TPC"));}
-  if(fDetectors[4] == 1) {
-    SetTRD(); fDetectorArray->Add(new TObjString("TRD"));}
-  if(fDetectors[5] == 1) {
-    SetTOF(); fDetectorArray->Add(new TObjString("TOF"));}
-  if(fDetectors[6] == 1) {
-    SetHMPID();fDetectorArray->Add(new TObjString("HMPID"));}
-  if(fDetectors[7] == 1) {
-    SetPHOS(); fDetectorArray->Add(new TObjString("PHOS"));}
-  if(fDetectors[9] == 1) {
-    SetPMD(); fDetectorArray->Add(new TObjString("PMD"));}
-  if(fDetectors[10] == 1) {
-    SetMUON(); fDetectorArray->Add(new TObjString("MUON"));}
-  if(fDetectors[12] == 1) {
-    SetFMD(); fDetectorArray->Add(new TObjString("FMD"));}
-  if(fDetectors[13] == 1) {
-    SetTZERO(); fDetectorArray->Add(new TObjString("T0"));}
-  if(fDetectors[14] == 1) {
-    SetVZERO(); fDetectorArray->Add(new TObjString("VZERO"));}
-  if(fDetectors[15] == 1) {
-    SetZDC(); fDetectorArray->Add(new TObjString("ZDC"));}
-  if(fDetectors[18] == 1) {
-    SetEMCAL(); fDetectorArray->Add(new TObjString("EMCAL"));}
-}
-
-//___________________________________________________________________________
-void AliDetectorTag::PrintDetectorMask() {
-  //prints the detector mask
-  AliInfo( Form( "ITS-SPD: %d", GetITSSPD()) );
-  AliInfo( Form( "ITS-SDD: %d", GetITSSDD()) );
-  AliInfo( Form( "ITS-SSD: %d", GetITSSSD()) );
-  AliInfo( Form( "TPC: %d", GetTPC()) );
-  AliInfo( Form( "TRD: %d", GetTRD()) );
-  AliInfo( Form( "TOF: %d", GetTOF()) );
-  AliInfo( Form( "HMPID: %d", GetHMPID()) );
-  AliInfo( Form( "PHOS: %d", GetPHOS()) );
-  AliInfo( Form( "PMD: %d", GetPMD()) );
-  AliInfo( Form( "MUON: %d", GetMUON()) );
-  AliInfo( Form( "FMD: %d", GetFMD()) );
-  AliInfo( Form( "TZERO: %d", GetTZERO()) );
-  AliInfo( Form( "VZERO: %d", GetVZERO()) );
-  AliInfo( Form( "ZDC: %d", GetZDC()) );
-  AliInfo( Form( "EMCAL: %d", GetEMCAL()) );
 }
diff --git a/STEER/AliDetectorTag.h b/STEER/AliDetectorTag.h
index 74f5a2988a8..02a8eb7e304 100644
--- a/STEER/AliDetectorTag.h
+++ b/STEER/AliDetectorTag.h
@@ -14,8 +14,6 @@
 //-------------------------------------------------------------------------
 
 #include "TObject.h"
-#include "TObjArray.h"
-
 //___________________________________________________________________________
 class AliDetectorTag : public TObject {
  public:
@@ -26,68 +24,49 @@ class AliDetectorTag : public TObject {
   virtual ~AliDetectorTag();
   
   //____________________________________________________//
-  void SetDetectorMask(UInt_t mask) {fMask = mask; Int2Bin();}
-  TObjArray *GetDetectorMask() {return fDetectorArray;}
-  void PrintDetectorMask();
-
+  void SetITS() {fITS = kTRUE;}
+  void SetTPC() {fTPC = kTRUE;}
+  void SetTRD() {fTRD = kTRUE;}
+  void SetTOF() {fTOF = kTRUE;}
+  void SetHMPID() {fHMPID = kTRUE;}
+  void SetPHOS() {fPHOS = kTRUE;}
+  void SetZDC() {fZDC = kTRUE;}
+  void SetMUON() {fMUON = kTRUE;}
+  void SetPMD() {fPMD = kTRUE;}
+  void SetEMCAL() {fEMCAL = kTRUE;}
+  void SetVZERO() {fVZERO = kTRUE;}
+  void SetTZERO() {fTZERO = kTRUE;}
+  
   //____________________________________________________//
-  Bool_t GetITSSPD() const {return fITSSPD;}
-  Bool_t GetITSSDD() const {return fITSSDD;}
-  Bool_t GetITSSSD() const {return fITSSSD;}
+  Bool_t GetITS() const {return fITS;}
   Bool_t GetTPC() const {return fTPC;}
   Bool_t GetTRD() const {return fTRD;}
   Bool_t GetTOF() const {return fTOF;}
   Bool_t GetHMPID() const {return fHMPID;}
   Bool_t GetPHOS() const {return fPHOS;}
-  Bool_t GetPMD() const {return fPMD;}
-  Bool_t GetMUON() const {return fMUON;}
-  Bool_t GetFMD() const {return fFMD;}
-  Bool_t GetTZERO() const {return fTZERO;}
-  Bool_t GetVZERO() const {return fVZERO;}
   Bool_t GetZDC() const {return fZDC;}
+  Bool_t GetMUON() const {return fMUON;}
+  Bool_t GetPMD() const {return fPMD;}
   Bool_t GetEMCAL() const {return fEMCAL;}
+  Bool_t GetVZERO() const {return fVZERO;}
+  Bool_t GetTZERO() const {return fTZERO;}
   
   //____________________________________________________//
  private:
-  void Int2Bin();
-  void SetDetectorConfiguration();
-
-  void SetITSSPD() {fITSSPD = kTRUE;}
-  void SetITSSDD() {fITSSDD = kTRUE;}
-  void SetITSSSD() {fITSSSD = kTRUE;}
-  void SetTPC() {fTPC = kTRUE;}
-  void SetTRD() {fTRD = kTRUE;}
-  void SetTOF() {fTOF = kTRUE;}
-  void SetHMPID() {fHMPID = kTRUE;}
-  void SetPHOS() {fPHOS = kTRUE;}
-  void SetPMD() {fPMD = kTRUE;}
-  void SetMUON() {fMUON = kTRUE;}
-  void SetFMD() {fFMD = kTRUE;}
-  void SetTZERO() {fTZERO = kTRUE;}
-  void SetVZERO() {fVZERO = kTRUE;}
-  void SetZDC() {fZDC = kTRUE;}
-  void SetEMCAL() {fEMCAL = kTRUE;}
-  
-  TObjArray *fDetectorArray; //detectors' names - active
-  UInt_t     fMask;          //detector mask
-  UInt_t     fDetectors[20]; //detector mask
-  Bool_t     fITSSPD;        //ITS-SPD active = 1
-  Bool_t     fITSSDD;        //ITS-SDD active = 1
-  Bool_t     fITSSSD;        //ITS-SSD active = 1
-  Bool_t     fTPC;           //TPC active = 1
-  Bool_t     fTRD;           //TRD active = 1
-  Bool_t     fTOF;           //TOF active = 1
-  Bool_t     fHMPID;         //HMPID active = 1
-  Bool_t     fPHOS;          //PHOS active = 1
-  Bool_t     fPMD;           //PMD active = 1
-  Bool_t     fMUON;          //MUON active = 1
-  Bool_t     fFMD;           //FMD active = 1
-  Bool_t     fTZERO;         //TZERO active = 1
-  Bool_t     fVZERO;         //VZERO active = 1
-  Bool_t     fZDC;           //ZDC active = 1
-  Bool_t     fEMCAL;         //EMCAL active = 1
+  Bool_t   fITS;      //ITS active = 1
+  Bool_t   fTPC;      //TPC active = 1
+  Bool_t   fTRD;      //TRD active = 1
+  Bool_t   fTOF;      //TOF active = 1
+  Bool_t   fHMPID;    //HMPID active = 1
+  Bool_t   fPHOS;     //PHOS active = 1
+  Bool_t   fZDC;      //ZDC active = 1
+  Bool_t   fMUON;     //MUON active = 1
+  Bool_t   fPMD;      //PMD active = 1
+  Bool_t   fEMCAL;    //EMCAL active = 1
+  Bool_t   fVZERO;    //VZERO active = 1
+  Bool_t   fTZERO;    //TZERO active = 1
 
-  ClassDef(AliDetectorTag,3)  //(ClassName, ClassVersion)
+  ClassDef(AliDetectorTag,2)  //(ClassName, ClassVersion)
 };
 //______________________________________________________________________________
 
diff --git a/STEER/AliDetectorTagCuts.cxx b/STEER/AliDetectorTagCuts.cxx
deleted file mode 100644
index 57d6854f608..00000000000
--- a/STEER/AliDetectorTagCuts.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/**************************************************************************
- * Author: Panos Christakoglou.                                           *
- * 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$ */
-
-//-----------------------------------------------------------------
-//                   AliDetectorTagCuts class
-//   This is the class to deal with the Detector tag level cuts
-//   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
-//-----------------------------------------------------------------
-
-class AliLog;
-
-#include "AliDetectorTag.h"
-#include "AliDetectorTagCuts.h"
-
-#include "TObjString.h"
-#include "TString.h"
-
-ClassImp(AliDetectorTagCuts)
-
-//___________________________________________________________________________
-AliDetectorTagCuts::AliDetectorTagCuts() :
-  TObject(),
-  fDetectors(0), 
-  fDetectorsFlag(kFALSE)
-{
-  //Default constructor which calls the Reset method.
-}
-
-//___________________________________________________________________________
-AliDetectorTagCuts::~AliDetectorTagCuts() {  
-  //Defaut destructor.
-}
-
-//___________________________________________________________________________
-Bool_t AliDetectorTagCuts::IsAccepted(AliDetectorTag *detTag) const {
-  //Returns true if the event is accepted otherwise false.
-  TString detStr = fDetectors;
-  TObjArray *activeDetectors = detTag->GetDetectorMask();
-  TString listOfDetectors[15];
-  for (Int_t iDet = 0; iDet < activeDetectors->GetEntries(); iDet++) {
-    TObjString *detectorString = (TObjString *)activeDetectors->At(iDet);
-    listOfDetectors[iDet] = detectorString->GetString();
-  }
-  if(fDetectorsFlag) {
-    for (Int_t iDet = 0; iDet < activeDetectors->GetEntries(); iDet++) {
-      if (!IsSelected(listOfDetectors[iDet], detStr)) return kFALSE; }
-  }
-  return kTRUE;
-}
-
-//___________________________________________________________________________
-Bool_t AliDetectorTagCuts::IsSelected(TString detName, TString& detectors) const {
-  //Returns true if the detector is included
-  if ((detectors.CompareTo("ALL") == 0) ||
-      detectors.BeginsWith("ALL ") ||
-      detectors.EndsWith(" ALL") ||
-      detectors.Contains(" ALL ")) {
-    detectors = "ALL";
-    return kTRUE;
-  }
-  
-  // search for the given detector
-  Bool_t result = kFALSE;
-  if ((detectors.CompareTo(detName) == 0) ||
-      detectors.BeginsWith(detName+" ") ||
-      detectors.EndsWith(" "+detName) ||
-      detectors.Contains(" "+detName+" ")) {
-    detectors.ReplaceAll(detName, "");
-    result = kTRUE;
-  }
-
-  // clean up the detectors string
-  while (detectors.Contains("  ")) detectors.ReplaceAll("  ", " ");
-  while (detectors.BeginsWith(" ")) detectors.Remove(0, 1);
-  while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1);
- 
-  return result;
-}
diff --git a/STEER/AliDetectorTagCuts.h b/STEER/AliDetectorTagCuts.h
deleted file mode 100644
index c1c80855873..00000000000
--- a/STEER/AliDetectorTagCuts.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef ALIDETECTORTAGCUTS_H
-#define ALIDETECTORTAGCUTS_H
-/*  See cxx source for full Copyright notice */
-
-
-/* $Id$ */
-
-//-------------------------------------------------------------------------
-//                       Class AliDetectorTagCuts
-//              This is the class for the cuts in run tags
-//
-//    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
-//-------------------------------------------------------------------------
-
-#include 
-#include 
-
-class AliDetectorTag;
-
-//___________________________________________________________________________
-class AliDetectorTagCuts : public TObject {
- public:
-  AliDetectorTagCuts();
-  ~AliDetectorTagCuts();
-   
- //____________________________________________________//
-  void SetListOfDetectors(const TString& detectors) {fDetectors = detectors; fDetectorsFlag = kTRUE;}
- 
-  Bool_t IsAccepted(AliDetectorTag *lhcTag) const;
-
-  //____________________________________________________//
- private:
-  Bool_t  IsSelected(TString detName, TString& detectors) const;
-
-  TString fDetectors; //detectors active
-  Bool_t  fDetectorsFlag; //cut used or not
-  
-  ClassDef(AliDetectorTagCuts, 1)
-};
-
-#endif
diff --git a/STEER/AliESDv0Analysis.C b/STEER/AliESDv0Analysis.C
index c5967693a6c..ee7406e937c 100644
--- a/STEER/AliESDv0Analysis.C
+++ b/STEER/AliESDv0Analysis.C
@@ -8,7 +8,6 @@
 
 #if !defined( __CINT__) || defined(__MAKECINT__)
   #include 
-  #include 
   #include 
   #include 
   #include 
@@ -18,8 +17,6 @@
 
 #endif
 
-extern TROOT *gROOT;
-
 Int_t AliESDv0Analysis(const Char_t *dir=".") { 
    TH1F *hm=(TH1F*)gROOT->FindObject("hm");
    if (!hm) {
@@ -43,8 +40,7 @@ Int_t AliESDv0Analysis(const Char_t *dir=".") {
 
    //****** Tentative particle type "concentrations"
    Double_t c[5]={0.0, 0.0, 1, 0, 1};
-   AliPID pid;
-   pid.SetPriors(c);
+   AliPID::SetPriors(c);
 
    //******* The loop over events
     while (tree->GetEvent(n)) {
@@ -77,7 +73,7 @@ Int_t AliESDv0Analysis(const Char_t *dir=".") {
        // Check if the "proton track" is a proton
        if ((protonTrk->GetStatus()&AliESDtrack::kESDpid)!=0) {
 	 Double_t r[10]; protonTrk->GetESDpid(r);
-         pid.SetProbabilities(r);
+         AliPID pid(r);
          Double_t pp=pid.GetProbability(AliPID::kProton);
          if (pp < pid.GetProbability(AliPID::kElectron)) continue;
          if (pp < pid.GetProbability(AliPID::kMuon)) continue;
@@ -88,7 +84,7 @@ Int_t AliESDv0Analysis(const Char_t *dir=".") {
        //Check if the "pion track" is a pion
        if ((pionTrk->GetStatus()&AliESDtrack::kESDpid)!=0) {
 	 Double_t r[10]; pionTrk->GetESDpid(r);
-         pid.SetProbabilities(r);
+         AliPID pid(r);
          Double_t ppi=pid.GetProbability(AliPID::kPion);
          if (ppi < pid.GetProbability(AliPID::kElectron)) continue;
          if (ppi < pid.GetProbability(AliPID::kMuon)) continue;
diff --git a/STEER/AliExternalTrackParam.cxx b/STEER/AliExternalTrackParam.cxx
index 651ae7e80b1..c64e0d6d74e 100644
--- a/STEER/AliExternalTrackParam.cxx
+++ b/STEER/AliExternalTrackParam.cxx
@@ -381,7 +381,7 @@ Double_t p[3], Double_t bz) const {
   //+++++++++++++++++++++++++++++++++++++++++    
   GetXYZ(x);
     
-  if (TMath::Abs(Get1Pt()) < kAlmost0 || TMath::Abs(bz) < kAlmost0Field ){ //straight-line tracks
+  if (TMath::Abs(Get1Pt()) < kAlmost0){ //straight-line tracks
      Double_t unit[3]; GetDirection(unit);
      x[0]+=unit[0]*len;   
      x[1]+=unit[1]*len;   
diff --git a/STEER/AliLHCTagCuts.cxx b/STEER/AliLHCTagCuts.cxx
deleted file mode 100644
index 6ab39364461..00000000000
--- a/STEER/AliLHCTagCuts.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/**************************************************************************
- * Author: Panos Christakoglou.                                           *
- * 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$ */
-
-//-----------------------------------------------------------------
-//                   AliLHCTagCuts class
-//   This is the class to deal with the LHC tag level cuts
-//   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
-//-----------------------------------------------------------------
-
-class AliLog;
-
-#include "AliLHCTag.h"
-#include "AliLHCTagCuts.h"
-
-ClassImp(AliLHCTagCuts)
-
-
-//___________________________________________________________________________
-AliLHCTagCuts::AliLHCTagCuts() :
-  TObject(),
-  fLHCState(0),
-  fLHCStateFlag(kFALSE),
-  fLHCLuminosityMin(0),
-  fLHCLuminosityMax(0),
-  fLHCLuminosityFlag(kFALSE)
-{
-  //Default constructor which calls the Reset method.
-  Reset();
-}
-
-//___________________________________________________________________________
-AliLHCTagCuts::~AliLHCTagCuts() {  
-  //Defaut destructor.
-}
-
-//___________________________________________________________________________
-void AliLHCTagCuts::Reset() {
-  //Sets dummy values to every private member.
-  fLHCState = "init";
-  fLHCStateFlag = kFALSE;
-  fLHCLuminosityMin = -1.0;
-  fLHCLuminosityMax = 0.0;
-  fLHCLuminosityFlag = kFALSE;
-}
-
-//___________________________________________________________________________
-Bool_t AliLHCTagCuts::IsAccepted(AliLHCTag *lhcTag) const {
-  //Returns true if the event is accepted otherwise false.
-  if(fLHCStateFlag)
-    if((lhcTag->GetLHCState() != fLHCState))
-      return kFALSE;
-  if(fLHCLuminosityFlag)
-    if((lhcTag->GetLuminosity() < fLHCLuminosityMin)||(lhcTag->GetLuminosity() > fLHCLuminosityMax))
-      return kFALSE;
- 
-  return kTRUE;
-}
diff --git a/STEER/AliLHCTagCuts.h b/STEER/AliLHCTagCuts.h
deleted file mode 100644
index 96c6af5fdb9..00000000000
--- a/STEER/AliLHCTagCuts.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef ALILHCTAGCUTS_H
-#define ALILHCTAGCUTS_H
-/*  See cxx source for full Copyright notice */
-
-
-/* $Id$ */
-
-//-------------------------------------------------------------------------
-//                       Class AliLHCTagCuts
-//              This is the class for the cuts in run tags
-//
-//    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
-//-------------------------------------------------------------------------
-
-#include 
-
-class AliLHCTag;
-
-//___________________________________________________________________________
-class AliLHCTagCuts : public TObject {
- public:
-  AliLHCTagCuts();
-  ~AliLHCTagCuts();
-  void Reset();
-  
- //____________________________________________________//
-  void SetLHCState(TString state) {fLHCState = state; fLHCStateFlag = kTRUE;}
-  void SetLHCLuminosityRange(Float_t low, Float_t high) {fLHCLuminosityMin = low; fLHCLuminosityMax = high; fLHCLuminosityFlag = kTRUE;}
- 
-  Bool_t IsAccepted(AliLHCTag *lhcTag) const;
-
-  //____________________________________________________//
- private:
-  TString fLHCState;              //LHC State
-  Bool_t  fLHCStateFlag;          //Shows whether this cut is used or
-  Float_t fLHCLuminosityMin;      //LHC luminosity - min
-  Float_t fLHCLuminosityMax;      //LHC luminosity - max
-  Bool_t  fLHCLuminosityFlag;     //Shows whether this cut is used or
-
-  ClassDef(AliLHCTagCuts, 1)
-};
-
-#endif
diff --git a/STEER/AliMathBase.cxx b/STEER/AliMathBase.cxx
index 89d9a87c40a..d60943e34e2 100644
--- a/STEER/AliMathBase.cxx
+++ b/STEER/AliMathBase.cxx
@@ -81,9 +81,7 @@ void AliMathBase::EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean
   Double_t sumx2 =0;
   Int_t    bestindex = -1;
   Double_t bestmean  = 0; 
-  Double_t bestsigma = (data[index[nvectors-1]]-data[index[0]]+1.);   // maximal possible sigma
-  bestsigma *=bestsigma;
-
+  Double_t bestsigma = data[index[nvectors-1]]-data[index[0]];   // maximal possible sigma
   for (Int_t i=0; i0: the chi2 returned by TLinearFitter
-  //    -3: only three points have been used for the calculation - no fitter was used
-  //    -2: only two points have been used for the calculation - center of gravity was uesed for calculation
-  //    -1: only one point has been used for the calculation - center of gravity was uesed for calculation
-  //    -4: invalid result!!
-  //
+  //       return value- chi2 - if negative ( not enough points)
+  //       his        -  input histogram
+  //       param      -  vector with parameters 
+  //       xmin, xmax -  range to fit - if xmin=xmax=0 - the full histogram range used
   //  Fitting:
   //  1. Step - make logarithm
   //  2. Linear  fit (parabola) - more robust - always converge
+  //  3. In case of small statistic bins are averaged
   //  
   static TLinearFitter fitter(3,"pol2");
   static TMatrixD mat(3,3);
@@ -400,9 +392,8 @@ Double_t  AliMathBase::FitGaus(Float_t *arr, Int_t nBins, Float_t xMin, Float_t
   TVectorD  sigma(3);
   TMatrixD A(3,3);
   TMatrixD b(3,1);
-  Float_t rms = TMath::RMS(nBins,arr);
-  Float_t max = TMath::MaxElement(nBins,arr);
-  Float_t binWidth = (xMax-xMin)/(Float_t)nBins;
+  Float_t rms = TMath::RMS(size,arr);
+  Float_t max = TMath::MaxElement(size,arr);
 
   Float_t meanCOG = 0;
   Float_t rms2COG = 0;
@@ -411,39 +402,59 @@ Double_t  AliMathBase::FitGaus(Float_t *arr, Int_t nBins, Float_t xMin, Float_t
   Float_t entries = 0;
   Int_t nfilled=0;
 
-  for (Int_t i=0; i0) nfilled++;
   }
 
-  if (max<4) return -4;
-  if (entries<12) return -4;
-  if (rms=xmax){
+    xmin = firstBinX;
+    xmax = firstBinX+(size-1)*binWidth;
+  }
   //
-  for (Int_t ibin=0;ibin1){
-      Double_t xcenter = xMin+(ibin+0.5)*binWidth;
+      Double_t xcenter = firstBinX+ibin*binWidth;
+      if (xcenterxmax) continue;
       
       Float_t error    = 1./TMath::Sqrt(entriesI);
       Float_t val = TMath::Log(Float_t(entriesI));
       fitter.AddPoint(&xcenter,val,error);
-      if (npoints<3){
-	  A(npoints,0)=1;
-	  A(npoints,1)=xcenter;
-	  A(npoints,2)=xcenter*xcenter;
-	  b(npoints,0)=val;
-	  meanCOG+=xcenter*entriesI;
-	  rms2COG +=xcenter*entriesI*xcenter;
-	  sumCOG +=entriesI;
-      }
       npoints++;
     }
   }
+  
+  if (npoints<=3){
+    for (Int_t ibin=0;ibin1){
+	Double_t xcenter = firstBinX+ibin*binWidth;
+	if (xcenterxmax) continue;	
+	Float_t val = TMath::Log(Float_t(entriesI));
+	// if less than 3 point the fitter will crash!
+	// for three points calculate the parameters analytically
+	// for one and two points use center of gravity
+	A(npoints,0)=1;
+	A(npoints,1)=xcenter;
+	A(npoints,2)=xcenter*xcenter;
+	b(npoints,0)=val;
+	meanCOG+=xcenter*val;
+	rms2COG +=xcenter*val*xcenter*val;
+	sumCOG +=val;
+	npoints++;
+      }
+    } 
+  }
+
 
   
   Double_t chi2 = 0;
@@ -464,23 +475,21 @@ Double_t  AliMathBase::FitGaus(Float_t *arr, Int_t nBins, Float_t xMin, Float_t
 	  fitter.GetCovarianceMatrix(mat);
 	  chi2 = fitter.GetChisquare()/Float_t(npoints);
       }
-      if (TMath::Abs(par[1])307 ) return -4;
-      (*param)[0] = TMath::Exp(lnparam0);
+      (*param)[0] = TMath::Exp(par[0]+ par[1]* (*param)[1] +  par[2]*(*param)[1]*(*param)[1]);
       if (verbose){
 	  par.Print();
 	  mat.Print();
 	  param->Print();
 	  printf("Chi2=%f\n",chi2);
-	  TF1 * f1= new TF1("f1","[0]*exp(-(x-[1])^2/(2*[2]*[2]))",xMin,xMax);
+	  TF1 * f1= new TF1("f1","[0]*exp(-(x-[1])^2/(2*[2]*[2]))",xmin,xmax);
 	  f1->SetParameter(0, (*param)[0]);
 	  f1->SetParameter(1, (*param)[1]);
 	  f1->SetParameter(2, (*param)[2]);
@@ -499,7 +508,6 @@ Double_t  AliMathBase::FitGaus(Float_t *arr, Int_t nBins, Float_t xMin, Float_t
       chi2=-2.;
   }
   if ( npoints == 1 ){
-      meanCOG/=sumCOG;
       (*param)[0] = max;
       (*param)[1] = meanCOG;
       (*param)[2] = binWidth/TMath::Sqrt(12);
@@ -510,45 +518,6 @@ Double_t  AliMathBase::FitGaus(Float_t *arr, Int_t nBins, Float_t xMin, Float_t
 }
 
 
-Float_t AliMathBase::GetCOG(Short_t *arr, Int_t nBins, Float_t xMin, Float_t xMax, Float_t *rms, Float_t *sum)
-{
-    //
-    //  calculate center of gravity rms and sum for array 'arr' with nBins an a x range xMin to xMax
-    //  return COG; in case of failure return xMin
-    //
-    Float_t meanCOG = 0;
-    Float_t rms2COG = 0;
-    Float_t sumCOG  = 0;
-    Int_t npoints   = 0;
-
-    Float_t binWidth = (xMax-xMin)/(Float_t)nBins;
-
-    for (Int_t ibin=0; ibin0 ){
-	    meanCOG += xcenter*entriesI;
-	    rms2COG += xcenter*entriesI*xcenter;
-	    sumCOG  += entriesI;
-	    npoints++;
-	}
-    }
-    if ( sumCOG == 0 ) return xMin;
-    meanCOG/=sumCOG;
-
-    if ( rms ){
-	rms2COG /=sumCOG;
-	(*rms) = TMath::Sqrt(TMath::Abs(meanCOG*meanCOG-rms2COG));
-	if ( npoints == 1 ) (*rms) = binWidth/TMath::Sqrt(12);
-    }
-
-    if ( sum )
-        (*sum) = sumCOG;
-
-    return meanCOG;
-}
-
-
 
 ///////////////////////////////////////////////////////////////
 //////////////         TEST functions /////////////////////////
@@ -606,7 +575,7 @@ void AliMathBase::TestGausFit(Int_t nhistos){
   s.Start();
   //AliMathBase gaus fit
   for (Int_t i=0; iGetArray()+1,h1f[i]->GetNbinsX(),h1f[i]->GetXaxis()->GetXmin(),h1f[i]->GetXaxis()->GetXmax(),par2[i],&dummy);
+    AliMathBase::FitGaus(20,h1f[i]->GetArray()+1,-9.5,1,par2[i],&dummy);
   }
   
   s.Stop();
diff --git a/STEER/AliMathBase.h b/STEER/AliMathBase.h
index 88626602980..2bfc893d5e6 100644
--- a/STEER/AliMathBase.h
+++ b/STEER/AliMathBase.h
@@ -22,8 +22,7 @@ class AliMathBase : public TObject
   static  void TruncatedMean(TH1F * his, TVectorD *param, Float_t down=0, Float_t up=1.0, Bool_t verbose=kFALSE);
   static void LTM(TH1F * his, TVectorD *param=0 , Float_t fraction=1,  Bool_t verbose=kFALSE);
   static Double_t  FitGaus(TH1F* his, TVectorD *param=0, TMatrixD *matrix=0, Float_t xmin=0, Float_t xmax=0,  Bool_t verbose=kFALSE);
-  static Double_t  FitGaus(Float_t *arr, Int_t nBins, Float_t xMin, Float_t xMax, TVectorD *param=0, TMatrixD *matrix=0, Bool_t verbose=kFALSE);
-  static Float_t  GetCOG(Short_t *arr, Int_t nBins, Float_t xMin, Float_t xMax, Float_t *rms=0, Float_t *sum=0);
+  static Double_t  FitGaus(Int_t size, Float_t *arr, Float_t firstBinX, Float_t binWidth=1, TVectorD *param=0, TMatrixD *matrix=0, Float_t xmin=0, Float_t xmax=0,  Bool_t verbose=kFALSE);
 
   //
   // TestFunctions:
diff --git a/STEER/AliMultiplicity.cxx b/STEER/AliMultiplicity.cxx
index 1fa8f9a2e96..1afae2920a8 100644
--- a/STEER/AliMultiplicity.cxx
+++ b/STEER/AliMultiplicity.cxx
@@ -10,7 +10,6 @@ AliMultiplicity::AliMultiplicity():
   fTh(0),
   fPhi(0),
   fDeltPhi(0),
-  fLabels(0),
   fNsingle(0),
   fThsingle(0),
   fPhisingle(0)
@@ -20,13 +19,12 @@ AliMultiplicity::AliMultiplicity():
 }
 
 //______________________________________________________________________
-AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *t,  Float_t *ph, Float_t *df, Int_t *labels, Int_t ns, Float_t *ts, Float_t *ps):
+AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *t,  Float_t *ph, Float_t *df, Int_t ns, Float_t *ts, Float_t *ps):
   TObject(),
   fNtracks(ntr),
   fTh(0),
   fPhi(0),
   fDeltPhi(0),
-  fLabels(0),
   fNsingle(ns),
   fThsingle(0),
   fPhisingle(0)
@@ -36,12 +34,10 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *t,  Float_t *ph, Float_t *d
     fTh = new Float_t [ntr];
     fPhi = new Float_t [ntr];
     fDeltPhi = new Float_t [ntr];
-    fLabels = new Int_t[ntr];
     for(Int_t i=0;i0){
@@ -61,7 +57,6 @@ AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
   fTh(0),
   fPhi(0),
   fDeltPhi(0),
-  fLabels(0),
   fNsingle(m.fNsingle),
   fThsingle(0),
   fPhisingle(0)
@@ -81,7 +76,6 @@ AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){
   if (fTh)delete [] fTh;
   if(fPhi)delete [] fPhi;
   if(fDeltPhi)delete [] fDeltPhi;
-  if(fLabels)delete [] fLabels;
   if(fThsingle)delete [] fThsingle;
   if(fPhisingle)delete [] fPhisingle;
   Duplicate(m);
@@ -97,13 +91,11 @@ void AliMultiplicity::Duplicate(const AliMultiplicity& m){
     fTh = new Float_t [fNtracks];
     fPhi = new Float_t [fNtracks];
     fDeltPhi = new Float_t [fNtracks];
-    fLabels = new Int_t[fNtracks];
   }
   else {
     fTh = 0;
     fPhi = 0;
     fDeltPhi = 0;
-    fLabels = 0;
   }
   fNsingle = m.fNsingle;
   if(fNsingle>0){
@@ -117,7 +109,6 @@ void AliMultiplicity::Duplicate(const AliMultiplicity& m){
   memcpy(fTh,m.fTh,fNtracks*sizeof(Float_t));
   memcpy(fPhi,m.fPhi,fNtracks*sizeof(Float_t));
   memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Float_t));
-  memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t));
   memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Float_t));
   memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Float_t));
 }
@@ -128,7 +119,6 @@ AliMultiplicity::~AliMultiplicity(){
   if (fTh)delete [] fTh;
   if(fPhi)delete [] fPhi;
   if(fDeltPhi)delete [] fDeltPhi;
-  if(fLabels)delete [] fLabels;
   if(fThsingle)delete [] fThsingle;
   if(fPhisingle)delete [] fPhisingle;
 }
diff --git a/STEER/AliMultiplicity.h b/STEER/AliMultiplicity.h
index b562b92d0dd..2d862bb6eb2 100644
--- a/STEER/AliMultiplicity.h
+++ b/STEER/AliMultiplicity.h
@@ -14,8 +14,8 @@ class AliMultiplicity : public TObject {
 
   AliMultiplicity();               // default constructor
   // standard constructor
-  AliMultiplicity(Int_t ntr,Float_t *t, Float_t *ph, Float_t *df, Int_t *labels,
-                  Int_t ns, Float_t *ts, Float_t *ps);
+  AliMultiplicity(Int_t ntr,Float_t *t, Float_t *ph, Float_t *df,
+                  Int_t ns, Float_t *ts, Float_t *ps); 
   AliMultiplicity(const AliMultiplicity& m);
   AliMultiplicity& operator=(const AliMultiplicity& m);
   virtual ~AliMultiplicity();
@@ -27,8 +27,6 @@ class AliMultiplicity : public TObject {
   else {Error("GetPhi","Invalid track number %d",i); return -9999.;}}
   Float_t GetDeltaPhi(Int_t i) const {if(i>=0 && i=0 && i=0 && iSetMeanPt(meanPt);
     evTag->SetMaxPt(maxPt);
     
-    tag->SetLHCTag(lhcLuminosity,lhcState);
-    tag->SetDetectorTag(detectorMask);
-
     tag->SetRunId(iInitRunNumber);
     tag->AddEventTag(*evTag);
   }
diff --git a/STEER/AliRunTag.cxx b/STEER/AliRunTag.cxx
index bf1ee72e787..d67bcfc06c5 100644
--- a/STEER/AliRunTag.cxx
+++ b/STEER/AliRunTag.cxx
@@ -45,7 +45,7 @@ ClassImp(AliRunTag)
     fNumEvents(0),
     fNumDetectors(0),
     fEventTag("AliEventTag", 1000),
-    fDetectorTag(),
+    fDetectorTag("AliDetectorTag", 1000),
     fLHCTag()
 {
   //Default constructor
@@ -55,18 +55,19 @@ ClassImp(AliRunTag)
 AliRunTag::~AliRunTag() {
   //Destructor
   fEventTag.Delete();
+  fDetectorTag.Delete();
 }
 
 //___________________________________________________________________________
-void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
+void AliRunTag::SetLHCTag(Float_t lumin, char *type) {
   //Setter for the LHC tags
   fLHCTag.SetLHCTag(lumin,type);
 }
 
 //___________________________________________________________________________
-void AliRunTag::SetDetectorTag(UInt_t mask) {
+void AliRunTag::SetDetectorTag(const AliDetectorTag &DetTag) {
   //Setter for the detector tags
-  fDetectorTag.SetDetectorMask(mask);
+  new(fDetectorTag[fNumDetectors++]) AliDetectorTag(DetTag);
 }
 
 //___________________________________________________________________________
diff --git a/STEER/AliRunTag.h b/STEER/AliRunTag.h
index 881882fb86d..b6e816145e1 100644
--- a/STEER/AliRunTag.h
+++ b/STEER/AliRunTag.h
@@ -17,10 +17,9 @@
 #include 
 #include 
 #include "AliLHCTag.h"
-#include "AliDetectorTag.h"
 
 class AliEventTag;
-//class AliDetectorTag;
+class AliDetectorTag;
 
 
 //___________________________________________________________________________
@@ -43,8 +42,8 @@ class AliRunTag : public TObject {
   void SetCalibVersion(Int_t Pn) {fAliceCalibrationVersion = Pn;}
   void SetDataType(Int_t i) {fAliceDataType = i;}
   void SetNEvents(Int_t Pn) { fNumEvents = Pn; }
-  void SetLHCTag(Float_t Plumin, TString type);
-  void SetDetectorTag(UInt_t mask);
+  void SetLHCTag(Float_t Plumin, char *type);
+  void SetDetectorTag(const AliDetectorTag &t);
   void AddEventTag(const AliEventTag &t);
   void Clear(const char * opt = "");
   
@@ -63,8 +62,8 @@ class AliRunTag : public TObject {
   Int_t       GetDataType() const {return fAliceDataType;}
   Int_t       GetNEvents() const {return fNumEvents;}
   AliLHCTag  *GetLHCTag() {return &fLHCTag; } 
-  AliDetectorTag *GetDetectorTags() {return &fDetectorTag;}
   const TClonesArray *GetEventTags() const {return &fEventTag;}
+  const TClonesArray *GetDetectorTags() const {return &fDetectorTag;}
 
   //____________________________________________________//
  private:
@@ -83,7 +82,7 @@ class AliRunTag : public TObject {
   Int_t        fNumEvents;               //number of events per file
   Int_t        fNumDetectors;            //number of detector configs per file
   TClonesArray fEventTag;                //array with all event tags
-  AliDetectorTag fDetectorTag;             //array with all the detector tags
+  TClonesArray fDetectorTag;             //array with all the detector tags
   AliLHCTag    fLHCTag;                  //LHC tag object
   
   ClassDef(AliRunTag,3)  //(ClassName, ClassVersion)
diff --git a/STEER/AliSurveyObj.cxx b/STEER/AliSurveyObj.cxx
deleted file mode 100644
index 95744808c91..00000000000
--- a/STEER/AliSurveyObj.cxx
+++ /dev/null
@@ -1,454 +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.                  *
- **************************************************************************/
-
-/////////////////////////////////////////////////////////////////////
-//                                                                 //
-//  class AliSurveyObj						   //
-//  Retrieve and Convert survey data into ROOT Objects		   //
-//                                                                 //
-/////////////////////////////////////////////////////////////////////
-
-#include "AliSurveyObj.h"
-
-//ROOT includes
-#include "TROOT.h"
-#include "Riostream.h"
-#include "TObjArray.h"
-#include "TGrid.h"
-#include "TFile.h"
-#include "TObjString.h"
-
-//AliROOT includes
-#include "AliLog.h"
-
-//System includes
-//#include  //for sleep(3); // not used anymore!?
-
-ClassImp(AliSurveyObj)
-  
-//_____________________________________________________________________________
-AliSurveyObj::AliSurveyObj():
-  TObject(),
-  fTitle(""),
-  fDate(""),
-  fDetector(""),
-  fURL("http://edms.cern.ch/"),
-  fReportNr(-1),
-  fVersion(-1),
-  fObs(""),
-  fCoordSys(""),
-  fUnits(""),
-  fNrColumns(-1),
-  fColNames(""),
-  fIsValid(kFALSE),
-  fDataPoints(new TObjArray(1))
-{
-  // constructor
-  fDataPoints->SetOwner(kTRUE);
-}
-
-
-//_____________________________________________________________________________
-AliSurveyObj::~AliSurveyObj() {
-  //destructor
-  
-}
-
-
-//_____________________________________________________________________________
-AliSurveyObj::AliSurveyObj(const AliSurveyObj& surveyObj):
-  TObject(),
-  fTitle(surveyObj.fTitle),
-  fDate(surveyObj.fDate),
-  fDetector(surveyObj.fDetector),
-  fURL(surveyObj.fURL),
-  fReportNr(surveyObj.fReportNr),
-  fVersion(surveyObj.fVersion),
-  fObs(surveyObj.fObs),
-  fCoordSys(surveyObj.fCoordSys),
-  fUnits(surveyObj.fUnits),
-  fNrColumns(surveyObj.fNrColumns),
-  fColNames(surveyObj.fColNames),
-  fIsValid(surveyObj.fIsValid),
-  fDataPoints(new TObjArray(1))
-{
-  // copy constructor
-  TObject *curr = surveyObj.fDataPoints->First();
-  while (curr != 0) {
-    fDataPoints->Add(curr);
-    curr = surveyObj.fDataPoints->After(curr);
-  }
-}
-
-//_____________________________________________________________________________
-AliSurveyObj& AliSurveyObj::operator=(const AliSurveyObj& surveyObj)
-{
-  // assignment operator
-  if (this != &surveyObj) {
-    fTitle = surveyObj.fTitle;
-    fDate = surveyObj.fDate;
-    fDetector = surveyObj.fDetector;
-    fURL = surveyObj.fURL;
-    fReportNr = surveyObj.fReportNr;
-    fVersion = surveyObj.fVersion;
-    fObs = surveyObj.fObs;
-    fCoordSys = surveyObj.fCoordSys;
-    fUnits = surveyObj.fUnits;
-    fNrColumns = surveyObj.fNrColumns;
-    fColNames = surveyObj.fColNames;
-    fIsValid = surveyObj.fIsValid;
-    
-    TObject *curr = surveyObj.fDataPoints->First();
-    while (curr != 0) {
-      fDataPoints->Add(curr);
-      curr = surveyObj.fDataPoints->After(curr);
-    }
-  }
-  
-  return *this;
-}
-
-
-//_____________________________________________________________________________
-void AliSurveyObj::AddPoint(AliSurveyPoint* point) {
-  fDataPoints->Add(point);
-  return;
-}
-
-
-//_____________________________________________________________________________
-Bool_t AliSurveyObj::Connect(const char *gridUrl, const char *user) {
-
-   // if the same Grid is alreay active, skip connection
-	if ( !gGrid || gridUrl != gGrid->GridUrl() ||
-	     (( user != "" ) && ( user != gGrid->GetUser() )) ) {
-   	// connection to the Grid
-	   AliInfo("\nConnecting to the Grid...");
-	   if(gGrid){
-		   AliInfo(Form("gGrid = %x; GridUrl = %s; gGrid->GridUrl() = %s", 
-		                 gGrid, gridUrl, gGrid->GridUrl()));
-	      AliInfo(Form("User = %s; gGrid->GetUser() = %s",
-	                    user, gGrid->GetUser()));
-	   }
-	   TGrid::Connect(gridUrl,user);
-	}
-	
-	if(!gGrid) {
-		AliError("Connection failed!");
-		return kFALSE;
-	}
-   return kTRUE;
-}
-
-
-/*
-//_____________________________________________________________________________
-AliCDBGrid::~AliCDBGrid()
-{
-// destructor
-	delete gGrid; gGrid=0;
-
-}
-*/
-
-
-
-//_____________________________________________________________________________
-Bool_t AliSurveyObj::OpenFile(TString openString) {
-  TString storage = "alien://alice.cern.ch";
-
-  Printf("TFile::Open string: \n -> \"%s\"\n", openString.Data());
-
-  if (openString.BeginsWith("alien://")) Connect(storage.Data(), "rsilva");
-
-  TFile *file = TFile::Open(openString.Data(), "READ");
-  if ( !file ) {
-    AliError(Form("Error opening file \"%s\"", openString.Data()));
-    return kFALSE;
-  }
-
-  Int_t size = file->GetSize();
-
-  char *buf = new Char_t[size];
-  memset(buf, '\0', size);
-
-  --size;
-
-  file->Seek(0);  
-  if ( file->ReadBuffer(buf, size) ) {
-    AliError("Error reading file contents to buffer!");
-    return kFALSE;
-  }
-
-  // Printf("%d bytes read!\n", size);
-  Printf("%d bytes read!\n", file->GetBytesRead());
-  
-  // Printf("->\n%s\n<- ", buf);
-
-  // Printf("%d AQUI!\n", size);
-
-  ParseBuffer(buf);
-
-  file->Close();
-  delete[] buf;
-  return kTRUE;
-}
-
-
-
-//_____________________________________________________________________________
-Bool_t AliSurveyObj::Get(TString detector, Int_t reportNumber,
-                         Int_t reportVersion) {
-  TString baseFolder = "/alice/cern.ch/user/r/rsilva/";
-
-  TString fullOpenString = "alien://" + baseFolder + detector + '/';
-  fullOpenString += Form("%d_v%d.txt?filetype=raw", reportNumber, reportVersion);
-  // !Still need to check it's a valid path before actually using it
-
-  return OpenFile(fullOpenString);
-}
-
-
-//_____________________________________________________________________________
-Bool_t AliSurveyObj::GetFromLocalFile(const Char_t* filename) {
-  TString fullOpenString = "file://" + TString(filename) + "?filetype=raw";
-
-  return OpenFile(fullOpenString);
-}
-
-
-//_____________________________________________________________________________
-TString &AliSurveyObj::Sanitize(TString str) {
-  str.Remove(TString::kTrailing, '\r');
-  str.Remove(TString::kTrailing, '\n');
-  return str.Remove(TString::kBoth, ' ');
-}
-
-
-//_____________________________________________________________________________
-Bool_t AliSurveyObj::ParseBuffer(const Char_t* buf) {
-  TString buffer = TString(buf);
-  TObjArray *lines = buffer.Tokenize('\n');
-  TObjArray *dataLine = NULL; // Used to Tokenize each point read
-  TObjArray *colLine = NULL; // Used to Tokenize the column names
-
-  const Int_t kFieldCheck = 10;
-  Bool_t check[kFieldCheck];
-  TString tmp_name = "";
-  Float_t tmp_x = 0.0, tmp_y = 0.0, tmp_z = 0.0;
-  Float_t tmp_precX = 0.0, tmp_precY = 0.0, tmp_precZ = 0.0;
-  Char_t tmp_type = '\0';
-  Bool_t tmp_targ = kTRUE;
-  AliSurveyPoint *dp = 0;
-  
-  for (Int_t i = 0; i < kFieldCheck; ++i) check[i] = kFALSE;
-
-  Int_t nrLines = lines->GetEntries();
-  Printf("Lines in file: %d\n", nrLines); 
-
-  TString currLine = "", nextLine = "";
-  for (Int_t i = 0; i < nrLines; ++i) {
-    currLine = ((TObjString *)(lines->At(i)))->GetString().Data();
-    nextLine = ((i + 1) < nrLines ? ((TObjString *)(lines->At(i + 1)))->GetString().Data() : "");
-    currLine = Sanitize(currLine);
-    nextLine = Sanitize(nextLine);
-    Printf("\n%d: \"\"%s\"\"\"\n", i + 1, currLine.Data());
-    
-    if (0 == currLine.Length()) {
-      Printf("Info: Empty line skipped\n\n");
-    } else if (currLine.BeginsWith(">") && !nextLine.BeginsWith(">")) {
-      currLine.Remove(TString::kLeading, '>');
-      currLine.Remove(TString::kTrailing, ':');
-      currLine.Remove(TString::kBoth, ' ');
-      nextLine.Remove(TString::kBoth, ' ');
-      // Printf(" -> Field: \"%s\"\n", currLine.Data());
-      
-      if (currLine.BeginsWith("Title", TString::kIgnoreCase)) {
-	// Report Title
-	fTitle = nextLine;
-	++i;
-      } else if (currLine.BeginsWith("Date", TString::kIgnoreCase)) {
-	// Report(measurement) Date
-	fDate = nextLine;
-	++i;
-      } else if (currLine.BeginsWith("Subdetector", TString::kIgnoreCase)) {
-	// Subdetector or structure
-	fDetector = nextLine;
-	++i;
-      } else if (currLine.BeginsWith("Report URL", TString::kIgnoreCase)) {
-	// Report URL in EDMS
-	if (nextLine.BeginsWith("http://edms.cern.ch/document/", TString::kIgnoreCase) ||
-	    nextLine.BeginsWith("https://edms.cern.ch/document/", TString::kIgnoreCase)) {
-	  fURL = nextLine;
-	  nextLine.Remove(TString::kTrailing, '/');
-	  nextLine = nextLine(nextLine.Last('/') + 1, nextLine.Length() - nextLine.Last('/') + 1);
-	  // Printf(nextLine);
-	  if (!nextLine.IsDigit()) {
-	    lines->Delete();
-	    return kFALSE;
-	  }
-	  fReportNr = nextLine.Atoi();
-	  ++i;
-	} else { // URL incorrectly formated
-	  AliError("Survey text file sintax error! (incorrectly formated Report URL)");
-	  return kFALSE;
-	}
-      } else if (currLine.BeginsWith("Version", TString::kIgnoreCase)) {
-	if (!nextLine.IsDigit()) {
-	  lines->Delete();
-	  return kFALSE;
-	}
-	fVersion = nextLine.Atoi();
-	++i;
-      } else if (currLine.BeginsWith("General Observations", TString::kIgnoreCase)) {
-	fObs = "";
-	while (('>' != nextLine[0]) && nextLine.Length() > 0) {	
-	  fObs += (0 == fObs.Length()) ? nextLine : " / " + nextLine;
-	  ++i;
-	  nextLine = ((i + 1) < nrLines ? ((TObjString *)(lines->At(i + 1)))->GetString().Data() : "");
-	  nextLine = Sanitize(nextLine);
-	}
-	// Printf("->%s<-\n", fObs.Data());
-      } else if (currLine.BeginsWith("Coordinate System", TString::kIgnoreCase)) {
-	fCoordSys = nextLine;
-	++i;
-      } else if (currLine.BeginsWith("Units", TString::kIgnoreCase)) {
-	fUnits = nextLine;
-	++i;
-      } else if (currLine.BeginsWith("Nr Columns", TString::kIgnoreCase)) {
-	if (!nextLine.IsDigit()) {
-	  lines->Delete();
-	  return kFALSE;
-	}
-	fNrColumns = nextLine.Atoi();
-	++i;
-      } else if (currLine.BeginsWith("Column Names", TString::kIgnoreCase)) {
-	fColNames = nextLine;
-	colLine = nextLine.Tokenize(',');
-	if (colLine->GetEntries() != fNrColumns) {
-	  colLine->Delete();
-	  lines->Delete();
-	  return kFALSE;
-	}
-	++i;
-      } else if (currLine.BeginsWith("Data", TString::kIgnoreCase)) {
-	while (('>' != nextLine[0]) && nextLine.Length() > 0) {
-	  Printf("Data LINE: \"%s\"\n", nextLine.Data());
-
-	  dataLine = nextLine.Tokenize(' ');
-	  if (dataLine->GetEntries() != fNrColumns) {
-	    dataLine->Delete();
-	    lines->Delete();
-	    return kFALSE;
-	  }
-
-	  for (Int_t t = 0; t < kFieldCheck; ++t) check[t] = 0;
-
-	  for (Int_t j = 0; j < dataLine->GetEntries(); ++j) {
-	    TString cn = ((TObjString *)(colLine->At(j)))->GetString();
-	    TString value = ((TObjString *)(dataLine->At(j)))->GetString();
-	    if (cn.BeginsWith("Point Name", TString::kIgnoreCase)) {
-	      tmp_name = value;
-	      check[0] = kTRUE;
-	    } else if (cn.BeginsWith("X", TString::kIgnoreCase)) {
-	      tmp_x = value.Atof();
-	      check[1] = kTRUE;
-	    } else if (cn.BeginsWith("Y", TString::kIgnoreCase)) {
-	      tmp_y = value.Atof();
-	      check[2] = kTRUE;
-	    } else if (cn.BeginsWith("Z", TString::kIgnoreCase)) {
-	      tmp_z = value.Atof();
-	      check[3] = kTRUE;
-	    } else if (cn.BeginsWith("Precision", TString::kIgnoreCase)) {
-	      TString tmpCN = cn(0, cn.First('('));
-	      Int_t precLength = TString("Precision").Length();
-	      //Printf(" ====== %d ======= %d ====== \n", precLength, tmpCN.Length());
-	      //Printf(" ====== %s ======= \n", tmpCN.Data());
-	      if (precLength == tmpCN.Length()) {
-		tmp_precX = tmp_precY = tmp_precZ = value.Atof();
-		check[6] = kTRUE;
-	      } else {
-		TString axis = cn(precLength, tmpCN.Length() - precLength);
-		if (axis.Contains('X', TString::kIgnoreCase)) {
-		  tmp_precX = value.Atof();
-		  check[7] = kTRUE;
-		} else if (axis.Contains('Y', TString::kIgnoreCase)) {
-		  tmp_precY = value.Atof();
-		  check[8] = kTRUE;
-		} else if (axis.Contains('Z', TString::kIgnoreCase)) {
-		  tmp_precZ = value.Atof();
-		  check[9] = kTRUE;
-		} else {
-		  AliError("Survey text file sintax error! (Precision column name invalid)");
-		  dataLine->Delete();
-		  lines->Delete();
-		  return kFALSE;
-		}
-	      }
-	    } else if (cn.BeginsWith("Point Type", TString::kIgnoreCase)) {
-	      tmp_type = value.Data()[0];
-	      check[4] = kTRUE;
-	    } else if (cn.BeginsWith("Target Used", TString::kIgnoreCase)) {
-	      tmp_targ = (value.Data()[0] == 'Y') ? kTRUE : kFALSE;
-	      check[5] = kTRUE;
-	    }
-
-	    Printf("--> %s\n", ((TObjString *)(dataLine->At(j)))->GetString().Data());
-	  }
-	  Bool_t res = kTRUE, precInd = kTRUE;
-
-	  // Target
-	  if (kFALSE == check[5]) {
-	    tmp_targ = kTRUE;
-	    check[5] = kTRUE;
-	  }
-	  
-	  // Individual axis precisions
-	  for (Int_t t = 7; t < 10; ++t) precInd &= check[t];
-	  if ((kFALSE == check[6]) && (kTRUE == precInd)) check[6] = kTRUE;
-
-	  for (Int_t t = 0; t < kFieldCheck - 3; ++t) {
-	    Printf("RES(%d): %d\n", t, check[t]);
-	    res &= check[t];
-	  }
-	  if (kTRUE == res) {
-	    dp = new AliSurveyPoint(tmp_name, tmp_x, tmp_y, tmp_z, tmp_precX, tmp_precY, tmp_precZ, tmp_type, tmp_targ);
-	    dp->PrintPoint();
-	    AddPoint(dp);
-	  } else {
-	    AliError("Parsing error processing data line!");
-	    dataLine->Delete();
-	    lines->Delete();
-	    return kFALSE;
-	  }
-	  
-	  dataLine->Delete();
-	  dataLine = NULL;
-	  ++i;
-	  nextLine = ((i + 1) < nrLines ? ((TObjString *)(lines->At(i + 1)))->GetString().Data() : "");
-	  nextLine = Sanitize(nextLine);
-	}
-      }
-    } else { // 2 lines in a row start with ">"
-      AliError("Survey text file sintax error! (2 consecutive lines start with \'>\')");
-      lines->Delete();
-      return kFALSE;
-    }
-  }
-  lines->Delete();
-  fIsValid = kTRUE;
-  return kTRUE;
-}
-
diff --git a/STEER/AliSurveyObj.h b/STEER/AliSurveyObj.h
deleted file mode 100644
index d0363234cd1..00000000000
--- a/STEER/AliSurveyObj.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef ALI_SURVEY_OBJ_H
-#define ALI_SURVEY_OBJ_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/////////////////////////////////////////////////////////////////////
-//                                                                 //
-//  class AliSurveyObj						   //
-//  Retrieve and Convert survey data into ROOT Objects   	   //
-//                                                                 //
-/////////////////////////////////////////////////////////////////////
-
-#include 
-//#include 
-
-#include 
-#include 
-
-//#include "AliLog.h"
-#include "AliSurveyPoint.h"
-
-class AliSurveyObj: public TObject {
-
- public:
-  AliSurveyObj();
-  ~AliSurveyObj();
-  Bool_t GetFromLocalFile(const Char_t* filename);
-  Bool_t Get(TString detector, Int_t reportNumber, Int_t reportVersion);
-
-  
-  Int_t GetEntries() const {return fDataPoints->GetEntries();};
-  Bool_t IsValid() const {return fIsValid;};
-
-  
- private:
-  TString fTitle;     // Report Title
-  TString fDate;      // Report Date
-  TString fDetector;  // Subdetector (or structure) surveyed
-  TString fURL;       // Report URL in EDMS
-  Int_t fReportNr;    // Report Number
-  Int_t fVersion;     // Report Version
-  TString fObs;       // General observations / comments
-  TString fCoordSys;  // Measurements coordinate system
-  TString fUnits;     // Measurements units
-  Int_t fNrColumns;   // Number of columns in data values
-  TString fColNames;  // Column names sepparated by commas
-  Bool_t fIsValid;    // Is the data valid? (sucessfully parsed)
-  
-  TObjArray *fDataPoints;	// Actual Data
-  
-  Bool_t Connect(const char *gridUrl, const char *user);
-  Bool_t OpenFile(TString openString);
-  TString &Sanitize(TString str);
-  Bool_t ParseBuffer(const Char_t* buf);
-  AliSurveyObj (const AliSurveyObj& surveyObj);            // copy constructor
-  AliSurveyObj& operator=(const AliSurveyObj& surveyObj);  // assignment operator 
-  void AddPoint(AliSurveyPoint* point);
-  ClassDef(AliSurveyObj, 1);
-};
-
-#endif
diff --git a/STEER/AliSurveyPoint.cxx b/STEER/AliSurveyPoint.cxx
deleted file mode 100644
index 9d30c4973c4..00000000000
--- a/STEER/AliSurveyPoint.cxx
+++ /dev/null
@@ -1,72 +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.                  *
- **************************************************************************/
-
-/////////////////////////////////////////////////////////////////////
-//                                                                 //
-//  class AliSurveyPoint						   //
-//  Retrieve and Convert survey data into ROOT Objects		   //
-//                                                                 //
-/////////////////////////////////////////////////////////////////////
-
-#include "AliSurveyPoint.h"
-
-ClassImp(AliSurveyPoint)
-  
-//_____________________________________________________________________________
-AliSurveyPoint::AliSurveyPoint():
-  fPointName(""),
-  fX(0.0),
-  fY(0.0),
-  fZ(0.0),
-  fPrecisionX(0.0),
-  fPrecisionY(0.0),
-  fPrecisionZ(0.0),
-  fType(' '),
-  fTargetUsed(kTRUE)
-{
-  // constructor
-  
-}
-
-//_____________________________________________________________________________
-AliSurveyPoint::AliSurveyPoint(TString name, Float_t x, Float_t y,
-                               Float_t z, Float_t precX, Float_t precY,
-                               Float_t precZ, Char_t type, Bool_t Target):
-  fPointName(name),
-  fX(x),
-  fY(y),
-  fZ(z),
-  fPrecisionX(precX),
-  fPrecisionY(precY),
-  fPrecisionZ(precZ),
-  fType(type),
-  fTargetUsed(Target)
-{
-  //constructor
-  
-}
-
-//_____________________________________________________________________________
-AliSurveyPoint::~AliSurveyPoint() {
-  //destructor
-  
-}
-
-//_____________________________________________________________________________
-void AliSurveyPoint::PrintPoint() {
-  printf("Point Coordinates \"%s\": %f %f %f\n", (const char*) fPointName, fX, fY, fZ);
-  return;
-}
-
diff --git a/STEER/AliSurveyPoint.h b/STEER/AliSurveyPoint.h
deleted file mode 100644
index 78fcf637fb6..00000000000
--- a/STEER/AliSurveyPoint.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef ALI_SURVEY_POINT_H
-#define ALI_SURVEY_POINT_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/////////////////////////////////////////////////////////////////////
-//                                                                 //
-//  class AliSurveyPoint					   //
-//  Retrieve and Convert survey data into ROOT Objects		   //
-//                                                                 //
-/////////////////////////////////////////////////////////////////////
-
-#include 
-#include 
-
-class AliSurveyPoint: public TObject {
-
- public:
-  AliSurveyPoint();
-  AliSurveyPoint(TString name, Float_t x, Float_t y, Float_t z,
-		 Float_t precX, Float_t precY, Float_t precZ, 
-                 Char_t type, Bool_t Target);
-  virtual ~AliSurveyPoint();
-  
-  TString GetPointName() {return fPointName;};
-  Float_t GetX() {return fX;};
-  Float_t GetY() {return fY;};
-  Float_t GetZ() {return fZ;};
-  Float_t GetPrecisionX() {return fPrecisionX;};
-  Float_t GetPrecisionY() {return fPrecisionY;};
-  Float_t GetPrecisionZ() {return fPrecisionZ;};
-  Char_t GetType() {return fType;};
-  Bool_t GetTarget() {return fTargetUsed;};
-  
-  void PrintPoint();
-  
- private:
-  TString fPointName;
-  Float_t fX;
-  Float_t fY;
-  Float_t fZ;
-  Float_t fPrecisionX;
-  Float_t fPrecisionY;
-  Float_t fPrecisionZ;
-  Char_t fType;
-  Bool_t fTargetUsed;
-  
-  ClassDef(AliSurveyPoint, 1);
-};
-
-#endif
diff --git a/STEER/AliTrackFitter.cxx b/STEER/AliTrackFitter.cxx
index 7efcf62ceae..dfce869f045 100644
--- a/STEER/AliTrackFitter.cxx
+++ b/STEER/AliTrackFitter.cxx
@@ -163,120 +163,3 @@ Bool_t AliTrackFitter::FindVolId(const TArrayI *array, UShort_t volid) const
 
   return found;
 }
-
-Bool_t AliTrackFitter::Fit(const TArrayI *volIds,const TArrayI *volIdsFit,
-AliAlignObj::ELayerID layerRangeMin,
-AliAlignObj::ELayerID layerRangeMax)
-{
-  //-------------------------------------------------------------------
-  //
-  //                      Fit the track points. 
-  //
-  // volIds    - the array of IDs of volumes where the residuals 
-  //             will be calculated.
-  // volIdsFit - the array of IDs of volumes having the points
-  //              that will be fitted
-  // 
-  // If volIdsFit==0, the IDs of volumes having the points to fit
-  // are taken in the range defined by the two last parameters
-  // 
-  //
-  // The function fills two track-point arrays: fPVolId and fPTrack.
-  // The first one contains the track points from the volumes with IDs  
-  // taken from the "volIds". The second array is filled with 
-  // the intersection points between the fitted track and the volumes
-  // the points from the first arry belong to.
-  //
-  // The two arrays are used for calculation of the residuals
-  // and for the construction of a chi2 function to be minimized 
-  // in the alignment procedures. 
-  //
-  //--------------------------------------------------------------------
-
-  Int_t npoints=fPoints->GetNPoints();
-  if (npointsGetVolumeID()[i])) countPnt++;
-         if (FindVolId(volIdsFit,fPoints->GetVolumeID()[i])) {
-            countFit++;
-            if (fst<0) fst=i;
-            lst=i;
-         }
-     }
-  } else {
-     for (Int_t i=0; iGetVolumeID()[i]; 
-         if (FindVolId(volIds,id)) countPnt++;
-         if (id < AliAlignObj::LayerToVolUID(layerRangeMin,0)) continue;
-	 if (id > AliAlignObj::LayerToVolUID(layerRangeMax,
-		  AliAlignObj::LayerSize(layerRangeMax))) continue;
-         countFit++;
-         if (fst<0) fst=i;
-         lst=i;
-     }
-  }
-  if (countPnt==0) return kFALSE;
-  if (countFitGetVolumeID()[i])) continue;
-         fPoints->GetPoint(p,i);
-         if (!AddPoint(&p)) return kFALSE;
-     }
-  } else {
-     for (Int_t i=0; iGetVolumeID()[i]; 
-         if (id < AliAlignObj::LayerToVolUID(layerRangeMin,0)) continue;
-	 if (id > AliAlignObj::LayerToVolUID(layerRangeMax,
-		  AliAlignObj::LayerSize(layerRangeMax))) continue;
-         fPoints->GetPoint(p,i);
-         if (!AddPoint(&p)) continue;
-     }
-  }
-
-  if (!Update()) return kFALSE;
-
-
-
-
-  //************* Calculate the intersection points
-
-  fPVolId = new AliTrackPointArray(countPnt);
-  fPTrack = new AliTrackPointArray(countPnt);
-
-  Int_t n=0;
-  AliTrackPoint p2;
-  for (Int_t i=0; iGetVolumeID()[i])) continue;
-      fPoints->GetPoint(p,i);
-      if (GetPCA(p,p2)) {
-	fPVolId->AddPoint(n,&p);
-	fPTrack->AddPoint(n,&p2);
-        n++;
-      } else {
-	delete fPVolId;
-	fPVolId=0;
-	delete fPTrack;
-	fPTrack=0;
-	return kFALSE;
-      }
-  }
-  
-  return kTRUE;
-}
diff --git a/STEER/AliTrackFitter.h b/STEER/AliTrackFitter.h
index 952f0a6959e..0684e1beedf 100644
--- a/STEER/AliTrackFitter.h
+++ b/STEER/AliTrackFitter.h
@@ -30,12 +30,7 @@ class AliTrackFitter : public TObject {
   virtual void   SetTrackPointArray(AliTrackPointArray *array, Bool_t owner = kTRUE);
   virtual Bool_t Fit(const TArrayI *volIds,const TArrayI *volIdsFit = 0x0,
 		     AliAlignObj::ELayerID layerRangeMin = AliAlignObj::kFirstLayer,
-		     AliAlignObj::ELayerID layerRangeMax = AliAlignObj::kLastLayer);
-
-  virtual Bool_t Begin(Int_t, Int_t) = 0;
-  virtual Bool_t AddPoint(const AliTrackPoint *p) = 0;
-  virtual Bool_t Update() = 0;
-
+		     AliAlignObj::ELayerID layerRangeMax = AliAlignObj::kLastLayer) = 0;
   virtual Bool_t GetPCA(const AliTrackPoint &pIn, AliTrackPoint &pOut) const = 0;
 
   Bool_t         FindVolId(const TArrayI *array, UShort_t volid) const;
diff --git a/STEER/AliTrackFitterKalman.cxx b/STEER/AliTrackFitterKalman.cxx
deleted file mode 100755
index 2266395b035..00000000000
--- a/STEER/AliTrackFitterKalman.cxx
+++ /dev/null
@@ -1,328 +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.                  *
- **************************************************************************/
-
-///////////////////////////////////////////////////////////////////////////////
-//
-//                      Kalman-Filter-like fit 
-//   to a straight-line crossing a set of arbitrarily oriented planes.
-//   The resulting line is given by the equation:
-//                  (x-x0)/vx = (y-y0)/1 = (z-z0)/vz
-//   Parameters of the fit are:
-//        x0,y0,z0 (a point on the line) and
-//        vx,1,vz  (a vector collinear with the line)
-//
-//   LIMITATION:  The line must not be perpendicular to the Y axis. 
-//
-//          Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include 
-#include 
-
-//#include "AliLog.h"
-#include "AliTrackFitterKalman.h"
-
-ClassImp(AliTrackFitterKalman)
-
-const Double_t AliTrackFitterKalman::fgkMaxChi2=33.;
-
-AliTrackFitterKalman::
-AliTrackFitterKalman(AliTrackPointArray *array, Bool_t owner):
-  AliTrackFitter(array,owner),
-  fMaxChi2(fgkMaxChi2),
-  fSeed(kFALSE)
-{
-  //
-  // Constructor
-  //
-}
-
-Bool_t AliTrackFitterKalman::Begin(Int_t first, Int_t last) {
-  //
-  // Make a seed out of the track points with the indices "first" and "last". 
-  // This is the "default" seed.
-  //
-  if (fSeed) return kTRUE;
-  AliTrackPoint fp,lp;
-  fPoints->GetPoint(fp,first); fPoints->GetPoint(lp,last);
-  return MakeSeed(&fp,&lp);
-}
-
-
-Bool_t AliTrackFitterKalman::
-MakeSeed(const AliTrackPoint *p0, const AliTrackPoint *p1) {
-  //
-  // Make a seed out of the two track points 
-  //
-  Double_t x0=p0->GetX(), y0=p0->GetY(), z0=p0->GetZ();
-  Double_t dx=p1->GetX()-x0, dy=p1->GetY()-y0, dz=p1->GetZ()-z0;
-  Double_t vx=dx/dy;
-  Double_t vz=dz/dy;
-  Double_t par[5]={x0,y0,z0,vx,vz};
-
-  const Float_t *cv0=p0->GetCov();
-  const Float_t *cv1=p1->GetCov();
-  Double_t rdx2=(cv0[0]+cv1[0])/dx/dx;
-  Double_t rdy2=(cv0[3]+cv1[3])/dy/dy;
-  Double_t rdz2=(cv0[5]+cv1[5])/dz/dz;
-  Double_t svx2=vx*vx*(rdx2+rdy2);     
-  Double_t svz2=vz*vz*(rdz2+rdy2);     
-  Double_t cov[15]={
-     cv0[0],
-     cv0[1],cv0[3],
-     cv0[2],cv0[4],cv0[5],
-     0.,0.,0.,svx2,
-     0.,0.,0.,0.,svz2
-  };
-
-  SetSeed(par,cov);
-
-  return kTRUE;
-}
-
-Bool_t AliTrackFitterKalman::AddPoint(const AliTrackPoint *p)
-{
-  //
-  // Add a point to the fit
-  //
-
-  if (!Propagate(p))   return kFALSE;
-  Double_t chi2=GetPredictedChi2(p);
-  if (chi2>fMaxChi2)   return kFALSE;
-  if (!Update(p,chi2)) return kFALSE;
-  
-  return kTRUE;
-}
-
-
-Double_t AliTrackFitterKalman::GetPredictedChi2(const AliTrackPoint *p) const {
-  //
-  // Calculate the predicted chi2 increment.
-  //
-
-  Float_t txyz[3]={GetParam()[0],GetParam()[1],GetParam()[2]};
-  TMatrixDSym &cv=*fCov;
-  Float_t tcov[6]={
-    cv(0,0),cv(1,0),cv(2,0),
-            cv(1,1),cv(2,1),
-                    cv(2,2)
-  };
-  AliTrackPoint tp(txyz,tcov,p->GetVolumeID());
-
-  Double_t chi2=p->GetResidual(tp,kTRUE);
-
-  return chi2;
-}
-
-
-Bool_t AliTrackFitterKalman::Propagate(const AliTrackPoint *p) {
-  //
-  // Propagate the track towards the measured point "p"
-  //
-
-  TMatrixDSym &cv=*fCov;
-  Double_t s=p->GetY() - fParams[1];
-  Double_t sig2=s*s/12.; 
-
-  Double_t vx=fParams[3], vz=fParams[4];
-  fParams[0] += s*vx;
-  fParams[1] += s;
-  fParams[2] += s*vz;
-
-  Double_t 
-  c00 = cv(0,0) + 2*s*cv(3,0) + s*s*cv(3,3) + vx*vx*sig2,
-
-  c10 = cv(1,0) + s*cv(1,3) + vx*sig2, c11=cv(1,1) + sig2,
-  
-  c20 = cv(2,0) + s*(cv(4,0) + cv(2,3)) + s*s*cv(4,3) + vx*vz*sig2,
-  c21 = cv(2,1) + s*cv(4,1) + vz*sig2,
-  c22 = cv(2,2) + 2*s*cv(4,2) + s*s*cv(4,4) + vz*vz*sig2,
-
-  c30 = cv(3,0) + s*cv(3,3), c31 = cv(3,1),
-  c32 = cv(3,2) + s*cv(3,4), c33 = cv(3,3),
-
-  c40 = cv(4,0) + s*cv(4,3), c41 = cv(4,1),
-  c42 = cv(4,2) + s*cv(4,4), c43 = cv(4,3), c44 = cv(4,4);
-
-
-  cv(0,0)=c00; cv(0,1)=c10; cv(0,2)=c20; cv(0,3)=c30; cv(0,4)=c40;
-  cv(1,0)=c10; cv(1,1)=c11; cv(1,2)=c21; cv(1,3)=c31; cv(1,4)=c41;
-  cv(2,0)=c20; cv(2,1)=c21; cv(2,2)=c22; cv(2,3)=c32; cv(2,4)=c42;
-  cv(3,0)=c30; cv(3,1)=c31; cv(3,2)=c32; cv(3,3)=c33; cv(3,4)=c43;
-  cv(4,0)=c40; cv(4,1)=c41; cv(4,2)=c42; cv(4,3)=c43; cv(4,4)=c44;
-
-  return kTRUE;
-}
-
-Bool_t AliTrackFitterKalman::Update(const AliTrackPoint *p, Double_t chi2) {
-  //
-  // Update the track params using the measured point "p"
-  //
-
-  TMatrixDSym &c=*fCov;
-  const Float_t *cov=p->GetCov();
-
-  TMatrixDSym v(3);
-  v(0,0)=cov[0]+c(0,0); v(0,1)=cov[1]+c(0,1); v(0,2)=cov[2]+c(0,2);
-  v(1,0)=cov[1]+c(1,0); v(1,1)=cov[3]+c(1,1); v(1,2)=cov[4]+c(1,2);
-  v(2,0)=cov[2]+c(2,0); v(2,1)=cov[4]+c(2,1); v(2,2)=cov[5]+c(2,2);
-  v.Invert();
-
-  TMatrixD ch(5,3);
-  ch(0,0)=c(0,0); ch(0,1)=c(0,1); ch(0,2)=c(0,2);
-  ch(1,0)=c(1,0); ch(1,1)=c(1,1); ch(1,2)=c(1,2);
-  ch(2,0)=c(2,0); ch(2,1)=c(2,1); ch(2,2)=c(2,2);
-  ch(3,0)=c(3,0); ch(3,1)=c(3,1); ch(3,2)=c(3,2);
-  ch(4,0)=c(4,0); ch(4,1)=c(4,1); ch(4,2)=c(4,2);
-
-  TMatrixD k(ch,TMatrixD::kMult,v);
-
-  TMatrixD d(3,1);
-  d(0,0) = p->GetX() - fParams[0];
-  d(1,0) = p->GetY() - fParams[1];
-  d(2,0) = p->GetZ() - fParams[2];
-
-  TMatrixD x(k,TMatrixD::kMult,d);
-
-  fParams[0]+=x(0,0);
-  fParams[1]+=x(1,0);
-  fParams[2]+=x(2,0);
-  fParams[3]+=x(3,0);
-  fParams[4]+=x(4,0);
-
-  TMatrixD hc(3,5);
-  hc(0,0)=c(0,0);hc(0,1)=c(0,1);hc(0,2)=c(0,2);hc(0,3)=c(0,3);hc(0,4)=c(0,4);
-  hc(1,0)=c(1,0);hc(1,1)=c(1,1);hc(1,2)=c(1,2);hc(1,3)=c(1,3);hc(1,4)=c(1,4);
-  hc(2,0)=c(2,0);hc(2,1)=c(2,1);hc(2,2)=c(2,2);hc(2,3)=c(2,3);hc(2,4)=c(2,4);
-  
-  TMatrixD s(k,TMatrixD::kMult,hc);
-
-  c(0,0)-=s(0,0);c(0,1)-=s(0,1);c(0,2)-=s(0,2);c(0,3)-=s(0,3);c(0,4)-=s(0,4);
-  c(1,0)-=s(1,0);c(1,1)-=s(1,1);c(1,2)-=s(1,2);c(1,3)-=s(1,3);c(1,4)-=s(1,4);
-  c(2,0)-=s(2,0);c(2,1)-=s(2,1);c(2,2)-=s(2,2);c(2,3)-=s(2,3);c(2,4)-=s(2,4);
-  c(3,0)-=s(3,0);c(3,1)-=s(3,1);c(3,2)-=s(3,2);c(3,3)-=s(3,3);c(3,4)-=s(3,4);
-  c(4,0)-=s(4,0);c(4,1)-=s(4,1);c(4,2)-=s(4,2);c(4,3)-=s(4,3);c(4,4)-=s(4,4);
-
-  fChi2 += chi2;
-  fNdf  += 2;
-
-  return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliTrackFitterKalman::GetPCA(const AliTrackPoint &p, AliTrackPoint &i) const
-{
-  //
-  // Get the intersection point "i" between the track and the plane
-  // the point "p" belongs to.
-  //
-
-  TMatrixD t(3,1);
-  Double_t s=p.GetY() - fParams[1];
-  Double_t vx=fParams[3], vz=fParams[4];
-  t(0,0) = fParams[0] + s*vx;
-  t(1,0) = fParams[1] + s;
-  t(2,0) = fParams[2] + s*vz;
-  
-  TMatrixDSym tC(3);
-  {
-  Double_t sig2=s*s/12.;
-
-  tC(0,0) = vx*vx*sig2;
-  tC(1,0) = vx*sig2; 
-  tC(1,1) = sig2;
-  tC(2,0) = vx*vz*sig2;
-  tC(2,1) = vz*sig2;
-  tC(2,2) = vz*vz*sig2;
-
-  tC(0,1) = tC(1,0); tC(0,2) = tC(2,0);
-                     tC(1,2) = tC(2,1);
-  }
-
-  TMatrixD m(3,1);
-  m(0,0)=p.GetX();
-  m(1,0)=p.GetY();
-  m(2,0)=p.GetZ();
- 
-  TMatrixDSym mC(3);
-  {
-  const Float_t *cv=p.GetCov();
-  mC(0,0)=cv[0]; mC(0,1)=cv[1]; mC(0,2)=cv[2];
-  mC(1,0)=cv[1]; mC(1,1)=cv[3]; mC(1,2)=cv[4];
-  mC(2,0)=cv[2]; mC(2,1)=cv[4]; mC(2,2)=cv[5];
-  }
-
-  TMatrixDSym tmW(tC);
-  tmW+=mC;
-  tmW.Invert();
-
-  TMatrixD mW(tC,TMatrixD::kMult,tmW);
-  TMatrixD tW(mC,TMatrixD::kMult,tmW);
-
-  TMatrixD mi(mW,TMatrixD::kMult,m);
-  TMatrixD ti(tW,TMatrixD::kMult,t);
-  ti+=mi;
-
-  TMatrixD iC(tC,TMatrixD::kMult,tmW);
-  iC*=mC;
-  Double_t sig2=1.;  // Releasing the matrix by 1 cm along the track direction 
-  iC(0,0) += vx*vx*sig2;
-  iC(0,1) += vx*sig2; 
-  iC(1,1) += sig2;
-  iC(0,2) += vx*vz*sig2;
-  iC(1,2) += vz*sig2;
-  iC(2,2) += vz*vz*sig2;
-
-
-  Float_t cov[6]={
-    iC(0,0), iC(0,1), iC(0,2),
-             iC(1,1), iC(1,2),
-                      iC(2,2)
-  };
-  i.SetXYZ(ti(0,0),ti(1,0),ti(2,0),cov);
-  UShort_t id=p.GetVolumeID();
-  i.SetVolumeID(id);
-
-  return kTRUE;
-}
-
-
-//_____________________________________________________________________________
-void 
-AliTrackFitterKalman::SetSeed(const Double_t par[5], const Double_t cov[15]) {
-  //
-  // Set the initial approximation for the track parameters
-  //
-  for (Int_t i=0; i<5; i++) fParams[i]=par[i];
-  fParams[5]=0.;
-
-  delete fCov;
-  fCov=new TMatrixDSym(5);
-  TMatrixDSym &cv=*fCov;
-
-  cv(0,0)=cov[0 ];
-  cv(1,0)=cov[1 ]; cv(1,1)=cov[2 ];
-  cv(2,0)=cov[3 ]; cv(2,1)=cov[4 ]; cv(2,2)=cov[5 ];
-  cv(3,0)=cov[6 ]; cv(3,1)=cov[7 ]; cv(3,2)=cov[8 ]; cv(3,3)=cov[9 ];
-  cv(4,0)=cov[10]; cv(4,1)=cov[11]; cv(4,2)=cov[12]; cv(4,3)=cov[13]; cv(4,4)=cov[14];
- 
-  cv(0,1)=cv(1,0);
-  cv(0,2)=cv(2,0); cv(1,2)=cv(2,1);
-  cv(0,3)=cv(3,0); cv(1,3)=cv(3,1); cv(2,3)=cv(3,2);
-  cv(0,4)=cv(4,0); cv(1,4)=cv(4,1); cv(2,4)=cv(4,2); cv(3,4)=cv(4,3);
-
-  fSeed=kTRUE;
-}
diff --git a/STEER/AliTrackFitterKalman.h b/STEER/AliTrackFitterKalman.h
deleted file mode 100755
index ae39197f2f5..00000000000
--- a/STEER/AliTrackFitterKalman.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef ALITRACKFITTERKALMAN_H
-#define ALITRACKFITTERKALMAN_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-///////////////////////////////////////////////////////////////////////////////
-//
-//                        Kalman-Filter-like fit 
-//   to a straight-line crossing a set of arbitrarily oriented planes.
-//           (See AliTrackFitterKalman.cxx for the details)
-//
-//          Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#include "AliTrackFitter.h"
-
-class AliTrackFitterKalman : public AliTrackFitter {
-public:
-  AliTrackFitterKalman() : 
-     AliTrackFitter(), 
-     fMaxChi2(fgkMaxChi2),
-     fSeed(kFALSE) {}
-
-  AliTrackFitterKalman(AliTrackPointArray *array, Bool_t owner = kTRUE);
-  virtual ~AliTrackFitterKalman() {}
-
-  void SetMaxChi2(Double_t chi2) {fMaxChi2=chi2;}
-
-  void   SetSeed(const Double_t par[6], const Double_t cov[15]);
-  Bool_t MakeSeed(const AliTrackPoint *p, const AliTrackPoint *p2);
-
-  Bool_t GetPCA(const AliTrackPoint &p, AliTrackPoint &p2) const;
-
-  Bool_t Begin(Int_t first, Int_t last);
-  Bool_t AddPoint(const AliTrackPoint *p);
-  Bool_t Update() {fSeed=kFALSE; return kTRUE;}
-
-private:
-  AliTrackFitterKalman(const AliTrackFitterKalman &kalman);
-  AliTrackFitterKalman &operator=(const AliTrackFitterKalman& kalman);
-
-  Bool_t Propagate(const AliTrackPoint *p);
-  Double_t GetPredictedChi2(const AliTrackPoint *p) const;
-  Bool_t Update(const AliTrackPoint *p,Double_t chi2);
-
-
-  static const Double_t fgkMaxChi2;  // Default maximal allowed chi2 
-
-  Double_t fMaxChi2;                 // A point is added if chi2 < fMaxChi2 
-  Bool_t   fSeed;                    // True, if the fitter is already "seeded" 
-
-  ClassDef(AliTrackFitterKalman,2)   // Kalman-Filter fit to a straight line
-
-};
-
-#endif
diff --git a/STEER/AliTrackFitterRieman.cxx b/STEER/AliTrackFitterRieman.cxx
index 250943bcf36..eaf47d75735 100644
--- a/STEER/AliTrackFitterRieman.cxx
+++ b/STEER/AliTrackFitterRieman.cxx
@@ -367,7 +367,7 @@ void AliTrackFitterRieman::AddPoint(Float_t x, Float_t y, Float_t z, Float_t sy,
 
 
 
-Bool_t AliTrackFitterRieman::Update(){
+void AliTrackFitterRieman::Update(){
   //
   // 
   //
@@ -400,8 +400,6 @@ Bool_t AliTrackFitterRieman::Update(){
   }
   fCorrY[3]=fitY.GetChisquare()/Float_t(fRieman->GetN()-3);   
   fCorrZ[3]=fitZ.GetChisquare()/Float_t(fRieman->GetN()-3);
-
-  return kTRUE;
 }
 
 
diff --git a/STEER/AliTrackFitterRieman.h b/STEER/AliTrackFitterRieman.h
index d3bbc94f4bc..9f4ac96ed65 100644
--- a/STEER/AliTrackFitterRieman.h
+++ b/STEER/AliTrackFitterRieman.h
@@ -37,7 +37,7 @@ class AliTrackFitterRieman : public AliTrackFitter{
   Bool_t  GetCorrection() const {return fBCorrection ;}
   void Reset();
   void AddPoint(Float_t x, Float_t y, Float_t z, Float_t sy, Float_t sz);
-  Bool_t Update();
+  void Update();
 
   Double_t GetC() const              {return fRieman->GetC();}
   Double_t GetYat(Double_t x) const;
@@ -59,8 +59,6 @@ class AliTrackFitterRieman : public AliTrackFitter{
   Double_t      fCorrY[4];  // correction polynom coef
   Double_t      fCorrZ[4];  // correction polynom coef
  private:
-  Bool_t Begin(Int_t, Int_t) {Reset(); return kTRUE;}
-  Bool_t AddPoint(const AliTrackPoint *) {return kTRUE;}
   TTreeSRedirector *fDebugStream;   //!debug streamer
   ClassDef(AliTrackFitterRieman,2)  // Fast fit of helices on ITS RecPoints
 
diff --git a/STEER/AliTrackFitterStraight.cxx b/STEER/AliTrackFitterStraight.cxx
index 84ac78221dd..0dc49ecc45b 100644
--- a/STEER/AliTrackFitterStraight.cxx
+++ b/STEER/AliTrackFitterStraight.cxx
@@ -228,7 +228,7 @@ void AliTrackFitterStraight::AddPoint(Float_t x, Float_t y, Float_t z, Float_t s
   fSumZZ += z*z*weight;
 }
 
-Bool_t AliTrackFitterStraight::Update(){
+void AliTrackFitterStraight::Update(){
   //
   //  Track fitter update
   //
@@ -287,8 +287,6 @@ Bool_t AliTrackFitterStraight::Update(){
     fConv =kTRUE;
   else
     fConv=kFALSE;
-
-  return kTRUE;
 }
 
 Double_t AliTrackFitterStraight::GetYat(Double_t x) const {
diff --git a/STEER/AliTrackFitterStraight.h b/STEER/AliTrackFitterStraight.h
index 574ab6eec1c..2585e1526b7 100644
--- a/STEER/AliTrackFitterStraight.h
+++ b/STEER/AliTrackFitterStraight.h
@@ -18,7 +18,7 @@ class AliTrackFitterStraight : public AliTrackFitter{
 
   void Reset();
   void AddPoint(Float_t x, Float_t y, Float_t z, Float_t sy, Float_t sz);
-  Bool_t Update();
+  void Update();
 
   //  Double_t GetC(); 
   Double_t GetYat(Double_t x) const;
@@ -38,8 +38,6 @@ class AliTrackFitterStraight : public AliTrackFitter{
   Bool_t        fConv;      // indicates convergation
 
  private:
-  Bool_t Begin(Int_t, Int_t) {Reset(); return kTRUE;}
-  Bool_t AddPoint(const AliTrackPoint *) {return kTRUE;}
 
   ClassDef(AliTrackFitterStraight,1)  // Fast fit of straight tracks
 
diff --git a/STEER/CDBLinkDef.h b/STEER/CDBLinkDef.h
index 91bcd56d730..254f045c609 100644
--- a/STEER/CDBLinkDef.h
+++ b/STEER/CDBLinkDef.h
@@ -27,6 +27,10 @@
 #pragma link C++ class AliCDBGridFactory+;
 #pragma link C++ class AliCDBGridParam+;
 
+#pragma link C++ class AliDCSValue+;
+#pragma link C++ class AliDCSSensor+;
+#pragma link C++ class AliDCSSensorArray+;
+
 #pragma link C++ class AliPreprocessor+;
 
 #pragma link C++ class AliShuttleInterface+;
diff --git a/STEER/ESDLinkDef.h b/STEER/ESDLinkDef.h
index bc43f750e4c..b81327892b5 100644
--- a/STEER/ESDLinkDef.h
+++ b/STEER/ESDLinkDef.h
@@ -43,8 +43,6 @@
 
 #pragma link C++ class AliTagCreator+;
 #pragma link C++ class AliRunTagCuts+;
-#pragma link C++ class AliLHCTagCuts+;
-#pragma link C++ class AliDetectorTagCuts+;
 #pragma link C++ class AliEventTagCuts+;
 
 #pragma link C++ class AliTrackPointArray+;
diff --git a/STEER/STEERLinkDef.h b/STEER/STEERLinkDef.h
index 6d9694cefa1..b264796eb9c 100644
--- a/STEER/STEERLinkDef.h
+++ b/STEER/STEERLinkDef.h
@@ -94,7 +94,6 @@
 
 #pragma link C++ class AliTrackFitter+;
 #pragma link C++ class AliTrackFitterRieman+;
-#pragma link C++ class AliTrackFitterKalman+;
 #pragma link C++ class AliTrackFitterStraight+;
 #pragma link C++ class AliTrackResiduals+;
 #pragma link C++ class AliTrackResidualsChi2+;
@@ -129,11 +128,4 @@
 
 #pragma link C++ class  AliSplineFit+;
 
-#pragma link C++ class AliDCSValue+;
-#pragma link C++ class AliDCSSensor+;
-#pragma link C++ class AliDCSSensorArray+;
-
-#pragma link C++ class AliSurveyObj+;
-#pragma link C++ class AliSurveyPoint+;
-
 #endif
diff --git a/STEER/libCDB.pkg b/STEER/libCDB.pkg
index ae7449f4d0b..657ca85d60b 100644
--- a/STEER/libCDB.pkg
+++ b/STEER/libCDB.pkg
@@ -1,8 +1,8 @@
 SRCS          = AliCDBEntry.cxx AliCDBId.cxx AliCDBMetaData.cxx \
 AliCDBPath.cxx AliCDBRunRange.cxx AliCDBManager.cxx \
 AliCDBStorage.cxx AliCDBLocal.cxx AliCDBDump.cxx AliCDBGrid.cxx \
-AliPreprocessor.cxx AliShuttleInterface.cxx \
-AliGRPPreprocessor.cxx AliGRPDCS.cxx
+AliDCSValue.cxx AliPreprocessor.cxx AliShuttleInterface.cxx \
+AliGRPPreprocessor.cxx AliGRPDCS.cxx AliDCSSensor.cxx AliDCSSensorArray.cxx
 
 HDRS:= $(SRCS:.cxx=.h)
 
@@ -11,7 +11,7 @@ DHDR= CDBLinkDef.h
 EXPORT:= AliCDBEntry.h AliCDBId.h AliCDBMetaData.h \
 AliCDBPath.h AliCDBRunRange.h AliCDBManager.h \
 AliCDBStorage.h AliCDBLocal.h AliCDBDump.h AliCDBGrid.h \
-AliPreprocessor.h  AliShuttleInterface.h \
-AliGRPPreprocessor.h AliGRPDCS.h
-
+AliDCSValue.h AliPreprocessor.h  AliShuttleInterface.h \
+AliGRPPreprocessor.h AliGRPDCS.h \
+AliDCSSensorArray.h  AliDCSSensor.h
 
diff --git a/STEER/libESD.pkg b/STEER/libESD.pkg
index d84a269f6ef..d0c768e81db 100644
--- a/STEER/libESD.pkg
+++ b/STEER/libESD.pkg
@@ -9,7 +9,7 @@ SRCS = AliESD.cxx AliESDfriend.cxx\
        AliLog.cxx AliPID.cxx AliESDV0Params.cxx \
        AliRunTag.cxx AliLHCTag.cxx AliDetectorTag.cxx AliEventTag.cxx \
        AliTagCreator.cxx AliEventTagCuts.cxx AliRunTagCuts.cxx\
-       AliLHCTagCuts.cxx AliDetectorTagCuts.cxx AliTrackPointArray.cxx \
+       AliTrackPointArray.cxx \
        AliESDFMD.cxx AliFMDMap.cxx AliFMDFloatMap.cxx \
        AliESDMultITS.cxx \
        AliESDVZERO.cxx \
diff --git a/STEER/libSTEER.pkg b/STEER/libSTEER.pkg
index cfafdb6b619..fd6af5342da 100644
--- a/STEER/libSTEER.pkg
+++ b/STEER/libSTEER.pkg
@@ -27,8 +27,7 @@ AliTriggerDetector.cxx \
 AliTriggerCondition.cxx \
 AliTriggerDescriptor.cxx \
 AliCentralTrigger.cxx AliRieman.cxx\
-AliTrackFitter.cxx AliTrackFitterRieman.cxx AliTrackFitterKalman.cxx\
-AliTrackFitterStraight.cxx\
+AliTrackFitter.cxx AliTrackFitterRieman.cxx AliTrackFitterStraight.cxx\
 AliTrackResiduals.cxx AliTrackResidualsChi2.cxx AliTrackResidualsFast.cxx AliTrackResidualsLinear.cxx\
 AliAlignmentTracks.cxx \
 AliExpression.cxx \
@@ -36,9 +35,7 @@ AliCTPRawData.cxx AliCTPRawStream.cxx \
 AliMathBase.cxx AliSignalProcesor.cxx \
 AliTracker.cxx AliCluster.cxx AliHelix.cxx AliV0.cxx AliKink.cxx \
 AliSelectorRL.cxx AliSplineFit.cxx \
-AliMagFMapsV1.cxx \
-AliDCSValue.cxx AliDCSSensor.cxx AliDCSSensorArray.cxx \
-AliSurveyObj.cxx AliSurveyPoint.cxx
+AliMagFMapsV1.cxx
 
 
 HDRS:= $(SRCS:.cxx=.h) 
diff --git a/STRUCT/AliFRAMEv2.cxx b/STRUCT/AliFRAMEv2.cxx
index 82fe7515d76..fcc33a47df3 100644
--- a/STRUCT/AliFRAMEv2.cxx
+++ b/STRUCT/AliFRAMEv2.cxx
@@ -472,7 +472,7 @@ void AliFRAMEv2::CreateGeometry()
   ptrd1[0] = 50.18;
   ptrd1[1] = 70.35;
   ptrd1[2] = 375.5;
-  ptrd1[3] =  57.7;  
+  ptrd1[3] =  57.2;  
   
   Float_t r      = 341.8;
   Float_t rout1  = 410.564;
@@ -887,9 +887,9 @@ void AliFRAMEv2::CreateGeometry()
 //
 // TOF  mother volumes
 //
-  ptrd1[0] = 62.2500; 
-  ptrd1[1] = 67.3631; 
-  ptrd1[2] = 373.6; 
+  ptrd1[0] = 63.2061;
+  ptrd1[1] = 68.3192;
+  ptrd1[2] = 375.5;
   ptrd1[3] = 14.5;
   for (i = 0; i < 18; i++) {
     char nameCh[16];
diff --git a/T0/AliT0CalibData.cxx b/T0/AliT0CalibData.cxx
index 5e03f2b60ef..815f417999e 100644
--- a/T0/AliT0CalibData.cxx
+++ b/T0/AliT0CalibData.cxx
@@ -48,14 +48,7 @@ ClassImp(AliT0CalibData)
 }
 
 //________________________________________________________________
-AliT0CalibData::AliT0CalibData(const char* name):TNamed(),
-				      fTimeDelayTVD(0),
-				      fMeanT0(0),
-				      fWalk(0),
-				      fSlewingLED(0),
-				      fSlewingRec(0),
-				      fLookup(0),
-				      fNumberOfTRMs(0)
+AliT0CalibData::AliT0CalibData(const char* name):TNamed(),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec()
 {
   TString namst = "Calib_";
   namst += name;
@@ -66,15 +59,7 @@ AliT0CalibData::AliT0CalibData(const char* name):TNamed(),
 
 //________________________________________________________________
 AliT0CalibData::AliT0CalibData(const AliT0CalibData& calibda) :
-  TNamed(calibda),		
-  fTimeDelayTVD(0),
-  fMeanT0(0),
-  fWalk(0),
-  fSlewingLED(0),
-  fSlewingRec(0),
-  fLookup(0),
-  fNumberOfTRMs(0)
-
+  TNamed(calibda),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec()
 {
 // copy constructor
   SetName(calibda.GetName());
@@ -102,7 +87,7 @@ AliT0CalibData::~AliT0CalibData()
 void AliT0CalibData::Reset()
 {
     memset(fTimeDelayCFD,1,24*sizeof(Float_t));
-    memset(fTimeDelayDA,1,24*sizeof(Float_t));
+    memset(fTimeDelayLED,1,24*sizeof(Float_t));
 }
 
 
@@ -111,8 +96,8 @@ void  AliT0CalibData::Print(Option_t*) const
 {
 
   printf("\n	----	PM Arrays	----\n\n");
-  printf(" Time delay CFD & DA\n");
-  for (Int_t i=0; i<24; i++) printf(" CFD  %f DA %f ",fTimeDelayCFD[i], fTimeDelayDA[i]);
+  printf(" Time delay CFD & LED\n");
+  for (Int_t i=0; i<24; i++) printf(" CFD  %f LED %f ",fTimeDelayCFD[i], fTimeDelayLED[i]);
 } 
 
 //________________________________________________________________
@@ -132,7 +117,7 @@ void  AliT0CalibData::PrintLookup(Option_t*, Int_t iTRM, Int_t iTDC, Int_t iChan
   printf(" AliT0CalibData::PrintLookup ::start GetValue %i %i %i \n",iTRM, iTDC, iChannel);
   lookkey = (AliT0LookUpKey*) fLookup.GetValue((TObject*)lookvalue);
   
-
+  cout<<"  AliT0CalibData::PrintLookup :: lookkey "<< lookkey<GetKey()<<" VALUE "<GetTRM()<<" "
@@ -150,9 +135,9 @@ void AliT0CalibData::SetTimeDelayCFD(Float_t* TimeDelay)
   if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayCFD[t] = TimeDelay[t];
 }  
   //________________________________________________________________
-  void AliT0CalibData::SetTimeDelayDA(Float_t* TimeDelay)
+  void AliT0CalibData::SetTimeDelayLED(Float_t* TimeDelay)
 {
-  if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayDA[t] = TimeDelay[t];
+  if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayLED[t] = TimeDelay[t];
 }
 
 
@@ -190,6 +175,7 @@ void AliT0CalibData::SetWalk(Int_t ipmt)
 	{
 	  sum +=x[ind];
 	  iin++;
+	  //	  cout<GetTimeDelayTVD();
   for (Int_t i=0; i<24; i++){
     timeDelayCFD[i] = param->GetTimeDelayCFD(i);
+    timeDelayLED[i] = param->GetTimeDelayLED(i);
     TGraph* gr = param ->GetSlew(i);
     slewingLED.AddAtAndExpand(gr,i);
 
@@ -294,9 +295,9 @@ void AliT0Digitizer::Exec(Option_t* /*option*/)
 	  qt= 50.*al/ph2Mip;  // 50mv/Mip amp in mV 
 	  //  fill TDC
 	  trCFD = Int_t (timeGaus[i]/channelWidth + (timeDelayCFD[i]-timeDelayCFD[0])); 
-	  //	  trLED= Int_t (timeGaus[i] + timeDelayLED[i]); 
+	  trLED= Int_t (timeGaus[i] + timeDelayLED[i]); 
 	  sl = ((TGraph*)slewingLED.At(i))->Eval(qt);
-	  trLED = Int_t(( timeGaus[i] + 1000*sl )/channelWidth);
+	  trLED = Int_t(( trLED + 1000*sl )/channelWidth);
 	  qtCh=Int_t (1000.*TMath::Log(qt)) / channelWidth;
 	  fADC0->AddAt(0,i);
 	  fADC->AddAt(qtCh,i);
diff --git a/T0/AliT0Parameters.cxx b/T0/AliT0Parameters.cxx
index 519022f74a2..78353dd58e4 100644
--- a/T0/AliT0Parameters.cxx
+++ b/T0/AliT0Parameters.cxx
@@ -68,10 +68,8 @@ AliT0Parameters::AliT0Parameters()
    fQTmin(0),fQTmax(0),
    fSlewingLED(),fSlewingRec(),
    fPMTeff(),
-   fTimeDelayDA(0),fTimeDelayCFD(0),fTimeDelayTVD(0),fMeanT0(499),
-   fCalibentry(), fLookUpentry(),fSlewCorr(),
-   fLookUp(0), fNumberOfTRMs(0)
-
+   fTimeDelayLED(0),fTimeDelayCFD(0),fTimeDelayTVD(0),
+   fCalibentry(), fLookUpentry(),fSlewCorr()
 {
   // Default constructor 
 
@@ -101,8 +99,8 @@ AliT0Parameters::Init()
 {
   // Initialize the parameters manager.  We need to get stuff from the
   // CDB here. 
- 
-   if (fIsInit) return;
+  //   if (fIsInit) return;
+  
 
   AliCDBStorage *stor =AliCDBManager::Instance()->GetStorage("local://$ALICE_ROOT");
   //time equalizing
@@ -132,15 +130,15 @@ AliT0Parameters::Init()
 
 //__________________________________________________________________
 Float_t
-AliT0Parameters::GetTimeDelayDA(Int_t ipmt) 
+AliT0Parameters::GetTimeDelayLED(Int_t ipmt) 
 {
   // return time delay for LED channel
   // 
   if (!fCalibentry) {
-    fTimeDelayDA = 500;
-    return  fTimeDelayDA;
+    fTimeDelayLED = 0;
+    return  fTimeDelayLED;
   } 
-  return fgCalibData ->GetTimeDelayDA(ipmt);
+  return fgCalibData ->GetTimeDelayLED(ipmt);
 }
 //__________________________________________________________________
 Float_t
@@ -157,19 +155,6 @@ AliT0Parameters::GetTimeDelayCFD(Int_t ipmt)
   return fgCalibData->GetTimeDelayCFD(ipmt);
 }
 
-//__________________________________________________________________
-Int_t
-AliT0Parameters::GetMeanT0() 
-{
-  // return mean of T0 distrubution with vertex=0
-   // 
-  if (!fCalibentry) 
-    {
-      return fMeanT0;
-    }
-   
-  return fgCalibData->GetMeanT0();
-}
 //__________________________________________________________________
 
 void 
diff --git a/T0/AliT0Parameters.h b/T0/AliT0Parameters.h
index 2d5bba775f9..6c94bc8dc21 100644
--- a/T0/AliT0Parameters.h
+++ b/T0/AliT0Parameters.h
@@ -76,10 +76,7 @@ class AliT0Parameters : public TNamed
    void SetWalk(Int_t ipmt) ;
    
   Float_t GetTimeDelayCFD(Int_t ipmt);
-  Float_t GetTimeDelayDA(Int_t ipmt);
-
-  void SetMeanT0(Int_t mean=500) { fMeanT0 = mean; };
-  Int_t GetMeanT0 (); //{return fMeanT0;};
+  Float_t GetTimeDelayLED(Int_t ipmt);
 
   //  TMap *LookupTable;
 
@@ -106,11 +103,10 @@ class AliT0Parameters : public TNamed
   TObjArray fPMTeff; //array PMT registration efficiency
   TObjArray fWalk; //array time-amplitude walk
   
-  Float_t fTimeDelayDA;  //  sum time delay for LED channel
+  Float_t fTimeDelayLED;  //  sum time delay for LED channel
   Float_t fTimeDelayCFD;  // sum time delay for CFD channel
   Float_t  fTimeDelayTVD;  //time delay for TVD (vertex trigger channel)
- Int_t fMeanT0; //mean of T0distribution with vertex=0;
-   
+  
   TMap fLookUp;           //lookup table
   Int_t fNumberOfTRMs;    // number of TRMs in setup
 
diff --git a/T0/AliT0RawData.cxx b/T0/AliT0RawData.cxx
index b33021d9c9e..fb1604b0d7a 100644
--- a/T0/AliT0RawData.cxx
+++ b/T0/AliT0RawData.cxx
@@ -540,7 +540,7 @@ Int_t AliT0RawData::RawDataT0(AliT0digit *fDigits)
 
   fIndex=-1;
  
-
+  AliRawDataHeaderSim header;
    WriteDataHeader(kTRUE, kFALSE);
   GetDigits(fDigits);
   //write packing digits
diff --git a/T0/AliT0RawReader.cxx b/T0/AliT0RawReader.cxx
index 266018b8ab0..98c80505847 100644
--- a/T0/AliT0RawReader.cxx
+++ b/T0/AliT0RawReader.cxx
@@ -84,8 +84,6 @@ Bool_t  AliT0RawReader::Next()
   Int_t  TRM_CHAIN_0_TRAILER =  0x10000000;
   Int_t  TRM_CHAIN_1_TRAILER =  0x30000000;
   Int_t  TRM_GLOBAL_TRAILER =  0x5000000f;
- 
- Int_t  FILLER =  0x70000000;
 
   AliT0Parameters* param = AliT0Parameters::Instance();   
 
@@ -191,10 +189,8 @@ Bool_t  AliT0RawReader::Next()
 	  AliError(Form(" !!!! wrong TRM GLOBAL trailer  %x!!!!", word));
 	  break;
 	}
-     } //TRM loop end
-
+     } //TRM loop
       word = GetNextWord(); //
-      if (word == FILLER )  {cout<< "FIILER "<Init();
   AliT0Calibrator *calib=new AliT0Calibrator(); 
 
-  //  Int_t mV2Mip = param->GetmV2Mip();     
+  Int_t mV2Mip = param->GetmV2Mip();     
   //mV2Mip = param->GetmV2Mip();     
   Int_t channelWidth = param->GetChannelWidth() ;  
-  Int_t meanT0 = param->GetMeanT0();
   
   for (Int_t i=0; i<24; i++){
     TGraph* gr = param ->GetSlewRec(i);
     slewingLEDrec.AddAtAndExpand(gr,i) ;  
-    time0vertex[i]= param->GetTimeDelayDA(i);
   }
+  zdetC = param->GetZPosition("C");
+  zdetA  = param->GetZPosition("A");
 
-  
+    
   AliDebug(1,Form("Start DIGITS reconstruction "));
-  
+
   TBranch *brDigits=digitsTree->GetBranch("T0");
   AliT0digit *fDigits = new AliT0digit() ;
   if (brDigits) {
@@ -139,22 +140,21 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   
 
 
-  AliT0RecPoint* frecpoints= new AliT0RecPoint ();
-  clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
-  
+   AliT0RecPoint* frecpoints= new AliT0RecPoint ();
+   clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
+
   Float_t time[24], adc[24];
   for (Int_t ipmt=0; ipmt<24; ipmt++) {
     if(timeCFD->At(ipmt)>0 ){
       Int_t qt0= chargeQT0->At(ipmt);
       Int_t qt1= chargeQT1->At(ipmt);
       if((qt1-qt0)>0)  adc[ipmt] = TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000));
-      //     time[ipmt] = channelWidth * (calib-> WalkCorrection( ipmt,qt1 , timeCFD->At(ipmt) ) ) ;
-      time[ipmt] = calib-> WalkCorrection( ipmt,qt1 , timeCFD->At(ipmt) ) ;
+      time[ipmt] = channelWidth * (calib-> WalkCorrection( ipmt,qt1 , timeCFD->At(ipmt) ) ) ;
       
       //LED
-      Double_t sl = (timeLED->At(ipmt) - timeCFD->At(ipmt))*channelWidth;
+      Double_t sl = (timeLED->At(ipmt) - timeCFD->At(ipmt)- (1000.*timeDelayLED[ipmt]/channelWidth))*channelWidth;
       Double_t qt=((TGraph*)slewingLEDrec.At(ipmt))->Eval(sl/1000.);
-      //      frecpoints->SetTime(ipmt,time[ipmt]);
+      frecpoints->SetTime(ipmt,time[ipmt]);
       frecpoints->SetAmp(ipmt,adc[ipmt]);
       frecpoints->SetAmpLED(ipmt,qt);
     }
@@ -163,7 +163,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
       adc[ipmt] = 0;
     }
   }
-  
+
   for (Int_t ipmt=0; ipmt<12; ipmt++){
     if(time[ipmt] > 1 ) {
       if(time[ipmt]SetVertex(vertex);
     frecpoints->SetMeanTime(Int_t(meanTime));
     
   }
-  //time in each channel as time[ipmt]-MeanTimeinThisChannel(with vertex=0)
-  for (Int_t ipmt=0; ipmt<24; ipmt++) {
-    if(time[ipmt]>1) {
-      time[ipmt] = (time[ipmt] - time0vertex[ipmt])*channelWidth;
-      frecpoints->SetTime(ipmt,time[ipmt]);
-    }
-  }
   clustersTree->Fill();
 
   delete timeCFD;
@@ -213,15 +206,16 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
 
 void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) const
 {
-  // T0 raw ->
-  // T0RecPoint writing 
-  
-  //Q->T-> coefficients !!!! should be measured!!!
-  Float_t time0vertex[24];
+// T0 raw ->
+// T0RecPoint writing 
+
+    //Q->T-> coefficients !!!! should be asked!!!
+  Float_t  timeDelayLED[24];
+  Float_t zdetA,zdetC;
   Int_t allData[110][5];
-  TObjArray slewingLEDrec;
+   TObjArray slewingLEDrec;
   TObjArray walk;
-  
+    
   TArrayI * timeCFD = new TArrayI(24); 
   TArrayI * timeLED = new TArrayI(24); 
   TArrayI * chargeQT0 = new TArrayI(24); 
@@ -245,14 +239,14 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   Int_t mV2Mip = param->GetmV2Mip();     
   //mV2Mip = param->GetmV2Mip();     
   Int_t channelWidth = param->GetChannelWidth() ;  
-  Int_t meanT0 = param->GetMeanT0();
     
   for (Int_t i=0; i<24; i++){
     TGraph* gr = param ->GetSlewRec(i);
     slewingLEDrec.AddAtAndExpand(gr,i) ;  
-    time0vertex[i]= param->GetTimeDelayDA(i);
   }
   
+  zdetC = param->GetZPosition("T0/C/PMT1");
+  zdetA  = param->GetZPosition("T0/A/PMT15");
 
   for (Int_t in=0; in<24; in++)
      {
@@ -281,9 +275,8 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
       Int_t qt0= chargeQT0->At(ipmt);
       Int_t qt1= chargeQT1->At(ipmt);
       if((qt1-qt0)>0)  adc[ipmt] = TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000));
-      //      time[ipmt] = channelWidth * (calib-> WalkCorrection( ipmt,qt1 , timeCFD->At(ipmt) ) ) ;
-      time[ipmt] = calib-> WalkCorrection( ipmt,qt1 , timeCFD->At(ipmt) ) ;
-      Double_t sl = (timeLED->At(ipmt) - timeCFD->At(ipmt))*channelWidth;
+       time[ipmt] = channelWidth * (calib-> WalkCorrection( ipmt,qt1 , timeCFD->At(ipmt) ) ) ;
+      Double_t sl = (timeLED->At(ipmt) - timeCFD->At(ipmt)- (1000.*timeDelayLED[ipmt]/channelWidth))*channelWidth;
       Double_t qt=((TGraph*)slewingLEDrec.At(ipmt))->Eval(sl/1000.);
       frecpoints->SetTime(ipmt,time[ipmt]);
       frecpoints->SetAmp(ipmt,adc[ipmt]);
@@ -316,24 +309,16 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   Float_t c = 0.0299792; // cm/ps
   Float_t vertex = 0;
   if(besttimeA !=999999 && besttimeC != 999999 ){
-    timeDiff = (besttimeC - besttimeA)*channelWidth;
-    //    meanTime = (besttimeA + besttimeC)/2.;
-    meanTime = (meanT0 - (besttimeA + besttimeC)/2) * channelWidth;
+    timeDiff = besttimeC - besttimeA;
+    meanTime = (besttimeA + besttimeC)/2.;
     vertex = c*(timeDiff)/2.; //-(lenr-lenl))/2;
     AliDebug(1,Form("  timeDiff %f ps,  meanTime %f ps, vertex %f cm",timeDiff, meanTime,vertex ));
     frecpoints->SetVertex(vertex);
     frecpoints->SetMeanTime(Int_t(meanTime));
     
   }
-  //time in each channel as time[ipmt]-MeanTimeinThisChannel(with vertex=0)
-  for (Int_t ipmt=0; ipmt<24; ipmt++) {
-    if(time[ipmt]>1) {
-      time[ipmt] = (time[ipmt] - time0vertex[ipmt])*channelWidth;
-      frecpoints->SetTime(ipmt,time[ipmt]);
-    }
-  }
   recTree->Fill();
- 
+
 
   delete timeCFD;
   delete timeLED;
@@ -382,11 +367,12 @@ void AliT0Reconstructor::FillESD(AliRunLoader* runLoader, AliESD *pESD) const
     
     brRec->GetEntry(0);
     Float_t timeStart, Zposition, amp[24], time[24];
+    Int_t mean0 = 12450;
     Int_t i;
     Zposition = frecpoints -> GetVertex();
-    timeStart = frecpoints -> GetMeanTime() ;
+    timeStart = frecpoints -> GetMeanTime() - mean0;
     for ( i=0; i<24; i++) {
-      time[i] = Float_t (frecpoints -> GetTime(i)); // ps to ns
+       time[i] = Float_t (frecpoints -> GetTime(i)) / 1000.; // ps to ns
       amp[i] = frecpoints -> GetAmp(i);
     }
     pESD->SetT0zVertex(Zposition); //vertex Z position 
diff --git a/T0/AliT0Reconstructor.h b/T0/AliT0Reconstructor.h
index c8d65760f68..be347cc94fc 100644
--- a/T0/AliT0Reconstructor.h
+++ b/T0/AliT0Reconstructor.h
@@ -35,6 +35,8 @@ class AliT0Reconstructor: public AliReconstructor {
   virtual Bool_t       HasDigitConversion() const {return kFALSE;}
  public:
  
+ AliT0digit *fDigits   ; // digits
+ TTree*        fTree;
   Float_t fZposition; // vertex position
 
  protected:
diff --git a/T0/AliT0SetCDB.C b/T0/AliT0SetCDB.C
index 2f9b45fd036..adc4bb81e6e 100644
--- a/T0/AliT0SetCDB.C
+++ b/T0/AliT0SetCDB.C
@@ -108,25 +108,13 @@ void SetTimeDelay()
   AliT0CalibData *calibda=new AliT0CalibData("T0");
   
    Float_t fTimeDelay  = 1000;
-
-   //for timeDelayDA now we are using Int mean time (+-3RMS fit) 
-   //in number of channel for time in each chanel for 
-   //1000 Hijingpara nparticles=500 & zvertex=0 produced by readDigits.C
-   // this is way to simulate time positon for vertex=0 
-   //with unknown time delay in channel
-   /*
-   Int_t timedelayDA[24] = {501, 509, 511,510 ,510, 510, 509, 509, 510,
-			    510, 509, 508, 511, 510, 509, 508,510,
-			    510, 511, 510, 510, 510, 509, 510};
- 
-   */
+  
+  
   for(Int_t ipmt=0; ipmt<24; ipmt++) {
     calibda->SetTimeDelayCFD(fTimeDelay+ipmt*100,ipmt);
-       //   calibda->SetTimeDelayLED(fTimeDelay,ipmt);
-//    calibda->SetTimeDelayDA(timedelayDA[ipmt],ipmt);
-    calibda->SetTimeDelayDA(500,ipmt);
+    //   calibda->SetTimeDelayLED(fTimeDelay,ipmt);
+    calibda->SetTimeDelayLED(0,ipmt);
   }
-  calibda->SetMeanT0(499);
   calibda->Print();
   //Store calibration data into database
   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
@@ -214,12 +202,6 @@ void GetTimeDelay()
   
   AliT0CalibData *clb = (AliT0CalibData*)entry->GetObject();
   clb->Print();
-  for (Int_t i=0; i<24; i++) {
-   cout<GetTimeDelayCFD(i)<<" "<GetTimeDelayDA(i)<GetTimeDelayCFD(i)-clb->GetTimeDelayCFD(0))<GetTimeDelayDA(i)-clb->GetTimeDelayDA(0))<a="<GetA()<Dump();
-  for (Int_t i=0; i<20; i++) 
-    clb->PrintLookupNames("all",i);
+  for (Int_t i=0; i<6; i++) 
+    clb->PrintLookup("all",0,i,4);
 
 }
diff --git a/TOF/AliTOF.cxx b/TOF/AliTOF.cxx
index c87e976c992..4a62eb26993 100644
--- a/TOF/AliTOF.cxx
+++ b/TOF/AliTOF.cxx
@@ -404,16 +404,7 @@ void AliTOF::CreateGeometry()
 
   Float_t xTof, yTof;
 
-  if (IsVersion()==8) {
-
-    xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm,  x-dimension of FTOA volume
-    yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm,  y-dimension of FTOA volume
-    Float_t zTof = fTOFGeometry->ZlenA();             // cm,  z-dimension of FTOA volume
-    
-    //  TOF module internal definitions
-    TOFpc(xTof, yTof, zTof);
-
-  } else if (IsVersion()==7) {
+  if (IsVersion()==7) {
 
     xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm,  x-dimension of FTOA volume
     yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm,  y-dimension of FTOA volume
@@ -722,7 +713,7 @@ void AliTOF::Digits2Raw()
   //rawWriter.SetPackedAcquisitionMode(kFALSE);
   if (rawWriter.GetPackedAcquisitionMode()) {
     if(rawWriter.GetMatchingWindow()>8192)
-      AliWarning(Form("You are running in packing mode and the matching window is %.2f ns, i.e. greater than 199.8848 ns",
+      AliWarning(Form("You are running in packing mode and the matching window is %.2f ns, i.e. greater than 200. ns",
 		      rawWriter.GetMatchingWindow()*AliTOFGeometry::TdcBinWidth()*1.e-03));
   }
   
diff --git a/TOF/AliTOF.h b/TOF/AliTOF.h
index 178a431350d..ce331180653 100644
--- a/TOF/AliTOF.h
+++ b/TOF/AliTOF.h
@@ -61,7 +61,6 @@ class AliTOF : public AliDetector {
                         Float_t /*zlenB*/, Float_t /*zlenA*/, Float_t /*ztof0*/){};
   virtual void    TOFpc(Float_t /*xtof*/,  Float_t /*ytof*/, Float_t /*zlenA*/,
 			Float_t /*zlenB*/){};
-  virtual void    TOFpc(Float_t /*xtof*/,  Float_t /*ytof*/, Float_t /*zlenA*/){};
   virtual void    DrawModule() const;
   virtual void    DrawDetectorModules() const {};
   virtual void    DrawDetectorStrips() const {};
diff --git a/TOF/AliTOFAlignment.cxx b/TOF/AliTOFAlignment.cxx
index f5b9be31549..34d8828751b 100644
--- a/TOF/AliTOFAlignment.cxx
+++ b/TOF/AliTOFAlignment.cxx
@@ -15,9 +15,6 @@
 
 /*
 $Log$
-Revision 1.14  2007/04/18 14:49:54  arcelli
-Some code cleanup, added more debug info
-
 Revision 1.13  2007/04/17 16:38:36  arcelli
 Include Methods to derive TOF AlignObjs from Survey Data
 
@@ -330,10 +327,10 @@ void AliTOFAlignment::BuildGeomForSurvey()
   TGeoVolume* fm = new TGeoVolume("FM",fmbox);
   fm->SetLineColor(2);//color
 
-  TGeoTranslation* mAtr = new TGeoTranslation("mAtr",-fgkXFM, fgkYFM ,fgkZFM);
-  TGeoTranslation* mBtr = new TGeoTranslation("mBtr", fgkXFM, fgkYFM, fgkZFM);
-  TGeoTranslation* mCtr = new TGeoTranslation("mCtr", fgkXFM, fgkYFM,-fgkZFM);
-  TGeoTranslation* mDtr = new TGeoTranslation("mDtr",-fgkXFM, fgkYFM,-fgkZFM);
+  TGeoTranslation* Atr = new TGeoTranslation("Atr",-fgkXFM, fgkYFM ,fgkZFM);
+  TGeoTranslation* Btr = new TGeoTranslation("Btr", fgkXFM, fgkYFM, fgkZFM);
+  TGeoTranslation* Ctr = new TGeoTranslation("Ctr", fgkXFM, fgkYFM,-fgkZFM);
+  TGeoTranslation* Dtr = new TGeoTranslation("Dtr",-fgkXFM, fgkYFM,-fgkZFM);
 
   // position all this stuff in the global ALICE frame
 
@@ -362,10 +359,10 @@ void AliTOFAlignment::BuildGeomForSurvey()
     box0[iSM]->SetLineColor(1); //black
     top->AddNode(box0[iSM],1,smTrans); //place the extended SM volume
     box0[iSM]->AddNode(box1,1); //place the inner SM volume
-    box0[iSM]->AddNode(fm,1,mAtr);
-    box0[iSM]->AddNode(fm,2,mBtr);
-    box0[iSM]->AddNode(fm,3,mCtr);
-    box0[iSM]->AddNode(fm,4,mDtr);
+    box0[iSM]->AddNode(fm,1,Atr);
+    box0[iSM]->AddNode(fm,2,Btr);
+    box0[iSM]->AddNode(fm,3,Ctr);
+    box0[iSM]->AddNode(fm,4,Dtr);
   }  
 
   fTOFmgr->CloseGeometry();
@@ -391,10 +388,10 @@ void AliTOFAlignment::InsertMisAlignment( Float_t *mis)
 {
   // Now Apply the Displacements and store the misaligned FM positions...
 
-  Double_t lA[3]={-fgkXFM,fgkYFM, fgkZFM};
-  Double_t lB[3]={ fgkXFM,fgkYFM, fgkZFM};
-  Double_t lC[3]={ fgkXFM,fgkYFM,-fgkZFM};
-  Double_t lD[3]={-fgkXFM,fgkYFM,-fgkZFM};
+  Double_t A[3]={-fgkXFM,fgkYFM, fgkZFM};
+  Double_t B[3]={ fgkXFM,fgkYFM, fgkZFM};
+  Double_t C[3]={ fgkXFM,fgkYFM,-fgkZFM};
+  Double_t D[3]={-fgkXFM,fgkYFM,-fgkZFM};
 
   for(Int_t iSM=0;iSM<18;iSM++){
   // ************* get ideal global matrix *******************
@@ -409,10 +406,10 @@ void AliTOFAlignment::InsertMisAlignment( Float_t *mis)
     TGeoMatrix* l3 = n3->GetMatrix(); 
 
     Double_t gA[3], gB[3], gC[3], gD[3]; // ideal FM point coord., global RS
-    g3.LocalToMaster(lA,gA);
-    g3.LocalToMaster(lB,gB);
-    g3.LocalToMaster(lC,gC);
-    g3.LocalToMaster(lD,gD);
+    g3.LocalToMaster(A,gA);
+    g3.LocalToMaster(B,gB);
+    g3.LocalToMaster(C,gC);
+    g3.LocalToMaster(D,gD);
 
 
     // We apply a delta transformation to the surveyed vol to represent
@@ -440,10 +437,10 @@ void AliTOFAlignment::InsertMisAlignment( Float_t *mis)
     printf("\n\n*************  The Misaligned Matrix in GRS **************\n");
     ng3->Print();
     Double_t ngA[3], ngB[3], ngC[3], ngD[3];// real FM point coord., global RS
-    ng3->LocalToMaster(lA,ngA);
-    ng3->LocalToMaster(lB,ngB);
-    ng3->LocalToMaster(lC,ngC);
-    ng3->LocalToMaster(lD,ngD);    
+    ng3->LocalToMaster(A,ngA);
+    ng3->LocalToMaster(B,ngB);
+    ng3->LocalToMaster(C,ngC);
+    ng3->LocalToMaster(D,ngD);    
 
     for(Int_t iFM=0;iFM<3;iFM++){
       fTOFSurveyFM[iSM][0][iFM]=ngA[iFM];
diff --git a/TOF/AliTOFClusterFinder.cxx b/TOF/AliTOFClusterFinder.cxx
index a9657031885..556416b60f2 100644
--- a/TOF/AliTOFClusterFinder.cxx
+++ b/TOF/AliTOFClusterFinder.cxx
@@ -15,9 +15,6 @@
 
 /* 
 $Log$
-Revision 1.26  2007/04/30 19:02:24  arcelli
-hopefully the last refinements for correct type conversion in calibration
-
 Revision 1.25  2007/04/30 15:22:17  arcelli
 Change TOF digit Time, Tot etc to int type
 
@@ -112,7 +109,7 @@ Revision 0.01  2005/07/25 A. De Caro
 
 ClassImp(AliTOFClusterFinder)
 
-AliTOFClusterFinder::AliTOFClusterFinder(AliTOFcalib *calib):
+AliTOFClusterFinder::AliTOFClusterFinder():
   fRunLoader(0),
   fTOFLoader(0),
   fTreeD(0),
@@ -122,8 +119,7 @@ AliTOFClusterFinder::AliTOFClusterFinder(AliTOFcalib *calib):
   fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
   fNumberOfTofClusters(0),
   fVerbose(0),
-  fDecoderVersion(0),
-  fTOFcalib(calib)
+  fDecoderVersion(0)
 {
 //
 // Constructor
@@ -134,7 +130,7 @@ AliTOFClusterFinder::AliTOFClusterFinder(AliTOFcalib *calib):
 }
 //______________________________________________________________________________
 
-AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader, AliTOFcalib *calib):
+AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader):
   fRunLoader(runLoader),
   fTOFLoader(runLoader->GetLoader("TOFLoader")),
   fTreeD(0),
@@ -144,13 +140,17 @@ AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader, AliTOFcalib *c
   fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
   fNumberOfTofClusters(0),
   fVerbose(0),
-  fDecoderVersion(0),
-  fTOFcalib(calib)
+  fDecoderVersion(0)
 {
 //
 // Constructor
 //
 
+//  runLoader->CdGAFile();
+//  TFile *in=(TFile*)gFile;
+//  in->cd();
+//  fTOFGeometry = (AliTOFGeometry*)in->Get("TOFgeometry");
+
 }
 
 //------------------------------------------------------------------------
@@ -164,16 +164,14 @@ AliTOFClusterFinder::AliTOFClusterFinder(const AliTOFClusterFinder &source)
   fDigits(new TClonesArray("AliTOFdigit", 4000)),
   fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
   fNumberOfTofClusters(0),
-  fVerbose(0),
-  fDecoderVersion(0),
-  fTOFcalib(0)
+   fVerbose(0),
+  fDecoderVersion(0)
 {
   // copy constructor
   this->fDigits=source.fDigits;
   this->fRecPoints=source.fRecPoints;
   this->fTOFGeometry=source.fTOFGeometry;
   this->fDecoderVersion=source.fDecoderVersion;
-  this->fTOFcalib=source.fTOFcalib;
 
 }
 
@@ -186,7 +184,6 @@ AliTOFClusterFinder& AliTOFClusterFinder::operator=(const AliTOFClusterFinder &s
   this->fTOFGeometry=source.fTOFGeometry;
   this->fVerbose=source.fVerbose;
   this->fDecoderVersion=source.fDecoderVersion;
-  this->fTOFcalib=source.fTOFcalib;
   return *this;
 
 }
@@ -292,7 +289,7 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
 
   }
 
-  AliInfo(Form("Number of found clusters: %i for event: %i", fNumberOfTofClusters, iEvent));
+  AliInfo(Form("Number of found clusters: %i", fNumberOfTofClusters));
 
   CalibrateRecPoint();
   FillRecPoint();
@@ -306,93 +303,6 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
   AliInfo(Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
 	       stopwatch.RealTime(),stopwatch.CpuTime()));
 
-  digits->Delete();
-  delete digits;
-}
-
-//______________________________________________________________________________
-
-void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree)
-{
-  //
-  // Converts digits to recpoints for TOF
-  //
-
-  TStopwatch stopwatch;
-  stopwatch.Start();
-
-  ///  fRunLoader->GetEvent(iEvent);
-
-  if (digitsTree == 0x0)
-    {
-      AliFatal("AliTOFClusterFinder: Can not get TreeD");
-    }
-
-  TBranch *branch = digitsTree->GetBranch("TOF");
-  if (!branch) { 
-    AliError("can't get the branch with the TOF digits !");
-    return;
-  }
-
-  TClonesArray *digits = new TClonesArray("AliTOFdigit",10000);
-  branch->SetAddress(&digits);
-
-  ResetRecpoint();
-
-  fTreeR=clusterTree;
-  Int_t bufsize = 32000;
-  fTreeR->Branch("TOF", &fRecPoints, bufsize);
-
-  digitsTree->GetEvent(0);
-  Int_t nDigits = digits->GetEntriesFast();
-  AliDebug(2,Form("Number of TOF digits: %d",nDigits));
-
-  Int_t ii, jj;
-  Int_t dig[5]; //cluster detector indeces
-  Float_t g[3]; //cluster cartesian coord
-  Double_t h[3]; // the cluster spatial cyl. coordinates
-  Int_t  parTOF[5]; //The TOF signal parameters
-  Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
-  for (ii=0; iiUncheckedAt(ii);
-    dig[0]=d->GetSector();
-    dig[1]=d->GetPlate();
-    dig[2]=d->GetStrip();
-    dig[3]=d->GetPadz();
-    dig[4]=d->GetPadx();
-
-    //    AliDebug(2,Form(" %2i  %1i  %2i  %1i  %2i ",dig[0],dig[1],dig[2],dig[3],dig[4]));
-
-    for (jj=0; jj<3; jj++) g[jj] = 0.;
-    fTOFGeometry->GetPos(dig,g);
-
-    h[0] = TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
-    h[1] = TMath::ATan2(g[1],g[0]);
-    h[2] = g[2];
-
-    parTOF[0] = d->GetTdc(); //the TDC signal
-    parTOF[1] = d->GetToT(); //the ToT signal
-    parTOF[2] = d->GetAdc(); // the adc charge
-    parTOF[3] = d->GetTdcND(); // non decalibrated sim time
-    parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
-    AliTOFcluster *tofCluster = new AliTOFcluster(h,dig,parTOF,status,d->GetTracks(),ii);
-    InsertCluster(tofCluster);
-
-  }
-
-  AliInfo(Form("Number of found clusters: %i", fNumberOfTofClusters));
-
-  CalibrateRecPoint();
-  FillRecPoint();
-
-  clusterTree->Fill();
-  ResetRecpoint();
-
-  AliInfo(Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
-	       stopwatch.RealTime(),stopwatch.CpuTime()));
-
-  digits->Delete();
-  delete digits;
 }
 //______________________________________________________________________________
 
@@ -639,7 +549,7 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader
 
   if (fVerbose==2) ftxt.close();
 
-  AliInfo(Form("Number of found clusters: %i for event: %i", fNumberOfTofClusters, iEvent));
+  AliInfo(Form("Number of found clusters: %i", fNumberOfTofClusters));
 
   CalibrateRecPoint();
   FillRecPoint();
@@ -746,91 +656,6 @@ void AliTOFClusterFinder::Raw2Digits(Int_t iEvent, AliRawReader *rawReader)
   AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.2fs C:%.2fs",
 		   stopwatch.RealTime(),stopwatch.CpuTime()));
 
-}
-
-//______________________________________________________________________________
-
-void AliTOFClusterFinder::Raw2Digits(AliRawReader *rawReader, TTree* digitsTree)
-{
-  //
-  // Converts RAW data to MC digits for TOF for the current event
-  //
-  //
-
-  TStopwatch stopwatch;
-  stopwatch.Start();
-
-  const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
-
-  if (!digitsTree)
-    {
-    AliError("No input digits Tree");
-    return;
-    }
-
-  TClonesArray *tofDigits = new TClonesArray("AliTOFdigit",10000);
-  Int_t bufsize = 32000;
-  digitsTree->Branch("TOF", &tofDigits, bufsize);
-
-  ///  fRunLoader->GetEvent(iEvent);
-
-  ///  AliDebug(2,Form(" Event number %2i ", iEvent));
-
-  TClonesArray * clonesRawData;
-
-  Int_t dummy = -1;
-
-  Int_t detectorIndex[5];
-  Int_t digit[4];
-
-  Int_t indexDDL = 0;
-  for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
-
-    rawReader->Reset();
-    AliTOFRawStream tofInput(rawReader);
-    if (fDecoderVersion) {
-      AliInfo("Using New Decoder \n"); 
-      tofInput.LoadRawDataBuffers(indexDDL,fVerbose);
-    }
-    else tofInput.LoadRawData(indexDDL);
-
-    clonesRawData = (TClonesArray*)tofInput.GetRawData();
-
-    for (Int_t iRawData = 0; iRawDataGetEntriesFast(); iRawData++) {
-
-      AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
-
-      if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
-
-      tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
-				    tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
-      dummy = detectorIndex[3];
-      detectorIndex[3] = detectorIndex[4];
-      detectorIndex[4] = dummy;
-
-      digit[0] = tofInput.GetTofBin();
-      digit[1] = tofInput.GetToTbin();
-      digit[2] = tofInput.GetToTbin();
-      digit[3] = -1;
-
-      Int_t tracknum[3]={-1,-1,-1};
-
-      TClonesArray &aDigits = *tofDigits;
-      Int_t last=tofDigits->GetEntriesFast();
-      new (aDigits[last]) AliTOFdigit(tracknum, detectorIndex, digit);
-
-    } // while loop
-
-    clonesRawData->Clear();
-
-  } // DDL Loop
-
-  digitsTree->Fill();
-
-  AliDebug(1, Form("Got %d digits: ", tofDigits->GetEntries()));
-  AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
-		   stopwatch.RealTime(),stopwatch.CpuTime()));
-
 }
 //______________________________________________________________________________
 
@@ -932,14 +757,16 @@ void AliTOFClusterFinder::CalibrateRecPoint()
   Double_t timeCorr;
   Int_t   tdcCorr;
   AliInfo(" Calibrating TOF Clusters: ")
+  AliTOFcalib *calib = new AliTOFcalib(fTOFGeometry);
+  if(!calib->ReadParFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
   
-  AliTOFCal *calTOFArray = fTOFcalib->GetTOFCalArray();  
+  AliTOFCal *calTOFArray = calib->GetTOFCalArray();  
 
   for (ii=0; iiGetIndex();
     for(jj=0; jj<5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
 
-    Int_t index = fTOFcalib->GetIndex(detectorIndex);
+    Int_t index = calib->GetIndex(detectorIndex);
      
     AliTOFChannel * calChannel = calTOFArray->GetChannel(index);
 
@@ -969,6 +796,7 @@ void AliTOFClusterFinder::CalibrateRecPoint()
 
   } // loop on clusters
 
+  delete calib;
 }
 //______________________________________________________________________________
 
diff --git a/TOF/AliTOFClusterFinder.h b/TOF/AliTOFClusterFinder.h
index 9089182db06..166bc7024ce 100644
--- a/TOF/AliTOFClusterFinder.h
+++ b/TOF/AliTOFClusterFinder.h
@@ -18,7 +18,6 @@ class AliRawReader;
 
 class AliTOFGeometry;
 class AliTOFcluster;
-class AliTOFcalib;
 
 class AliTOFClusterFinder : public TObject
 {
@@ -27,18 +26,16 @@ class AliTOFClusterFinder : public TObject
 
  public:
 
-  AliTOFClusterFinder(AliTOFcalib *calib);
-  AliTOFClusterFinder(AliRunLoader* runLoader, AliTOFcalib *calib);
+  AliTOFClusterFinder();
+  AliTOFClusterFinder(AliRunLoader* runLoader);
   AliTOFClusterFinder(const AliTOFClusterFinder &source); // copy constructor
   AliTOFClusterFinder& operator=(const AliTOFClusterFinder &source); // ass. op.
   virtual ~AliTOFClusterFinder();
 
-  void Digits2RecPoints(TTree* digitsTree, TTree* clusterTree);
   void Digits2RecPoints(Int_t ievt);
   void Digits2RecPoints(AliRawReader *rawReader, TTree *clustersTree);
   void Digits2RecPoints(Int_t ievt, AliRawReader *rawReader);
   void Raw2Digits(Int_t ievt, AliRawReader *rawReader); // temporary solution
-  void Raw2Digits(AliRawReader *rawReader, TTree* digitsTree); 
   void FillRecPoint();
   void ResetRecpoint();
   void Load();
@@ -76,9 +73,8 @@ class AliTOFClusterFinder : public TObject
   Bool_t fDecoderVersion;   //setting whether to use the new decoder version 
                             // -true -> new version
                             // -false ->old version  (default value!!)
-  AliTOFcalib *fTOFcalib;       // pointer to the TOF calibration info
 
-  ClassDef(AliTOFClusterFinder,3) // To run TOF clustering
+  ClassDef(AliTOFClusterFinder,2) // To run TOF clustering
 };
 #endif
 
diff --git a/TOF/AliTOFDDLRawData.cxx b/TOF/AliTOFDDLRawData.cxx
index a5dc3d6794d..34bcdc492a0 100644
--- a/TOF/AliTOFDDLRawData.cxx
+++ b/TOF/AliTOFDDLRawData.cxx
@@ -15,9 +15,6 @@
 
 /*
 $Log$
-Revision 1.15  2007/04/23 16:51:39  decaro
-Digits-to-raw_data conversion: correction for a more real description (A.De Caro, R.Preghenella)
-
 Revision 1.14  2007/03/28 10:50:33  decaro
 Rounding off problem in rawData coding/decoding: solved
 
@@ -908,8 +905,8 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
   Int_t nTDC = -1;
   Int_t iCH = -1;
 
-  //Int_t numberOfMeasuresPerChannel = 0;
-  //Int_t maxMeasuresPerChannelInTDC = 0;
+  Int_t numberOfMeasuresPerChannel = 0;
+  Int_t maxMeasuresPerChannelInTDC = 0;
 
   Bool_t outOut = HeadOrTail();
 
@@ -922,6 +919,8 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
   // loop on TDC number
   for (nTDC=AliTOFGeometry::NTdc()-1; nTDC>=0; nTDC--) {
 
+    maxMeasuresPerChannelInTDC = 0;
+
     // the DRM odd (i.e. left) slot number 3 doesn't contain TDC digit data
     // for TDC numbers 3-14
     if (iDDL%2==1 && nTRM==3 && (Int_t)(nTDC/3.)!=0) continue;
@@ -929,7 +928,10 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
     // loop on TDC channel number
     for (iCH=AliTOFGeometry::NCh()-1; iCH>=0; iCH--) {
 
-      //numberOfMeasuresPerChannel = 0;
+      if (numberOfMeasuresPerChannel) {
+	maxMeasuresPerChannelInTDC = numberOfMeasuresPerChannel;
+	numberOfMeasuresPerChannel = 0;
+      }
 
       fTOFrawStream->EquipmentId2VolumeId(nDDL, nTRM, iChain, nTDC, iCH, volume);
 	
@@ -1014,8 +1016,9 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
 
       for (jj=0; jj<3;jj++) {
 
-	if (indexDigit[jj]<0) continue;
+	numberOfMeasuresPerChannel++;
 
+	if (indexDigit[jj]<0) continue;
 	digs = (AliTOFdigit*)fTOFdigitArray->UncheckedAt(indexDigit[jj]);
 	  
 	if (digs->GetSector()!=volume[0] ||
@@ -1028,8 +1031,6 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
 
 	if (timeOfFlight>fMatchingWindow) continue;
 
-	//numberOfMeasuresPerChannel++;
-
 	// totCharge = (Int_t)digs->GetAdc(); //Use realistic ToT, for Standard production with no miscalibration/Slewing it == fAdC in digit (see AliTOFDigitizer)
 	totCharge = (Int_t)(digs->GetToT());
 	// temporary control
@@ -1382,13 +1383,8 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
 
       } //end loop on digits in the same volume
 
-      //if (numberOfMeasuresPerChannel>maxMeasuresPerChannelInTDC)
-      //maxMeasuresPerChannelInTDC = numberOfMeasuresPerChannel;
-
     } // end loop on TDC channel number
 
-    //AliInfo(Form(" TDC number %2i:  numberOfMeasuresPerChannel = %2i  ---  maxMeasuresPerChannelInTDC = %2i ", nTDC, numberOfMeasuresPerChannel, maxMeasuresPerChannelInTDC));
-
     if (localIndex==-1) continue;
 
     if (fPackedAcquisition) {
@@ -1402,7 +1398,7 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
 
     }
     else {
-      /*
+
       if (maxMeasuresPerChannelInTDC = 1) {
 
 	for (Int_t jj=0; jj<=localIndex; jj++) {
@@ -1425,9 +1421,9 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
       } // if (maxMeasuresPerChannelInTDC = 1)
       else if (maxMeasuresPerChannelInTDC>1) {
 
-	AliInfo(Form(" In the TOF DDL %2i, TRM %2i, TDC %2i, chain %1i, the maximum number of t.o.f. good measurements per channel is %2i",
+	AliInfo(Form(" In the TOF DDL %2i, TRM %2i, TDC %2i, chain %1i, there are %2i t.o.f. good measurements ",
 		     nDDL, nTRM, iChain, nTDC, iCH, maxMeasuresPerChannelInTDC));
-      */
+
 	for (Int_t jj=0; jj<=localIndex; jj++) {
 	    fIndex++;
 	    buf[fIndex] = localBuffer[jj];
@@ -1435,14 +1431,12 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
 	    psArray[jj] = -1;
 	}
 
-	//} // else if (maxMeasuresPerChannelInTDC>1)
+      } // else if (maxMeasuresPerChannelInTDC>1)
 
     } // else (!fPackedAcquisition)
 
     localIndex = -1;
 
-    //maxMeasuresPerChannelInTDC = 0;
-
   } // end loop on TDC number
 
 
diff --git a/TOF/AliTOFDataDCS.cxx b/TOF/AliTOFDataDCS.cxx
index 730c1df6d16..7d52d36efd3 100644
--- a/TOF/AliTOFDataDCS.cxx
+++ b/TOF/AliTOFDataDCS.cxx
@@ -15,15 +15,6 @@
 
 /*
 $Log$
-Revision 1.8  2007/05/03 09:45:09  decaro
-Coding convention: RN11 violation -> suppression
-
-Revision 1.7  2007/05/02 14:09:39  arcelli
-Retrieval of Env. Temperature removed (will get it from the GRP)
-
-Revision 1.6  2007/04/04 17:19:19  arcelli
-Moved some printout to debug level
-
 Revision 1.5  2007/02/20 15:57:00  decaro
 Raw data update: to read the TOF raw data defined in UNPACKED mode
 
@@ -116,6 +107,10 @@ AliTOFDataDCS::AliTOFDataDCS():
     fFEEttrm[i]=0x0;
   }
   
+  for(int i=0;i<3;i++) {
+    fT[i]=0;
+    fP[i]=0;
+  }
   
 }
 
@@ -198,7 +193,12 @@ AliTOFDataDCS::AliTOFDataDCS(const AliTOFDataDCS & data):
   for(int i=0;ifAliasNames[i]=data.GetAliasName(i);
   }
 
+  for(int i=0;i<3;i++) {
+    this->fT[i]=data.GetT(i);
+    this->fP[i]=data.GetP(i);
+  }
+
+
   for(int i=0;ifHVvp[i]=data.GetHVvp(i);
     this->fHVvn[i]=data.GetHVvn(i);
@@ -317,6 +323,29 @@ AliTOFDataDCS::~AliTOFDataDCS() {
   }
 }
 
+//-----------------------------------------------------------------------------
+Float_t* AliTOFDataDCS::GetT()const {
+
+  // method to retrieve environment temperature info
+
+  Float_t* t=0;
+  for (Int_t i=0;i<3;i++){
+    t[i]=this->fT[i];
+  }
+  return t;
+}
+//-----------------------------------------------------------------------------
+Float_t* AliTOFDataDCS::GetP() const{
+
+  // method to retrieve environment pressure info
+
+  Float_t* p=0;
+  for (Int_t i=0;i<3;i++){
+    p[i]=this->fP[i];
+  }
+  return p;
+}
+
 //---------------------------------------------------------------
 Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){
 
@@ -335,6 +364,8 @@ Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){
   TObjArray *aliasArr;
   AliDCSValue* aValue;
   AliDCSValue* aValue1;
+  TH1F * histoT=0x0;
+  TH1F * histoP=0x0;
 
   // starting loop on aliases
   for(int j=0; jGetEntries();
     Int_t deltaTimeStamp = (Int_t) nentries/3;
     Int_t deltaTimeStamp1 = (Int_t) nentries/2;
+    AliDCSValue *lastDCSvalue = (AliDCSValue*) aliasArr->At(nentries-1);
+    Float_t maxTimeStamp = (Float_t) (lastDCSvalue->GetTimeStamp());
+    Float_t minTimeStamp = 0;
 
     // filling aliases with 10 floats+1 Usign
-    Int_t index = 0;
-    for (Int_t k=0;k<3;k++){
-      index = deltaTimeStamp*k;
-      if (k==0) {
-	index=0;
-      }
-      else if (k==1) {
-	index=deltaTimeStamp1;
-      } 
-      else if (k==2) {
-	index=nentries-1; 
-      }
-      aValue = (AliDCSValue*) aliasArr->At(index);
-      val = aValue->GetFloat();
-      time = (Float_t) (aValue->GetTimeStamp());
-      if (jSetFloat(k,val);
-	fHVvp[j]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fHVvn[j-kNHV]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fHVip[j-2*kNHV]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fHVin[j-3*kNHV]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVv[j-4*kNHV]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVi[j-4*kNHV-kNLV]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVv33[j-4*kNHV-2*kNLV]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetTimeStampFloat(k,time);
+    if (j < kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm){
+      Int_t index = 0;
+      for (Int_t k=0;k<3;k++){
+	index = deltaTimeStamp*k;
+	if (k==0) {
+	  index=0;
+	}
+	else if (k==1) {
+	  index=deltaTimeStamp1;
+	} 
+	else if (k==2) {
+	  index=nentries-1; 
+	}
+	aValue = (AliDCSValue*) aliasArr->At(index);
+	val = aValue->GetFloat();
+	time = (Float_t) (aValue->GetTimeStamp());
+	if (jSetFloat(k,val);
+	  fHVvp[j]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fHVvn[j-kNHV]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fHVip[j-2*kNHV]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fHVin[j-3*kNHV]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVv[j-4*kNHV]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVi[j-4*kNHV-kNLV]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVv33[j-4*kNHV-2*kNLV]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetTimeStampFloat(k,time);
+	}
+	else if (jSetFloat(k,val);
+	  fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetTimeStampFloat(k,time);
+	}
+	else {
+	  fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetFloat(k,val);
+	  fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetTimeStampFloat(k,time);
+	}
       }
-      else if (jSetFloat(k,val);
-	fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetTimeStampFloat(k,time);
-      }
-      else if (jSetFloat(k,val);
-	fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetTimeStampFloat(k,time);
+    }
+  
+    //filling Temperature and Pressure aliases
+    
+    else {
+      Int_t entriesT=0;
+      Int_t entriesP=0;
+      if (jGetFloat();
+	time = (Float_t) (aValue->GetTimeStamp());
+	if (jFill(time,val);
+	  entriesT = (Int_t)(histoT->GetEntries());
+	}
+	else if (jFill(time,val);
+	  entriesP = (Int_t)(histoP->GetEntries());
+	}
       }
-      else {
-	fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetFloat(k,val);
-	fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetTimeStampFloat(k,time);
+    
+      if (j==kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1){
+	entriesT = (Int_t)(histoT->GetEntries());
+	histoT->Fit("pol1","Q","");
+	histoP->Fit("pol1","Q","");
+      
+	TF1 *tempFunc = histoT->GetFunction("pol1");
+	TF1 *pressFunc = histoP->GetFunction("pol1");
+      
+	SetInterceptT((Float_t)tempFunc->GetParameter(0));
+	SetSlopeT((Float_t)tempFunc->GetParameter(1));
+	SetMaxT((Float_t)histoT->GetMaximum());
+	SetInterceptP((Float_t)pressFunc->GetParameter(0));
+	SetSlopeP((Float_t)pressFunc->GetParameter(1));
+	SetMaxP((Float_t)histoP->GetMaximum());
+      
+	TCanvas *chT;
+	TString canvasHistoNameT="HistosT";
+	chT=new TCanvas(canvasHistoNameT,canvasHistoNameT,20,20,600,600);
+	chT->cd();
+	histoT->Draw();
+	TCanvas *chP;
+	TString canvasHistoNameP="HistosP";
+	chP=new TCanvas(canvasHistoNameP,canvasHistoNameP,20,20,600,600);
+	chP->cd();
+	histoP->Draw();
       }
     }
-  
+ 
     //computing the most significant variations
 
     Int_t deltamin = (Int_t)(60/(timeMax-timeMin)*nentries);
     Int_t klast = nentries-deltamin;
-      
+    
     for (Int_t k=0;kAt(k);
       aValue1 = (AliDCSValue*) aliasArr->At(k+deltamin);
@@ -466,69 +554,82 @@ Bool_t AliTOFDataDCS::ProcessData(TMap& aliasMap){
     }
     
     for (Int_t kk=0;kk<2;kk++){
-      if (jSetDelta(kk,delta[kk]);
-	fHVvp[j]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fHVvn[j-kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fHVip[j-2*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fHVin[j-3*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVv[j-4*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVi[j-4*kNHV-kNLV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVv33[j-4*kNHV-2*kNLV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
-      }
-      else if (jSetDelta(kk,delta[kk]);
-	fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+      if (j < kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac){
+	if (jSetDelta(kk,delta[kk]);
+	  fHVvp[j]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fHVvn[j-kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fHVip[j-2*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fHVin[j-3*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVv[j-4*kNHV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVi[j-4*kNHV-kNLV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVv33[j-4*kNHV-2*kNLV]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVi33[j-4*kNHV-2*kNLV-kNLV33]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVv50[j-4*kNHV-2*kNLV-2*kNLV33]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVi50[j-4*kNHV-2*kNLV-2*kNLV33-kNLV50]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVv48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fLVi48[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-kNLV48]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fFEEthr[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fFEEtfeac[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+	else if (jSetDelta(kk,delta[kk]);
+	  fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+	}
+      }
+       
+      
+    //filling for temperature and pressure
+    
+      else if (j==kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm){
+	fT[2]=delta[1];
       }
-      else if (jSetDelta(kk,delta[kk]);
-	fFEEttrm[j-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac]->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
+      else if (j==kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1){
+	fP[2]=delta[1];
       }
+      
     }
   }
-  
+    
   fIsProcessed=kTRUE;
 
   return kTRUE;
@@ -639,11 +740,22 @@ void AliTOFDataDCS::Init(){
     }
     //FEE trms temperatures
     else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm)){
+      AliInfo(Form("**before temperature "));
 	fAliasNames[i] = "tof_fee_ttrm_";
 	sindex.Form("%04i",i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac);
 	fAliasNames[i] += sindex;
  	fFEEttrm[i-4*kNHV-2*kNLV-2*kNLV33-2*kNLV50-2*kNLV48-kNFEEthr-kNFEEtfeac] = new AliTOFFormatDCS();
     }
+    //environment temperature
+    else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+1)){
+      AliInfo(Form("**temperature "));
+
+	fAliasNames[i] = "temperature";
+    }
+    //environment pressure
+    else if (i<(kNHV*4+kNLV*2+kNLV33*2+kNLV50*2+kNLV48*2+kNFEEthr+kNFEEtfeac+kNFEEttrm+2)){
+	fAliasNames[i] = "pressure";
+    }
   }
 }
 
@@ -664,7 +776,7 @@ void AliTOFDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)const
 }
 
 //---------------------------------------------------------------
-void AliTOFDataDCS::Draw(const Option_t* /*option*/)
+void AliTOFDataDCS::Draw(const Option_t* /*option*/) /*const*/
 {
 // Draw all histos and graphs
 
diff --git a/TOF/AliTOFDataDCS.h b/TOF/AliTOFDataDCS.h
index 9e3faac6c8b..c3ba219af0a 100644
--- a/TOF/AliTOFDataDCS.h
+++ b/TOF/AliTOFDataDCS.h
@@ -23,10 +23,10 @@ class AliTOFFormatDCS;
 
 class AliTOFDataDCS : public TObject {
 public:
-  enum {kNAliases=10512, kNHV=90, kNLV=576, 
+  enum {kNAliases=10514, kNHV=90, kNLV=576, 
 	kNLV33=72, kNLV50=72, kNLV48=72, 
 	kNFEEthr=1152, kNFEEtfeac=576, kNFEEttrm=6840, 
-	kNFunctions=0};
+	kNFunctions=0, kNT=1, kNP=1};
   
   AliTOFDataDCS();
   AliTOFDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime);
@@ -46,7 +46,27 @@ class AliTOFDataDCS : public TObject {
   const char* GetAliasName(Int_t pos) const 
     {return pos suppression
-
-Revision 1.9  2007/04/27 17:41:01  arcelli
-merge DistanceToPad and IsInsideThePad methods
-
 Revision 1.8  2007/02/19 18:55:26  decaro
 Added getter methods for volume path (for Event Display)
 
@@ -297,7 +288,7 @@ Bool_t AliTOFGeometryV5::IsInsideThePadPar(Int_t *det, Float_t *pos) const
   //const Float_t klstripx = fgkStripLength;
   */
 
-  const Float_t kPadDepth = 0.5;//0.05;//0.11;//0.16;//          // heigth of Sensitive Layer
+  const Float_t padDepth = 0.5;//0.05;//0.11;//0.16;//          // heigth of Sensitive Layer
 
   //Transform pos into Sector Frame
 
@@ -341,7 +332,7 @@ Bool_t AliTOFGeometryV5::IsInsideThePadPar(Int_t *det, Float_t *pos) const
   Float_t yr =  yt;
   Float_t zr = -xt*TMath::Sin(alpha/kRaddeg)+zt*TMath::Cos(alpha/kRaddeg);
 
-  if(TMath::Abs(xr)<=kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
+  if(TMath::Abs(xr)<=padDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
     isInside=true;
   return isInside;
 
@@ -356,7 +347,7 @@ Bool_t AliTOFGeometryV5::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *
 // inside pad with Detector Indices idet (iSect,iPlate,iStrip,iPadX,iPadZ) 
 //
 
-  const Float_t kPadDepth = 0.5;      // heigth of Sensitive Layer
+  const Float_t padDepth = 0.5;      // heigth of Sensitive Layer
   Double_t vecg[3];
   vecg[0]=pos[0];
   vecg[1]=pos[1];
@@ -380,7 +371,7 @@ Bool_t AliTOFGeometryV5::IsInsideThePad(TGeoHMatrix mat, Float_t *pos, Float_t *
   }
  
   Bool_t isInside=false; 
-  if(TMath::Abs(xr)<= kPadDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
+  if(TMath::Abs(xr)<= padDepth*0.5 && TMath::Abs(yr)<= (fgkXPad*0.5) && TMath::Abs(zr)<= (fgkZPad*0.5))
     isInside=true; 
   return isInside;
 
@@ -1563,8 +1554,11 @@ void AliTOFGeometryV5::GetVolumePath(Int_t *ind, Char_t *path ) {
   
   Int_t icopy=-1;
   icopy=sector;
- 
-  sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
+  // Old 6h convention
+  // if(sector<13){
+  //    icopy=sector+5;}  
+  // else{ icopy=sector-13;}
+  sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
   
   Int_t iplate=ind[1];
   Int_t istrip=ind[2];
@@ -1574,12 +1568,13 @@ void AliTOFGeometryV5::GetVolumePath(Int_t *ind, Char_t *path ) {
   if( iplate==3) icopy=istrip+NStripC()+NStripB()+NStripA(); 
   if( iplate==4) icopy=istrip+NStripC()+2*NStripB()+NStripA(); 
   icopy++;
-  sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
+  sprintf(string2,"FSTR_%i",icopy);
   if(fHoles && (sector==11 || sector==12)){
     if(iplate<2)  sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
     if(iplate>2)  sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
   }
  
+
   Int_t padz = ind[3]+1; 
   Int_t padx = ind[4]+1;
   sprintf(string3,"FPCB_1/FSEN_1/FSEZ_%i/FPAD_%i",padz,padx);
@@ -1595,6 +1590,10 @@ void AliTOFGeometryV5::GetVolumePath(Int_t sector, Char_t *path ){
   Char_t string[100];
 
   Int_t icopy = sector;
+  // Old 6h convention
+  // if(sector<13){
+  //    icopy=sector+5;}  
+  // else{ icopy=sector-13;}
 
   sprintf(string,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
   sprintf(path,"%s",string);
@@ -1611,8 +1610,11 @@ void AliTOFGeometryV5::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Cha
   Char_t string3[100];
   
   Int_t icopy = sector;
-
-  sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",icopy,icopy);
+  // Old 6h convention
+  // if(sector<13){
+  //    icopy=sector+5;}  
+  // else{ icopy=sector-13;}
+  sprintf(string1,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1/FTOA_0/FLTA_0",icopy,icopy);
   
   if(plate==0) icopy=strip; 
   if(plate==1) icopy=strip+NStripC(); 
@@ -1620,7 +1622,7 @@ void AliTOFGeometryV5::GetVolumePath(Int_t sector, Int_t plate, Int_t strip, Cha
   if(plate==3) icopy=strip+NStripC()+NStripB()+NStripA(); 
   if(plate==4) icopy=strip+NStripC()+2*NStripB()+NStripA(); 
   icopy++;
-  sprintf(string2,"FTOA_0/FLTA_0/FSTR_%i",icopy);
+  sprintf(string2,"FSTR_%i",icopy);
   if(fHoles && (sector==11 || sector==12)) {
     if(plate<2)  sprintf(string2,"FTOB_0/FLTB_0/FSTR_%i",icopy);
     if(plate>2)  sprintf(string2,"FTOC_0/FLTC_0/FSTR_%i",icopy);
diff --git a/TOF/AliTOFHitDataBuffer.cxx b/TOF/AliTOFHitDataBuffer.cxx
index ce5a90e7482..1edefe38bf7 100644
--- a/TOF/AliTOFHitDataBuffer.cxx
+++ b/TOF/AliTOFHitDataBuffer.cxx
@@ -15,9 +15,6 @@
 
 /*
 $Log$
-Revision 1.1  2007/04/27 11:03:09  arcelli
-container for TOF raw data
-
  authors: Roberto Preghenella, preghenella@bo.infn.it
           with contribution from Chiara Zampolli, zampolli@bo.infn.it 
 */
@@ -31,12 +28,12 @@ container for TOF raw data
 //                                                                    //
 ////////////////////////////////////////////////////////////////////////
 
-#include "AliLog.h"
+#include 
 #include "AliTOFHitDataBuffer.h"
 
 ClassImp(AliTOFHitDataBuffer)
 
-AliTOFHitDataBuffer::AliTOFHitDataBuffer(Int_t BufferSize) :
+AliTOFHitDataBuffer::AliTOFHitDataBuffer(Int_t BufferSize = 1000) :
   TObject(),
   fBufferSize(BufferSize),
   fBuffer(0x0),
@@ -79,7 +76,7 @@ AliTOFHitDataBuffer::~AliTOFHitDataBuffer()
 Bool_t AliTOFHitDataBuffer::Add(AliTOFHitData &HitData) {
   // adding a new entry 
   if (fEntries >= fBufferSize){
-    AliError("The buffer is completely full. ");
+    printf("buffer limit: current entries = %d\n", fEntries);
     return kTRUE;
   }
   fBuffer[fEntries++] = HitData;
diff --git a/TOF/AliTOFHitDataBuffer.h b/TOF/AliTOFHitDataBuffer.h
index 8d9963614e8..79165ba1690 100644
--- a/TOF/AliTOFHitDataBuffer.h
+++ b/TOF/AliTOFHitDataBuffer.h
@@ -14,14 +14,11 @@
 #include "TObject.h"
 #include "AliTOFHitData.h"
 
-//data buffer size
-#define DATA_BUFFER_SIZE 1000
-
 class AliTOFHitDataBuffer : public TObject{
   
  public:
 
-  AliTOFHitDataBuffer(Int_t BufferSize = DATA_BUFFER_SIZE);
+  AliTOFHitDataBuffer(Int_t BufferSize);
   ~AliTOFHitDataBuffer();  
   AliTOFHitDataBuffer(const AliTOFHitDataBuffer &source);
   AliTOFHitDataBuffer& operator=(const AliTOFHitDataBuffer & source); 
diff --git a/TOF/AliTOFRawStream.cxx b/TOF/AliTOFRawStream.cxx
index d7b1364bc69..00f2bc4f818 100644
--- a/TOF/AliTOFRawStream.cxx
+++ b/TOF/AliTOFRawStream.cxx
@@ -15,21 +15,9 @@
 
 /*
 $Log$
-Revision 1.17  2007/05/03 08:53:50  decaro
-Coding convention: RS3 violation -> suppression
-
-Revision 1.16  2007/05/03 08:22:22  decaro
-Coding convention: RN17 violation -> suppression
-
-Revision 1.15  2007/04/30 15:22:06  arcelli
-Change TOF digit Time, Tot etc to int type
-
 Revision 1.14  2007/04/27 11:11:53  arcelli
 updates for the new decoder
 
-Revision 1.13  2007/03/16 11:46:35  decaro
-Coding convention: RN17 rule violation -> suppression
-
 Revision 1.12  2007/02/22 09:43:45  decaro
 Added AliTOFRawStream::GetIndex method for online calibration (C.Zampolli)
 
@@ -138,8 +126,8 @@ AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader):
   //
 
   for (Int_t i=0;iNSectors();
-  const Int_t kPlates = fTOFGeometry->NPlates();
-  const Int_t kStripA = fTOFGeometry->NStripA();
-  const Int_t kStripB = fTOFGeometry->NStripB();
-  const Int_t kStripC = fTOFGeometry->NStripC();
-  const Int_t kPadX = fTOFGeometry->NpadX();
-  const Int_t kPadZ = fTOFGeometry->NpadZ();
+  const Int_t nSectors = fTOFGeometry->NSectors();
+  const Int_t nPlates = fTOFGeometry->NPlates();
+  const Int_t nStripA = fTOFGeometry->NStripA();
+  const Int_t nStripB = fTOFGeometry->NStripB();
+  const Int_t nStripC = fTOFGeometry->NStripC();
+  const Int_t nPadX = fTOFGeometry->NpadX();
+  const Int_t nPadZ = fTOFGeometry->NpadZ();
 
 
   Int_t isector = detId[0];
-  if (isector >= kSectors)
+  if (isector >= nSectors)
     AliError(Form("Wrong sector number in TOF (%d) !",isector));
   Int_t iplate = detId[1];
-  if (iplate >= kPlates)
+  if (iplate >= nPlates)
     AliError(Form("Wrong plate number in TOF (%d) !",iplate));
   Int_t istrip = detId[2];
   Int_t ipadz = detId[3];
@@ -1147,31 +1135,37 @@ Int_t AliTOFRawStream::GetIndex(Int_t *detId)
     stripOffset = 0;
     break;
   case 1:
-    stripOffset = kStripC;
+    stripOffset = nStripC;
     break;
   case 2:
-    stripOffset = kStripC+kStripB;
+    stripOffset = nStripC+nStripB;
     break;
   case 3:
-    stripOffset = kStripC+kStripB+kStripA;
+    stripOffset = nStripC+nStripB+nStripA;
     break;
   case 4:
-    stripOffset = kStripC+kStripB+kStripA+kStripB;
+    stripOffset = nStripC+nStripB+nStripA+nStripB;
     break;
   default:
     AliError(Form("Wrong plate number in TOF (%d) !",iplate));
     break;
   };
 
-  Int_t idet = ((2*(kStripC+kStripB)+kStripA)*kPadZ*kPadX)*isector +
-               (stripOffset*kPadZ*kPadX)+
-               (kPadZ*kPadX)*istrip+
-	       (kPadX)*ipadz+
+  Int_t idet = ((2*(nStripC+nStripB)+nStripA)*nPadZ*nPadX)*isector +
+               (stripOffset*nPadZ*nPadX)+
+               (nPadZ*nPadX)*istrip+
+	       (nPadX)*ipadz+
 	        ipadx;
   return idet;
 }
 //-----------------------------------------------------------------------------
 Bool_t AliTOFRawStream::DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose = 0){
+  Int_t currentEquipment;
+  Int_t currentDDL;
+
+  //pointers
+  UChar_t *data = 0x0;
+  
   //check and fix valid DDL range
   if (DDLMin < 0){
     DDLMin = 0;
@@ -1188,16 +1182,6 @@ Bool_t AliTOFRawStream::DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose = 0)
   if (verbose)
     AliInfo(Form("Selected TOF DDL range: %d-%d", DDLMin, DDLMax));
 
-  return(Decode(verbose));
-}
-//-----------------------------------------------------------------------------
-Bool_t AliTOFRawStream::Decode(Int_t verbose = 0){
-  Int_t currentEquipment;
-  Int_t currentDDL;
-
-  //pointers
-  UChar_t *data = 0x0;
-  
   //loop and read DDL headers 
   while(fRawReader->ReadHeader()){
 
@@ -1258,10 +1242,6 @@ Bool_t AliTOFRawStream::Decode(Int_t verbose = 0){
 void
 AliTOFRawStream::ResetBuffers()
 {
-  //
-  // To reset the buffers
-  //
-
   for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls("TOF"); iDDL++){
     ResetDataBuffer(iDDL);
     ResetPackedDataBuffer(iDDL);
@@ -1272,10 +1252,6 @@ AliTOFRawStream::ResetBuffers()
 Bool_t
 AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose)
 {
-  //
-  // To load the buffers
-  //
-
   fTOFrawData->Clear();
   fPackedDigits = 0;
   
diff --git a/TOF/AliTOFRawStream.h b/TOF/AliTOFRawStream.h
index 77fd918053f..00992199ee6 100644
--- a/TOF/AliTOFRawStream.h
+++ b/TOF/AliTOFRawStream.h
@@ -402,10 +402,6 @@ class AliTOFRawStream: public TObject {
   Int_t GetSectorNumber(Int_t nDDL) const;
 
   Bool_t DecodeDDL(Int_t DDLMin, Int_t DDLMax, Int_t verbose);
-  Bool_t Decode(Int_t verbose);
-  AliTOFDecoder *GetDecoder() {return fDecoder;};
-  void SetV2718Patch(Bool_t V2718Patch = kTRUE) {fDecoder->SetV2718Patch(V2718Patch);};
-
 
   AliTOFHitDataBuffer *GetDataBuffer(Int_t DDL) {return fDataBuffer[DDL];};
   AliTOFHitDataBuffer *GetPackedDataBuffer(Int_t DDL) {return fPackedDataBuffer[DDL];};
@@ -462,8 +458,8 @@ class AliTOFRawStream: public TObject {
   Bool_t fInsideTRMchain0;   // inside/outside chain 0
   Bool_t fInsideTRMchain1;   // inside/outside chain 1
 
-  AliTOFHitDataBuffer *fDataBuffer[72]; // pointer to AliTOFHitDataBuffer
-  AliTOFHitDataBuffer *fPackedDataBuffer[72]; // pointer to AliTOFHitDataBuffer
+  AliTOFHitDataBuffer *fDataBuffer[72];
+  AliTOFHitDataBuffer *fPackedDataBuffer[72];
 
   ClassDef(AliTOFRawStream, 2)  // class for reading TOF raw digits
 };
diff --git a/TOF/AliTOFReconstructor.cxx b/TOF/AliTOFReconstructor.cxx
index 4e0948081aa..eb55c8d0d4e 100644
--- a/TOF/AliTOFReconstructor.cxx
+++ b/TOF/AliTOFReconstructor.cxx
@@ -30,7 +30,6 @@
 #include "AliTOFClusterFinder.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFGeometryV5.h"
-#include "AliTOFcalib.h"
 #include "AliTOFtrackerMI.h"
 #include "AliTOFtracker.h"
 #include "AliTOFReconstructor.h"
@@ -44,64 +43,15 @@ extern TFile *gFile;
 
 ClassImp(AliTOFReconstructor)
 
- //____________________________________________________________________
-AliTOFReconstructor::AliTOFReconstructor() 
-  : AliReconstructor(),
-    fTOFGeometry(0),
-    fTOFcalib(0)
-{
-//
-// ctor
-//
-  //Retrieving the TOF calibration info  
-  fTOFGeometry = new AliTOFGeometryV5();
-  fTOFcalib    = new AliTOFcalib(fTOFGeometry);
-  if(!fTOFcalib->ReadParFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
-}
-
-//------------------------------------------------------------------------
-AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
-  : AliReconstructor(),
-    fTOFGeometry(0),
-    fTOFcalib(0)
-{
-//
-// copy ctor
-//
-  this->fTOFGeometry=source.fTOFGeometry;
-  this->fTOFcalib=source.fTOFcalib;
-}
-
-//------------------------------------------------------------------------
-AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
-{
-//
-// assignment op.
-//
-  this->fTOFGeometry=source.fTOFGeometry;
-  this->fTOFcalib=source.fTOFcalib;
-  return *this;
-}
-//_____________________________________________________________________________
-AliTOFReconstructor::~AliTOFReconstructor() 
-{
-//
-// dtor
-//
-  delete fTOFGeometry;
-  delete fTOFcalib;
-}
-
 //_____________________________________________________________________________
   void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
 {
 // reconstruct clusters from digits
 
-  AliTOFClusterFinder tofClus(runLoader, fTOFcalib);
+  AliTOFClusterFinder tofClus(runLoader);
   tofClus.Load();
   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
     {
-      AliDebug(2,Form("Local Event loop mode: Creating Recpoints from Digits, Event n. %i",iEvent)); 
       tofClus.Digits2RecPoints(iEvent);
     }
   tofClus.UnLoad();
@@ -114,12 +64,12 @@ void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
 {
 // reconstruct clusters from Raw Data
 
-  AliTOFClusterFinder tofClus(runLoader, fTOFcalib);
+  AliTOFClusterFinder tofClus(runLoader);
   tofClus.LoadClusters();
   Int_t iEvent = 0;
   while (rawReader->NextEvent()) {
-    AliDebug(2,Form("Local Event loop mode: Creating Recpoints from Raw data, Event n. %i",iEvent)); 
     tofClus.Digits2RecPoints(iEvent,rawReader);
+    //tofClus.Raw2Digits(iEvent,rawReader); // temporary solution
     iEvent++;
   }
   tofClus.UnLoadClusters();
@@ -132,33 +82,11 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
 {
 // reconstruct clusters from Raw Data
 
-  AliTOFClusterFinder tofClus(fTOFcalib);
+  AliTOFClusterFinder tofClus;
   tofClus.Digits2RecPoints(rawReader, clustersTree);
 
 }
 
-//_____________________________________________________________________________
-void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
-                                      TTree *clustersTree) const
-{
-// reconstruct clusters from Raw Data
-
-  AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); 
-  AliTOFClusterFinder tofClus(fTOFcalib);
-  tofClus.Digits2RecPoints(digitsTree, clustersTree);
-
-}
-//_____________________________________________________________________________
-  void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
-{
-// reconstruct clusters from digits
-
-  AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree")); 
-  AliTOFClusterFinder tofClus(fTOFcalib);
-  tofClus.Raw2Digits(reader, digitsTree);
-
-}
-
 //_____________________________________________________________________________
 AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* /*runLoader*/) const
 {
diff --git a/TOF/AliTOFReconstructor.h b/TOF/AliTOFReconstructor.h
index 11928e4e8f2..e050acf44f1 100644
--- a/TOF/AliTOFReconstructor.h
+++ b/TOF/AliTOFReconstructor.h
@@ -21,23 +21,17 @@ class AliRawReader;
 class AliRunLoader;
 
 class AliTOFGeometry;
-class AliTOFcalib;
 
 class AliTOFReconstructor: public AliReconstructor {
 public:
-  AliTOFReconstructor();
-  AliTOFReconstructor(const AliTOFReconstructor &source); // copy constructor
-  AliTOFReconstructor& operator=(const AliTOFReconstructor &source); // ass. op.
-  virtual ~AliTOFReconstructor();
+  virtual ~AliTOFReconstructor() {};
 
-  virtual Bool_t       HasLocalReconstruction() const { return kTRUE; }
   virtual void         Reconstruct(AliRunLoader* runLoader) const;
   virtual void         Reconstruct(AliRunLoader* runLoader,
 				   AliRawReader* rawReader) const;
   virtual void         Reconstruct(AliRawReader* rawReader,
 				   TTree* clusterTree) const;
-  virtual void         Reconstruct(TTree* digitsTree, TTree* clusterTree) const;
-  virtual void         ConvertDigits(AliRawReader* reader, TTree* digitsTree) const;
+  virtual void         Reconstruct(TTree*, TTree*) const { };
   virtual AliTracker*  CreateTracker(AliRunLoader* runLoader) const;
   virtual void         FillESD(AliRunLoader*, AliRawReader*, AliESD*) const { };
   virtual void         FillESD(AliRawReader*, TTree*, AliESD*) const { };
@@ -45,11 +39,9 @@ class AliTOFReconstructor: public AliReconstructor {
   virtual void         FillESD(AliRunLoader* runLoader, AliESD* esd) const;
 
 private:
-  AliTOFGeometry *fTOFGeometry; // pointer to TOF geometry
-  AliTOFcalib    *fTOFcalib;    // pointer to TOF calib class
   AliTOFGeometry*      GetTOFGeometry(AliRunLoader* runLoader) const;
 
-  ClassDef(AliTOFReconstructor, 1)   // class for the TOF reconstruction
+  ClassDef(AliTOFReconstructor, 0)   // class for the TOF reconstruction
 };
 
 #endif
diff --git a/TOF/AliTOFSDigitizer.cxx b/TOF/AliTOFSDigitizer.cxx
index 6ab931c748c..a149a61fc90 100644
--- a/TOF/AliTOFSDigitizer.cxx
+++ b/TOF/AliTOFSDigitizer.cxx
@@ -435,7 +435,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
 
 	// fp: really sorry for this, it is a temporary trick to have
 	// track length too
-	if (version<6) { //(version!=6 && version!=7)
+	if(version!=6 && version!=7){
 	  AliTOFhit *tofHit = (AliTOFhit *) tofHitArray->UncheckedAt(hit);
 	  tracknum = tofHit->GetTrack();
 	  vol[0] = tofHit->GetSector();
diff --git a/TOF/AliTOFtracker.cxx b/TOF/AliTOFtracker.cxx
index 1cb2afada0f..4267a91f32b 100644
--- a/TOF/AliTOFtracker.cxx
+++ b/TOF/AliTOFtracker.cxx
@@ -241,17 +241,10 @@ Int_t AliTOFtracker::PropagateBack(AliESD* event) {
     AliESDtrack *t=event->GetTrack(i);
     AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
     if(seed->GetTOFsignal()>0){
-      Float_t info[10];
-      seed->GetTOFInfo(info);
       t->SetTOFsignal(seed->GetTOFsignal());
       t->SetTOFcluster(seed->GetTOFcluster());
       t->SetTOFsignalToT(seed->GetTOFsignalToT());
       t->SetTOFCalChannel(seed->GetTOFCalChannel());
-      AliDebug(2,Form(" Setting TOF info: %f %f %f = ",info[0],info[1],info[2]));    
-      t->SetTOFInfo(info);
-
-      t->GetTOFInfo(info);
-      AliDebug(2,Form(" Getting again TOF info: %f %f %f = ",info[0],info[1],info[2]));    
       Int_t tlab[3]; seed->GetTOFLabel(tlab);    
       t->SetTOFLabel(tlab);
       AliTOFtrack *track = new AliTOFtrack(*seed); 
@@ -300,9 +293,6 @@ Int_t AliTOFtracker::PropagateBack(AliESD* event) {
 //_________________________________________________________________________
 void AliTOFtracker::CollectESD() {
    //prepare the set of ESD tracks to be matched to clusters in TOF
-
-  Int_t seedsTOF1=0;
-  Int_t seedsTOF2=0;
  
   fTracks= new TClonesArray("AliTOFtrack");
   TClonesArray &aTOFTrack = *fTracks;
@@ -311,7 +301,7 @@ void AliTOFtracker::CollectESD() {
     AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
     if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
 
-    // TRD 'good' tracks, already propagated at 371 cm
+    // TRD good tracks, already propagated at 371 cm
 
     AliTOFtrack *track = new AliTOFtrack(*t); // New
     Double_t x = track->GetX(); //New
@@ -322,7 +312,6 @@ void AliTOFtracker::CollectESD() {
       t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
       new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
       fNseedsTOF++;
-      seedsTOF1++;
       delete track;
     }
 
@@ -334,15 +323,12 @@ void AliTOFtracker::CollectESD() {
 	t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
  	new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
 	fNseedsTOF++;
-	seedsTOF2++;
       }
       delete track;
     }
   }
 
-  AliInfo(Form("Number of TOF seeds %i",fNseedsTOF));
-  AliInfo(Form("Number of TOF seeds Type 1 %i",seedsTOF1));
-  AliInfo(Form("Number of TOF seeds Type 2 %i",seedsTOF2));
+  AliInfo(Form("Number of TOF seedds %i",fNseedsTOF));
 
   // Sort according uncertainties on track position 
   fTracks->Sort();
@@ -626,10 +612,6 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
     //  Store quantities to be used in the TOF Calibration
     Float_t tToT=fGeom->ToTBinWidth()*c->GetToT()*1E-3; // in ns
     t->SetTOFsignalToT(tToT);
-    Float_t rawTime=fGeom->TdcBinWidth()*c->GetTDCRAW()+32; // RAW time,in ps
-    Float_t info[10];
-    info[0]=rawTime;
-    info[1]=mindistZ;
     Int_t ind[5];
     ind[0]=c->GetDetInd(0);
     ind[1]=c->GetDetInd(1);
@@ -644,24 +626,11 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
     tlab[0]=c->GetLabel(0);
     tlab[1]=c->GetLabel(1);
     tlab[2]=c->GetLabel(2);
-    AliDebug(2,Form(" tdc time of the matched track %i = ",c->GetTDC()));    
+    
     Double_t tof=fGeom->TdcBinWidth()*c->GetTDC()+32; // in ps
-    AliDebug(2,Form(" tof time of the matched track: %f = ",tof));    
-    info[2]=tof;
-    AliDebug(2,Form(" Setting TOF info. raw time: %f  z distance: %f time: %f = ",info[0],info[1],info[2]));    
-    t->SetTOFInfo(info);
-
-    Double_t tofcorr=tof;
-    if(timeWalkCorr)tofcorr=CorrectTimeWalk(mindistZ,tof);
-    AliDebug(2,Form(" tof time of the matched track, after TW corr: %f = ",tofcorr));    
-    //Set TOF time signal and pointer to the matched cluster
-    t->SetTOFsignal(tofcorr);
+    if(timeWalkCorr)tof=CorrectTimeWalk(mindistZ,tof);
+    t->SetTOFsignal(tof);
     t->SetTOFcluster(idclus); // pointing to the recPoints tree
-
-    //Auxiliary info...
-
-
-    //Tracking info
     Double_t time[AliPID::kSPECIES]; t->GetIntegratedTimes(time);
     Double_t mom=t->GetP();
     for(Int_t j=0;jSetIntegratedLength(recL);
     t->SetIntegratedTimes(time);
     t->SetTOFLabel(tlab);
-
- 
     // Fill Reco-QA histos for Reconstruction
     fHRecNClus->Fill(nc);
     fHRecDist->Fill(mindist);
@@ -688,9 +655,10 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
     // Fill Tree for on-the-fly offline Calibration
 
     if ( !((t->GetStatus() & AliESDtrack::kTIME)==0 )){    
+      Float_t rawtime=fGeom->TdcBinWidth()*c->GetTDCRAW()+32; // RAW time,in ps
       fIch=calindex;
       fToT=tToT;
-      fTime=rawTime;
+      fTime=rawtime;
       fExpTimePi=time[2];
       fExpTimeKa=time[3];
       fExpTimePr=time[4];
@@ -972,14 +940,14 @@ Float_t AliTOFtracker::CorrectTimeWalk( Float_t dist, Float_t tof) {
   return tofcorr;
 }
 //_________________________________________________________________________
-Float_t AliTOFtracker::GetTimeZerofromT0(AliESD *event) const {
+Float_t AliTOFtracker::GetTimeZerofromT0(AliESD *event) {
 
   //Returns TimeZero as measured by T0 detector
 
   return event->GetT0();
 }
 //_________________________________________________________________________
-Float_t AliTOFtracker::GetTimeZerofromTOF(AliESD * /*event*/) const {
+Float_t AliTOFtracker::GetTimeZerofromTOF(AliESD *event) {
 
   //dummy, for the moment. T0 algorithm using tracks on TOF
   {
diff --git a/TOF/AliTOFtracker.h b/TOF/AliTOFtracker.h
index 82119d75210..ccf1c1a9c26 100644
--- a/TOF/AliTOFtracker.h
+++ b/TOF/AliTOFtracker.h
@@ -58,8 +58,8 @@ enum {kMaxCluster=77777}; //maximal number of the TOF clusters
   Int_t FindClusterIndex(Double_t z) const; // Returns cluster index 
   void  MatchTracks(Bool_t mLastStep); // Matching Algorithm 
   void  CollectESD(); // Select starting Set for Matching 
-  Float_t  GetTimeZerofromTOF(AliESD* /*event*/) const; // T0 from TOF
-  Float_t  GetTimeZerofromT0(AliESD* event) const; // T0 from T0
+  Float_t  GetTimeZerofromTOF(AliESD* event); // T0 from TOF
+  Float_t  GetTimeZerofromT0(AliESD* event); // T0 from T0
   Float_t  CorrectTimeWalk(Float_t dist,Float_t tof); // Time Walk correction
 
   AliTOFRecoParam* fRecoParam;           // Pointer to TOF Recon. Pars
diff --git a/TOF/AliTOFv5T0.cxx b/TOF/AliTOFv5T0.cxx
index c1280948574..d22066fd942 100644
--- a/TOF/AliTOFv5T0.cxx
+++ b/TOF/AliTOFv5T0.cxx
@@ -15,9 +15,6 @@
 
 /*
 $Log$
-Revision 1.15  2007/02/19 15:41:55  decaro
-Coding convention: few corrections
-
 Revision 1.14  2006/10/17 15:33:14  arcelli
 Moving some printout from Info to Debug level
 
@@ -256,6 +253,7 @@ void AliTOFv5T0::AddAlignableVolumes() const
     volPath += vpL1;
     volPath += isect;
     volPath += vpL2;
+    volPath += vpL3;
 
     symName  = snSM;
     symName += Form("%02d",isect);
diff --git a/TOF/AliTOFv5T0.h b/TOF/AliTOFv5T0.h
index 176f328b28c..0652ca286a7 100644
--- a/TOF/AliTOFv5T0.h
+++ b/TOF/AliTOFv5T0.h
@@ -27,7 +27,6 @@ class AliTOFv5T0 : public AliTOF {
   virtual void   Init();
   virtual Int_t  IsVersion() const {return 7;}
   virtual void   AddAlignableVolumes() const;
-  virtual void   TOFpc(Float_t, Float_t, Float_t) {};
   virtual void   TOFpc(Float_t xtof,  Float_t ytof, Float_t zlenA,
 		       Float_t zlenB);
   virtual void   TOFpc(Float_t, Float_t, Float_t, Float_t, Float_t, Float_t) {};
diff --git a/TOF/AliTOFv6T0.cxx b/TOF/AliTOFv6T0.cxx
deleted file mode 100644
index 099c3b414ac..00000000000
--- a/TOF/AliTOFv6T0.cxx
+++ /dev/null
@@ -1,1549 +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.                  *
- **************************************************************************/
-
-/*
-$Log$
-Revision 1.2  2007/05/04 12:59:22  arcelli
-Change the TOF SM paths for misalignment (one layer up)
-
-Revision 1.1  2007/05/02 17:32:58  decaro
-TOF geometry description as installed (G. Cara Romeo, A. De Caro)
-
-Revision 0.1 2007 March G. Cara Romeo and A. De Caro
-        Implemented a more realistic TOF geometry description,
-	in terms of:
-	   - material badget,
-	   - services and front end electronics description,
-	   - TOF crate readout modules
-	     (added volume FTOS in ALIC_1/BBMO_1/BBCE_%i -for i=1,...,18-,
-	      and in ALIC_1/BFMO_%i -for i=19,...,36- volumes)
-	As the 5th version in terms of geometrical positioning of volumes.
-
-*/
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  This class contains the functions for version 6 of the Time Of Flight    //
-//  detector.                                                                //
-//                                                                           //
-//  VERSION WITH 6 MODULES AND TILTED STRIPS                                 //
-//                                                                           //
-//  FULL COVERAGE VERSION + OPTION for PHOS holes                            //
-//                                                                           //
-//                                                                           //
-//Begin_Html                                                                 //
-/*                                                                           //
-                                        //
-*/                                                                           //
-//End_Html                                                                   //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
-#include "TBRIK.h"
-#include "TGeometry.h"
-#include "TLorentzVector.h"
-#include "TNode.h"
-#include "TVirtualMC.h"
-#include "TGeoManager.h"
-
-#include "AliConst.h"
-#include "AliLog.h"
-#include "AliMagF.h"
-#include "AliMC.h"
-#include "AliRun.h"
-
-#include "AliTOFGeometry.h"
-#include "AliTOFGeometryV5.h"
-#include "AliTOFv6T0.h"
-
-extern TDirectory *gDirectory;
-extern TVirtualMC *gMC;
-extern TGeoManager *gGeoManager;
-
-extern AliRun *gAlice;
-
-ClassImp(AliTOFv6T0)
-
-//_____________________________________________________________________________
-  AliTOFv6T0::AliTOFv6T0():
-  fIdFTOA(-1),
-  fIdFTOB(-1),
-  fIdFTOC(-1),
-  fIdFLTA(-1),
-  fIdFLTB(-1),
-  fIdFLTC(-1),
-  fTOFHoles(kFALSE)
-{
-  //
-  // Default constructor
-  //
-}
- 
-//_____________________________________________________________________________
-AliTOFv6T0::AliTOFv6T0(const char *name, const char *title):
-  AliTOF(name,title,"tzero"),
-  fIdFTOA(-1),
-  fIdFTOB(-1),
-  fIdFTOC(-1),
-  fIdFLTA(-1),
-  fIdFLTB(-1),
-  fIdFLTC(-1),
-  fTOFHoles(kFALSE)
-{
-  //
-  // Standard constructor
-  //
-  //
-  // Check that FRAME is there otherwise we have no place where to
-  // put TOF
-
-
-  AliModule* frame = (AliModule*)gAlice->GetModule("FRAME");
-  if(!frame) {
-    AliFatal("TOF needs FRAME to be present");
-  } else{
-    
-    if (fTOFGeometry) delete fTOFGeometry;
-    fTOFGeometry = new AliTOFGeometryV5();
-
-    if(frame->IsVersion()==1) {
-      AliDebug(1,Form("Frame version %d", frame->IsVersion())); 
-      AliDebug(1,"Full Coverage for TOF");
-      fTOFHoles=false;}    
-    else {
-      AliDebug(1,Form("Frame version %d", frame->IsVersion())); 
-      AliDebug(1,"TOF with Holes for PHOS");
-      fTOFHoles=true;}      
-  }
-  fTOFGeometry->SetHoles(fTOFHoles);
-
-  //AliTOF::fTOFGeometry = fTOFGeometry;
-
-  // Save the geometry
-  TDirectory* saveDir = gDirectory;
-  gAlice->GetRunLoader()->CdGAFile();
-  fTOFGeometry->Write("TOFgeometry");
-  saveDir->cd();
-
-} 
-
-//_____________________________________________________________________________
-void AliTOFv6T0::AddAlignableVolumes() const
-{
-  //
-  // Create entries for alignable volumes associating the symbolic volume
-  // name with the corresponding volume path. Needs to be syncronized with
-  // eventual changes in the geometry.
-  //
-
-  TString volPath;
-  TString symName;
-
-  TString vpL0  = "ALIC_1/B077_1/BSEGMO";
-  TString vpL1 = "_1/BTOF";
-  TString vpL2 = "_1";
-  TString vpL3 = "/FTOA_0";
-  TString vpL4 = "/FLTA_0/FSTR_";
-
-  TString snSM  = "TOF/sm";
-  TString snSTRIP = "/strip";
-
-  Int_t nSectors=fTOFGeometry->NSectors();
-  Int_t nStrips =fTOFGeometry->NStripA()+
-                 2*fTOFGeometry->NStripB()+
-                 2*fTOFGeometry->NStripC();
-
-  //
-  // The TOF MRPC Strips
-  // The symbolic names are: TOF/sm00/strip01
-  //                           ...
-  //                         TOF/sm17/strip91
- 
-  Int_t imod=0;
-
-  for (Int_t isect = 0; isect < nSectors; isect++) {
-    for (Int_t istr = 1; istr <= nStrips; istr++) {
-      
-      volPath  = vpL0;
-      volPath += isect;
-      volPath += vpL1;
-      volPath += isect;
-      volPath += vpL2;
-      volPath += vpL3;
-      volPath += vpL4;
-      volPath += istr;
-
-      
-      symName  = snSM;
-      symName += Form("%02d",isect);
-      symName += snSTRIP;
-      symName += Form("%02d",istr);
-            
-      AliDebug(2,"--------------------------------------------"); 
-      AliDebug(2,Form("Alignable object %d", imod)); 
-      AliDebug(2,Form("volPath=%s\n",volPath.Data()));
-      AliDebug(2,Form("symName=%s\n",symName.Data()));
-      AliDebug(2,"--------------------------------------------"); 
-	      
-      gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data());
-      imod++;
-    }
-  }
-
-
-  //
-  // The TOF supermodules
-  // The symbolic names are: TOF/sm00
-  //                           ...
-  //                         TOF/sm17
-  //
-  for (Int_t isect = 0; isect < nSectors; isect++) {
-
-    volPath  = vpL0;
-    volPath += isect;
-    volPath += vpL1;
-    volPath += isect;
-    volPath += vpL2;
-
-    symName  = snSM;
-    symName += Form("%02d",isect);
-
-      AliDebug(2,"--------------------------------------------"); 
-      AliDebug(2,Form("Alignable object %d", isect+imod)); 
-      AliDebug(2,Form("volPath=%s\n",volPath.Data()));
-      AliDebug(2,Form("symName=%s\n",symName.Data()));
-      AliDebug(2,"--------------------------------------------"); 
-	      
-    gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data());
-
-  }
-  
-}
-//____________________________________________________________________________
-void AliTOFv6T0::BuildGeometry()
-{
-  //
-  // Build TOF ROOT geometry for the ALICE event display
-  //
-  TNode *node, *top;
-  const int kColorTOF  = 27;
-  
-  TGeometry *globalGeometry = (TGeometry*)gAlice->GetGeometry();
-
-  // Find top TNODE
-  top = globalGeometry->GetNode("alice");
-  
-  // Position the different copies
-  const Float_t krTof  =(fTOFGeometry->Rmax()+fTOFGeometry->Rmin())/2.;
-  const Float_t khTof  = fTOFGeometry->Rmax()-fTOFGeometry->Rmin();
-  const Int_t   kNTof  = fTOFGeometry->NSectors();
-  const Float_t kangle = k2PI/kNTof;
-
-  const Float_t kInterCentrModBorder1 = 49.5;
-  const Float_t kInterCentrModBorder2 = 57.5;
-
-  Float_t ang;
-  
-  // define offset for nodes
-  Float_t zOffsetB = (fTOFGeometry->ZlenA()*0.5 + (kInterCentrModBorder1+kInterCentrModBorder2)*0.5)*0.5;
-  Float_t zOffsetA = 0.;
-  // Define TOF basic volume
-  
-  char nodeName0[16], nodeName1[16], nodeName2[16];
-  char nodeName3[16], nodeName4[16], rotMatNum[16];
-
-  if (fTOFHoles) {
-    new TBRIK("S_TOF_B","TOF box","void",
-	      fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
-    new TBRIK("S_TOF_C","TOF box","void",
-	      fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
-  }
-  new TBRIK("S_TOF_A","TOF box","void",
-            fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenA()*0.5);
-  
-  for (Int_t nodeNum=1;nodeNum9) {
-      sprintf(rotMatNum,"rot5%i",nodeNum);
-      sprintf(nodeName0,"FTO0%i",nodeNum);
-      sprintf(nodeName1,"FTO1%i",nodeNum);
-      sprintf(nodeName2,"FTO2%i",nodeNum);
-      sprintf(nodeName3,"FTO3%i",nodeNum);
-      sprintf(nodeName4,"FTO4%i",nodeNum);
-    }
-    
-    new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
-    ang = (4.5-nodeNum) * kangle;
-
-    if (fTOFHoles) {   
-      top->cd();
-      node = new TNode(nodeName2,nodeName2,"S_TOF_B", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetB,rotMatNum);
-      node->SetLineColor(kColorTOF);
-      fNodes->Add(node);
-      
-      top->cd();
-      node = new TNode(nodeName3,nodeName3,"S_TOF_C", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
-      node->SetLineColor(kColorTOF);
-      fNodes->Add(node);
-    }
-
-    top->cd();
-    node = new TNode(nodeName4,nodeName4,"S_TOF_A", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetA,rotMatNum);
-    node->SetLineColor(kColorTOF);
-    fNodes->Add(node);
-  } // end loop on nodeNum
-
-}
-
-//_____________________________________________________________________________
-void AliTOFv6T0::CreateGeometry()
-{
-  //
-  // Create geometry for Time Of Flight version 0
-  //
-  //Begin_Html
-  /*
-    
-  */
-  //End_Html
-  //
-  // Creates common geometry
-  //
-  AliTOF::CreateGeometry();
-}
- 
-
-//_____________________________________________________________________________
-void AliTOFv6T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenA)
-{
-  //
-  // Definition of the Time Of Fligh Resistive Plate Chambers
-  //
-
-  const Float_t kPi = TMath::Pi();
-
-  const Float_t kInterCentrModBorder1 = 49.5;
-  const Float_t kInterCentrModBorder2 = 57.5;
-  const Float_t kExterInterModBorder1 = 196.0;
-  const Float_t kExterInterModBorder2 = 203.5;
-
-  const Float_t kLengthExInModBorder  = 4.7;
-  const Float_t kLengthInCeModBorder  = 7.0;
-
-  // module wall thickness (cm)
-  const Float_t kModuleWallThickness = 0.33;
-
-  // honeycomb layer between strips and cards (cm)
-  const Float_t kHoneycombLayerThickness = 2.;
-
-  AliDebug(1, "************************* TOF geometry **************************");
-  AliDebug(1,Form(" xtof   %d",  xtof));
-  AliDebug(1,Form(" ytof   %d",  ytof));
-  AliDebug(1,Form(" zlenA   %d", zlenA));
-  AliDebug(2,Form(" zlenA*0.5 = %d", zlenA*0.5));
-  
-  // Definition of the of fibre glass modules (FTOA, FTOB and FTOC)
-    
-  Float_t  xcoor, ycoor, zcoor;
-  Float_t  par[3];
-  Int_t    *idtmed = fIdtmed->GetArray()-499;
-  Int_t    idrotm[100];
-
-  par[0] = xtof * 0.5;
-  par[1] = ytof * 0.25;
-  par[2] = zlenA * 0.5;
-  gMC->Gsvolu("FTOA", "BOX ", idtmed[503], par, 3);  // fibre glass
-   
-  if (fTOFHoles) {
-    par[0] =  xtof * 0.5;
-    par[1] =  ytof * 0.25;
-    par[2] = (zlenA*0.5 - kInterCentrModBorder1)*0.5;
-    gMC->Gsvolu("FTOB", "BOX ", idtmed[503], par, 3);  // fibre glass
-    gMC->Gsvolu("FTOC", "BOX ", idtmed[503], par, 3);  // fibre glass
-  }
-
-  // New supermodule card section description
-  //  2 cm  honeycomb layer between strips and cards
-  par[0] = xtof*0.5 + 2.;
-  par[1] = kHoneycombLayerThickness*0.5;
-  par[2] = zlenA*0.5 + 2.;
-  gMC->Gsvolu("FPEA", "BOX ", idtmed[506], par, 3);    // Al + Cu honeycomb
-  if (fTOFHoles) {
-    //par[0] = xtof*0.5 + 2.;
-    //par[1] = kHoneycombLayerThickness*0.5;
-    par[2] = (zlenA*0.5 - kInterCentrModBorder1)*0.5 + 2.;
-    gMC->Gsvolu("FPEB", "BOX ", idtmed[506], par, 3);  // Al + Cu honeycomb
-  }
-
-  // Definition of the air card containers (FAIA and FAIB)
-
-  par[0] = xtof*0.5;
-  par[1] = (ytof*0.5 - kHoneycombLayerThickness)*0.5;
-  par[2] = zlenA*0.5;
-  gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3);                // Air
-  if (fTOFHoles) gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
-
-  // Positioning of fibre glass modules (FTOA, FTOB and FTOC) and
-  // card containers (FPEA, FAIA and FAIB)
-
-  //AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,-90.);
-  AliMatrix(idrotm[0], 90.,  0., 0., 0., 90.,270.);
-  xcoor = 0.;
-  for(Int_t isec=0; isecNSectors(); isec++){
-    if(fTOFSectors[isec]==-1)continue;
-    char name[16];
-    sprintf(name, "BTOF%d",isec);
-    if (fTOFHoles && (isec==11||isec==12)) {
-    //if (fTOFHoles && (isec==16||isec==17)) { \\Old 6h convention
-      //xcoor = 0.;
-      ycoor = (zlenA*0.5 + kInterCentrModBorder1)*0.5;
-      zcoor = -ytof * 0.25;
-      gMC->Gspos("FTOB", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
-      gMC->Gspos("FTOC", 0, name, xcoor,-ycoor, zcoor, idrotm[0], "ONLY");
-      //xcoor = 0.;
-      //ycoor = (zlenA*0.5 + kInterCentrModBorder1)*0.5;
-      zcoor = kHoneycombLayerThickness*0.5;
-      gMC->Gspos("FPEB", 1, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
-      gMC->Gspos("FPEB", 2, name, xcoor,-ycoor, zcoor, idrotm[0], "ONLY");
-      //xcoor = 0.;
-      ycoor = 0.;
-      zcoor = kHoneycombLayerThickness + (ytof*0.5 - kHoneycombLayerThickness)*0.5;
-      gMC->Gspos("FAIB", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
-    }
-    else {
-      //xcoor = 0.;
-      ycoor = 0.;
-      zcoor = -ytof * 0.25;
-      gMC->Gspos("FTOA", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
-      //xcoor = 0.;
-      //ycoor = 0.;
-      zcoor = kHoneycombLayerThickness*0.5;
-      gMC->Gspos("FPEA", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
-      //xcoor = 0.;
-      //ycoor = 0.;
-      zcoor = kHoneycombLayerThickness + (ytof*0.5 - kHoneycombLayerThickness)*0.5;
-      gMC->Gspos("FAIA", 0, name, xcoor, ycoor, zcoor, idrotm[0], "ONLY");
-    }
-  }
-
-  // Definition and positioning
-  // of the not sensitive volumes with Insensitive Freon (FLTA, FLTB and FLTC)
-
-  Float_t xFLT, yFLT, zFLTA;
-  
-  xFLT  = xtof     - kModuleWallThickness*2.;
-  yFLT  = ytof*0.5 - kModuleWallThickness;
-  zFLTA = zlenA    - kModuleWallThickness*2.;
-  
-  par[0] = xFLT*0.5;
-  par[1] = yFLT*0.5;
-  par[2] = zFLTA*0.5;
-  gMC->Gsvolu("FLTA", "BOX ", idtmed[507], par, 3); //  Freon mix
-
-  xcoor = 0.;
-  ycoor = kModuleWallThickness*0.5;
-  zcoor = 0.;
-  gMC->Gspos ("FLTA", 0, "FTOA", xcoor, ycoor, zcoor, 0, "ONLY");
-
-  if (fTOFHoles) {
-    par[2] = (zlenA*0.5 - kInterCentrModBorder1 - kModuleWallThickness)*0.5;
-    gMC->Gsvolu("FLTB", "BOX ", idtmed[507], par, 3); // Freon mix
-    gMC->Gsvolu("FLTC", "BOX ", idtmed[507], par, 3); // Freon mix
-
-    //xcoor = 0.;
-    //ycoor = kModuleWallThickness*0.5;
-    //zcoor = 0.;
-    gMC->Gspos ("FLTB", 0, "FTOB", xcoor, ycoor, zcoor, 0, "ONLY");
-    gMC->Gspos ("FLTC", 0, "FTOC", xcoor, ycoor, zcoor, 0, "ONLY");
-  }
-
-  Float_t alpha, tgal, beta, tgbe, trpa[11];
-
-  // Definition and positioning
-  // of the fibre glass walls between central and intermediate modules (FWZ1 and FWZ2)
-
-  tgal = (yFLT - 2.*kLengthInCeModBorder)/(kInterCentrModBorder2 - kInterCentrModBorder1);
-  alpha = TMath::ATan(tgal);
-  beta = (kPi*0.5 - alpha)*0.5;
-  tgbe = TMath::Tan(beta);
-  trpa[0]  = xFLT*0.5;
-  trpa[1]  = 0.;
-  trpa[2]  = 0.;
-  trpa[3]  = kModuleWallThickness;
-  trpa[4]  = (kLengthInCeModBorder - kModuleWallThickness*tgbe)*0.5;
-  trpa[5]  = (kLengthInCeModBorder + kModuleWallThickness*tgbe)*0.5;
-  trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
-  trpa[7]  = kModuleWallThickness;
-  trpa[8]  = (kLengthInCeModBorder - kModuleWallThickness*tgbe)*0.5;
-  trpa[9]  = (kLengthInCeModBorder + kModuleWallThickness*tgbe)*0.5;
-  trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
-  gMC->Gsvolu("FWZ1","TRAP", idtmed[503], trpa, 11);   // fibre glass
-
-  AliMatrix (idrotm[1],90., 90.,180.,0.,90.,180.);
-  AliMatrix (idrotm[4],90., 90.,  0.,0.,90.,  0.);
-
-  xcoor = 0.;
-  ycoor = -(yFLT - kLengthInCeModBorder)*0.5;
-  zcoor = kInterCentrModBorder1;
-  gMC->Gspos("FWZ1", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[1],"ONLY");
-  gMC->Gspos("FWZ1", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[4],"ONLY");
-
-  AliMatrix (idrotm[2],90.,270.,  0.,0.,90.,180.);
-  AliMatrix (idrotm[5],90.,270.,180.,0.,90.,  0.);
-
-  xcoor = 0.;
-  ycoor = (yFLT - kLengthInCeModBorder)*0.5;
-  zcoor = kInterCentrModBorder2;
-  gMC->Gspos("FWZ1", 3,"FLTA", xcoor, ycoor, zcoor,idrotm[2],"ONLY");
-  gMC->Gspos("FWZ1", 4,"FLTA", xcoor, ycoor,-zcoor,idrotm[5],"ONLY");
-
-  trpa[0] = 0.5*(kInterCentrModBorder2 - kInterCentrModBorder1)/TMath::Cos(alpha);
-  trpa[1] = kModuleWallThickness;
-  trpa[2] = xFLT*0.5;
-  trpa[3] = -beta*kRaddeg;
-  trpa[4] = 0.;
-  trpa[5] = 0.;
-  gMC->Gsvolu("FWZ2","PARA", idtmed[503], trpa, 6);    // fibre glass
-
-  AliMatrix (idrotm[3],     alpha*kRaddeg,90.,90.+alpha*kRaddeg,90.,90.,180.);
-  AliMatrix (idrotm[6],180.-alpha*kRaddeg,90.,90.-alpha*kRaddeg,90.,90.,  0.);
-
-  xcoor = 0.;
-  ycoor = 0.;
-  zcoor = (kInterCentrModBorder2 + kInterCentrModBorder1)*0.5;
-  gMC->Gspos("FWZ2", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[3],"ONLY");
-  gMC->Gspos("FWZ2", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[6],"ONLY");
-
-  // Definition and positioning
-  // of the fibre glass walls between intermediate and lateral modules (FWZ3 and FWZ4)
-
-  tgal = (yFLT - 2.*kLengthExInModBorder)/(kExterInterModBorder2 - kExterInterModBorder1);
-  alpha = TMath::ATan(tgal);
-  beta = (kPi*0.5 - alpha)*0.5;
-  tgbe = TMath::Tan(beta);
-  trpa[0]  = xFLT*0.5;
-  trpa[1]  = 0.;
-  trpa[2]  = 0.;
-  trpa[3]  = kModuleWallThickness;
-  trpa[4]  = (kLengthExInModBorder - kModuleWallThickness*tgbe)*0.5;
-  trpa[5]  = (kLengthExInModBorder + kModuleWallThickness*tgbe)*0.5;
-  trpa[6]  = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
-  trpa[7]  = kModuleWallThickness;
-  trpa[8]  = (kLengthExInModBorder - kModuleWallThickness*tgbe)*0.5;
-  trpa[9]  = (kLengthExInModBorder + kModuleWallThickness*tgbe)*0.5;
-  trpa[10] = TMath::ATan(tgbe*0.5)*kRaddeg; //TMath::ATan((trpa[5] - trpa[4])/(2.*trpa[3]))*kRaddeg;
-  gMC->Gsvolu("FWZ3","TRAP", idtmed[503], trpa, 11);    // fibre glass
-
-  xcoor = 0.;
-  ycoor = (yFLT - kLengthExInModBorder)*0.5;
-  zcoor = kExterInterModBorder1;
-  gMC->Gspos("FWZ3", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[5],"ONLY");
-  gMC->Gspos("FWZ3", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[2],"ONLY");
-
-  if (fTOFHoles) {
-    //xcoor = 0.;
-    //ycoor = (yFLT - kLengthExInModBorder)*0.5;
-    zcoor = -kExterInterModBorder1 + (zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5;
-    gMC->Gspos("FWZ3", 5,"FLTB", xcoor, ycoor, zcoor,idrotm[2],"ONLY");
-    gMC->Gspos("FWZ3", 6,"FLTC", xcoor, ycoor,-zcoor,idrotm[5],"ONLY");
-  }
-
-  //xcoor = 0.;
-  ycoor = -(yFLT - kLengthExInModBorder)*0.5;
-  zcoor = kExterInterModBorder2;
-  gMC->Gspos("FWZ3", 3,"FLTA", xcoor, ycoor, zcoor,idrotm[4],"ONLY");
-  gMC->Gspos("FWZ3", 4,"FLTA", xcoor, ycoor,-zcoor,idrotm[1],"ONLY");
-
-  if (fTOFHoles) {
-    //xcoor = 0.;
-    //ycoor = -(yFLT - kLengthExInModBorder)*0.5;
-    zcoor = -kExterInterModBorder2 + (zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5;
-    gMC->Gspos("FWZ3", 7,"FLTB", xcoor, ycoor, zcoor,idrotm[1],"ONLY");
-    gMC->Gspos("FWZ3", 8,"FLTC", xcoor, ycoor,-zcoor,idrotm[4],"ONLY");
-  }
-
-  trpa[0] = 0.5*(kExterInterModBorder2 - kExterInterModBorder1)/TMath::Cos(alpha);
-  trpa[1] = kModuleWallThickness;
-  trpa[2] = xFLT*0.5;
-  trpa[3] = -beta*kRaddeg;
-  trpa[4] = 0.;
-  trpa[5] = 0.;
-  gMC->Gsvolu("FWZ4","PARA", idtmed[503], trpa, 6);    // fibre glass
-
-  AliMatrix (idrotm[13],alpha*kRaddeg,90.,90.+alpha*kRaddeg,90.,90.,180.);
-  AliMatrix (idrotm[16],180.-alpha*kRaddeg,90.,90.-alpha*kRaddeg,90.,90.,0.);
-
-  //xcoor = 0.;
-  ycoor = 0.;
-  zcoor = (kExterInterModBorder2 + kExterInterModBorder1)*0.5;
-  gMC->Gspos("FWZ4", 1,"FLTA", xcoor, ycoor, zcoor,idrotm[16],"ONLY");
-  gMC->Gspos("FWZ4", 2,"FLTA", xcoor, ycoor,-zcoor,idrotm[13],"ONLY");
-
-  if (fTOFHoles) {
-    //xcoor = 0.;
-    //ycoor = 0.;
-    zcoor = -(kExterInterModBorder2 + kExterInterModBorder1)*0.5 +
-      (zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5;
-    gMC->Gspos("FWZ4", 3,"FLTB", xcoor, ycoor, zcoor,idrotm[13],"ONLY");
-    gMC->Gspos("FWZ4", 4,"FLTC", xcoor, ycoor,-zcoor,idrotm[16],"ONLY");
-  }
-
-
-  ///////////////// Detector itself //////////////////////
-
-  const Int_t    knx   = fTOFGeometry->NpadX();  // number of pads along x
-  const Int_t    knz   = fTOFGeometry->NpadZ();  // number of pads along z
-  const Float_t  kPadX = fTOFGeometry->XPad();   // pad length along x
-  const Float_t  kPadZ = fTOFGeometry->ZPad();   // pad length along z
-
-  // new description for strip volume -double stack strip-
-  // -- all constants are expressed in cm
-  // heigth of different layers
-  const Float_t khhony   = 1.0;       // heigth of HONY  Layer
-  const Float_t khpcby   = 0.08;      // heigth of PCB   Layer
-  const Float_t khrgly   = 0.055;     // heigth of RED GLASS  Layer
-
-  const Float_t khfiliy  = 0.125;     // heigth of FISHLINE  Layer
-  const Float_t khglassy = 0.160*0.5; // heigth of GLASS  Layer
-  const Float_t khglfy   = khfiliy+2.*khglassy; // heigth of GLASS+FISHLINE  Layer
-
-  const Float_t khcpcby  = 0.16;      // heigth of PCB  Central Layer
-  const Float_t kwhonz   = 8.1;       // z dimension of HONEY  Layer
-  const Float_t kwpcbz1  = 10.6;      // z dimension of PCB  Lower Layer
-  const Float_t kwpcbz2  = 11.6;      // z dimension of PCB  Upper Layer
-  const Float_t kwcpcbz  = 13.;       // z dimension of PCB  Central Layer
-  const Float_t kwrglz   = 8.;        // z dimension of RED GLASS  Layer
-  const Float_t kwglfz   = 7.;        // z dimension of GLASS+FISHLN Layer
-  const Float_t klsensmx = knx*kPadX; // length of Sensitive Layer
-  const Float_t khsensmy = 0.05;      // heigth of Sensitive Layer
-  const Float_t kwsensmz = knz*kPadZ; // width of Sensitive Layer
-
-  // heigth of the FSTR Volume (the strip volume)
-  const Float_t khstripy = 2.*khhony+2.*khpcby+4.*khrgly+2.*khglfy+khcpcby;
-
-  // width  of the FSTR Volume (the strip volume)
-  const Float_t kwstripz = kwcpcbz;
-  // length of the FSTR Volume (the strip volume)
-  const Float_t klstripx = fTOFGeometry->StripLength();
-  
-  Float_t parfp[3]={klstripx*0.5, khstripy*0.5, kwstripz*0.5};
-  // Coordinates of the strip center in the strip reference frame;
-  // used for positioning internal strip volumes
-  Float_t posfp[3]={0.,0.,0.};
-
-  // FSTR volume definition-filling this volume with non sensitive Gas Mixture
-  gMC->Gsvolu("FSTR","BOX",idtmed[507],parfp,3); // Freon mix
-
-  //-- HONY Layer definition
-  //parfp[0] = klstripx*0.5;
-  parfp[1] = khhony*0.5;
-  parfp[2] = kwhonz*0.5;
-  gMC->Gsvolu("FHON","BOX",idtmed[501],parfp,3); // honeycomb (Nomex)
-  // positioning 2 HONY Layers on FSTR volume
-  //posfp[0] = 0.;
-  posfp[1] =-khstripy*0.5+parfp[1];
-  //posfp[2] = 0.;
-  gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY");
-  gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
-  
-  //-- PCB Layer definition
-  //parfp[0] = klstripx*0.5;
-  parfp[1] = khpcby*0.5;
-  parfp[2] = kwpcbz1*0.5;
-  gMC->Gsvolu("FPC1","BOX",idtmed[502],parfp,3); // G10
-  //parfp[0] = klstripx*0.5;
-  //parfp[1] = khpcby*0.5;
-  parfp[2] = kwpcbz2*0.5;
-  gMC->Gsvolu("FPC2","BOX",idtmed[502],parfp,3); // G10
-  // positioning 2 PCB Layers on FSTR volume
-  //posfp[0] = 0.;
-  posfp[1] =-khstripy*0.5+khhony+parfp[1];
-  //posfp[2] = 0.;
-  gMC->Gspos("FPC1",1,"FSTR",0.,-posfp[1],0.,0,"ONLY");
-  gMC->Gspos("FPC2",1,"FSTR",0., posfp[1],0.,0,"ONLY");
-
-  //-- central PCB layer definition
-  //parfp[0] = klstripx*0.5;
-  parfp[1] = khcpcby*0.5;
-  parfp[2] = kwcpcbz*0.5;
-  gMC->Gsvolu("FPCB","BOX",idtmed[502],parfp,3); // G10
-  // positioning the central PCB layer
-  gMC->Gspos("FPCB",1,"FSTR",0.,0.,0.,0,"ONLY");
-
-  //      Sensitive volume
-  Float_t parfs[3] = {klsensmx*0.5, khsensmy*0.5, kwsensmz*0.5};
-  gMC->Gsvolu("FSEN","BOX",idtmed[508],parfs,3); // sensitive
-  // dividing FSEN along z in knz=2 and along x in knx=48
-  gMC->Gsdvn("FSEZ","FSEN",knz,3);
-  gMC->Gsdvn("FPAD","FSEZ",knx,1);
-  // positioning a Sensitive layer inside FPCB
-  gMC->Gspos("FSEN",1,"FPCB",0.,0.,0.,0,"ONLY");
-
-  //-- RED GLASS Layer definition
-  //parfp[0] = klstripx*0.5;
-  parfp[1] = khrgly*0.5;
-  parfp[2] = kwrglz*0.5;
-  gMC->Gsvolu("FRGL","BOX",idtmed[509],parfp,3); // glass
-  // positioning 4 RED GLASS Layers on FSTR volume
-  //posfp[0] = 0.;
-  posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
-  //posfp[2] = 0.;
-  gMC->Gspos("FRGL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
-  gMC->Gspos("FRGL",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
-  //posfp[0] = 0.;
-  posfp[1] = (khcpcby+khrgly)*0.5;
-  //posfp[2] = 0.;
-  gMC->Gspos("FRGL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
-  gMC->Gspos("FRGL",3,"FSTR",0., posfp[1],0.,0,"ONLY");
-
-  //-- GLASS+FISHLINE Layer definition
-  //parfp[0] = klstripx*0.5;
-  parfp[1] = khglfy*0.5;
-  parfp[2] = kwglfz*0.5;
-  gMC->Gsvolu("FGLF","BOX",idtmed[504],parfp,3);
-
-  // positioning 2 GLASS+FISHLINE Layers on FSTR volume
-  //posfp[0] = 0.;
-  posfp[1] = (khcpcby + khglfy)*0.5 + khrgly;
-  //posfp[2] = 0.;
-  gMC->Gspos("FGLF",1,"FSTR",0.,-posfp[1],0.,0,"ONLY");
-  gMC->Gspos("FGLF",2,"FSTR",0., posfp[1],0.,0,"ONLY");
-
-  //  Positioning the Strips (FSTR volumes) in the FLT volumes
-  Int_t maxStripNumbers [5] ={fTOFGeometry->NStripC(),
-			      fTOFGeometry->NStripB(),
-			      fTOFGeometry->NStripA(),
-			      fTOFGeometry->NStripB(),
-			      fTOFGeometry->NStripC()};
-
-  Int_t totalStrip = 0;
-  Float_t xpos, zpos, ypos, ang;
-  for(Int_t iplate = 0; iplate < fTOFGeometry->NPlates(); iplate++){
-    if (iplate>0) totalStrip += maxStripNumbers[iplate-1];
-    for(Int_t istrip = 0; istrip < maxStripNumbers[iplate]; istrip++){
-
-      ang = fTOFGeometry->GetAngles(iplate,istrip);
-      AliDebug(1, Form(" iplate = %1i, istrip = %2i ---> ang = %f", iplate, istrip, ang));
- 
-      if (ang>0.)       AliMatrix (idrotm[istrip+totalStrip+1],90.,0.,90.+ang,90., ang, 90.);
-      else if (ang==0.) AliMatrix (idrotm[istrip+totalStrip+1],90.,0.,90.,90., 0., 0.);
-      else if (ang<0.)  AliMatrix (idrotm[istrip+totalStrip+1],90.,0.,90.+ang,90.,-ang,270.);
-
-      xpos = 0.;
-      zpos = fTOFGeometry->GetDistances(iplate,istrip);
-      ypos = fTOFGeometry->GetHeights(iplate,istrip) + yFLT*0.5;
-
-      gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTA", xpos, ypos,-zpos,idrotm[istrip+totalStrip+1],  "ONLY");
-
-      if (fTOFHoles) {
-	if (istrip+totalStrip+1>53)
-	  gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTC", xpos, ypos,-zpos-(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[istrip+totalStrip+1],"ONLY");
-	if (istrip+totalStrip+1<39)
-	  gMC->Gspos("FSTR",istrip+totalStrip+1,"FLTB", xpos, ypos,-zpos+(zlenA*0.5 + kInterCentrModBorder1 - kModuleWallThickness)*0.5,idrotm[istrip+totalStrip+1],"ONLY");
-      }
-    }
-  }
-
-  // Definition of the cards, cooling tubes and layer for thermal dispersion
-  // (3 volumes)
-
-  // card volume definition
-  Float_t carpar[3] = {9.5, 5.75, 0.5};
-  gMC->Gsvolu("FCA1", "BOX ", idtmed[514], carpar, 3);   // PCB+Alu small Card 
-  carpar[0] = 19.25;
-  //carpar[1] =  5.75;
-  //carpar[2] =  0.5;
-  gMC->Gsvolu("FCA2", "BOX ", idtmed[514], carpar, 3);   // PCB+Alu long Card 
-
-  // tube volume definition
-  Float_t tubepar[3] = {0., 0.4, xFLT*0.5-15.};
-  gMC->Gsvolu("FTUB", "TUBE", idtmed[513], tubepar, 3);  // copper cooling tubes
-  //tubepar[0]= 0.;
-  tubepar[1]= 0.3;
-  //tubepar[2]= xFLT*0.5 - 15.;
-  gMC->Gsvolu("FITU", "TUBE", idtmed[510], tubepar, 3);  // cooling water
-  // Positioning of the water tube into the steel one
-  gMC->Gspos("FITU",1,"FTUB",0.,0.,0.,0,"ONLY");
-
-  // cable
-  Float_t cbpar[3] = {0., 0.5, tubepar[2]};
-  gMC->Gsvolu("FCAB", "TUBE", idtmed[511], cbpar, 3);    // copper+alu
-
-  // Alluminium components
-  Float_t lonpar[3] = {tubepar[2], 6.15, 0.7};
-  gMC->Gsvolu("FTLN", "BOX ", idtmed[505], lonpar, 3);   // alluminium
-  lonpar[0] = 2.;
-  lonpar[1] = 1.;
-  lonpar[2] = zlenA*0.5;
-  gMC->Gsvolu("FLON", "BOX ", idtmed[505], lonpar, 3);   // alluminium
-
-  // rotation matrix
-  AliMatrix(idrotm[99], 180., 90., 90., 90., 90., 0.);
-
-  // cards, tubes, cables  positioning
-  Float_t carpos[3], rowstep = 6.66, ytub= 3.65, ycab= ytub-3.;
-  Float_t rowgap[5] = {13.5, 22.9, 16.94, 23.8, 20.4};
-  Int_t row, rowb[5] = {6, 7, 6, 19, 7}, nrow;
-  carpos[0] = 25. - xtof*0.5;
-  carpos[1] = (11.5 - (ytof*0.5 - kHoneycombLayerThickness))*0.5;
-  row = 1;
-  for (Int_t sg= -1; sg< 2; sg+= 2) {
-    carpos[2] = sg*zlenA*0.5;
-    for (Int_t nb=0; nb<5; ++nb) {
-      carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
-      nrow = row + rowb[nb];
-      for ( ; row < nrow ; ++row) {
-        carpos[2] -= sg*rowstep;
-        gMC->Gspos("FCA1",2*row-1, "FAIA", carpos[0],carpos[1],carpos[2], 0,"ONLY");
-        gMC->Gspos("FCA1",  2*row, "FAIA",-carpos[0],carpos[1],carpos[2], 0,"ONLY");
-        gMC->Gspos("FCA2", row, "FAIA", 0., carpos[1], carpos[2], 0, "ONLY");
-        gMC->Gspos("FTUB", row, "FAIA", 0., ytub, carpos[2]-sg, idrotm[99], "ONLY");
-        gMC->Gspos("FCAB", row, "FAIA", 0., ycab, carpos[2]-sg, idrotm[99], "ONLY");
-      }
-    }
-    gMC->Gspos("FTLN", 5+4*sg, "FAIA", 0., -0.1, 369.9*sg, 0, "ONLY");
-    gMC->Gspos("FTLN", 5+3*sg, "FAIA", 0., -0.1, 366.9*sg, 0, "ONLY");
-    gMC->Gspos("FTLN", 5+2*sg, "FAIA", 0., -0.1, 198.8*sg, 0, "ONLY");
-    gMC->Gspos("FTLN",   5+sg, "FAIA", 0., -0.1, 56.82*sg, 0, "ONLY");
-  }
-  gMC->Gspos("FCA1", 181, "FAIA", carpos[0],carpos[1],0., 0,"ONLY");
-  gMC->Gspos("FCA1", 182, "FAIA",-carpos[0],carpos[1],0., 0,"ONLY");
-  gMC->Gspos("FCA2",  91, "FAIA",  0., carpos[1], 0., 0, "ONLY");
-  gMC->Gspos("FTUB",  91, "FAIA",  0., ytub, 1., idrotm[99], "ONLY");
-  gMC->Gspos("FCAB",  91, "FAIA",  0., ycab, 1., idrotm[99], "ONLY");
-  gMC->Gspos("FLON",   1, "FAIA",-24., ytub+1.4, 0., 0, "MANY");
-  gMC->Gspos("FLON",   2, "FAIA", 24., ytub+1.4, 0., 0, "MANY");
-  if (fTOFHoles) {
-    row = 1;
-    for (Int_t sg= -1; sg< 2; sg+= 2) {
-      carpos[2] = sg*zlenA*0.5;
-      for (Int_t nb=0; nb<4; ++nb) {
-        carpos[2] = carpos[2] - sg*(rowgap[nb] - rowstep);
-        nrow = row + rowb[nb];
-        for ( ; row < nrow ; ++row) {
-          carpos[2] -= sg*rowstep;
-          gMC->Gspos("FCA1",2*row-1, "FAIB", carpos[0],carpos[1],carpos[2], 0,"ONLY");
-          gMC->Gspos("FCA1",  2*row, "FAIB",-carpos[0],carpos[1],carpos[2], 0,"ONLY");
-          gMC->Gspos("FCA2", row, "FAIB", 0., carpos[1], carpos[2], 0, "ONLY");
-          gMC->Gspos("FTUB", row, "FAIB", 0., ytub,carpos[2]-sg, idrotm[99], "ONLY");
-          gMC->Gspos("FCAB", row, "FAIB", 0., ycab,carpos[2]-sg, idrotm[99], "ONLY");
-        }
-      }
-      gMC->Gspos("FTLN", 5+4*sg, "FAIB", 0., -0.1, 369.9*sg, 0, "ONLY");
-      gMC->Gspos("FTLN", 5+3*sg, "FAIB", 0., -0.1, 366.9*sg, 0, "ONLY");
-      gMC->Gspos("FTLN", 5+2*sg, "FAIB", 0., -0.1, 198.8*sg, 0, "ONLY");
-      gMC->Gspos("FTLN",   5+sg, "FAIB", 0., -0.1, 56.82*sg, 0, "ONLY");
-    }
-  gMC->Gspos("FLON", 1, "FAIB",-24., ytub+1.4, 0., 0, "MANY");
-  gMC->Gspos("FLON", 2, "FAIB", 24., ytub+1.4, 0., 0, "MANY");
-  }
-
-  // Cables and tubes on the side blocks
-  const Float_t kcbll   = zlenA*0.5; // length of block
-  const Float_t kcbllh  = zlenA*0.5 - kInterCentrModBorder2; // length  of block in case of hole
-  const Float_t kcblw   = 13.5;      // width of block
-  const Float_t kcblh1  = 2.;        // min. heigth of block
-  const Float_t kcblh2  = 12.3;      // max. heigth of block
-  // volume definition
-  Float_t cblpar[11];
-  tgal =  (kcblh2 - kcblh1)/(2.*kcbll);
-  cblpar[0] = kcblw *0.5;
-  cblpar[1] = 0.;
-  cblpar[2] = 0.;
-  cblpar[3] = kcbll *0.5;
-  cblpar[4] = kcblh1 *0.5;
-  cblpar[5] = kcblh2 *0.5;
-  cblpar[6] = TMath::ATan(tgal)*kRaddeg;
-  cblpar[7] = kcbll *0.5;
-  cblpar[8] = kcblh1 *0.5;
-  cblpar[9] = kcblh2 *0.5;
-  cblpar[10]= cblpar[6];
-  gMC->Gsvolu("FCBL", "TRAP", idtmed[512], cblpar, 11); // cables & tubes mix 
-  Float_t sawpar[3] = {0.5, kcblh2*0.5, kcbll};
-  gMC->Gsvolu("FSAW", "BOX ", idtmed[505], sawpar,  3); // Side Al walls
-  // volume positioning
-  AliMatrix(idrotm[7], 90., 90., 180., 0., 90., 180.);
-  AliMatrix(idrotm[8], 90., 90., 0., 0., 90., 0.);
-  xcoor = (xtof-kcblw)*0.5 - 2.*sawpar[0];
-  ycoor = (kcblh1+kcblh2)*0.25 - (ytof*0.5 - kHoneycombLayerThickness)*0.5;
-  zcoor = kcbll*0.5;
-  gMC->Gspos("FCBL", 1, "FAIA", -xcoor, ycoor, -zcoor, idrotm[7], "ONLY");
-  gMC->Gspos("FCBL", 2, "FAIA",  xcoor, ycoor, -zcoor, idrotm[7], "ONLY");
-  gMC->Gspos("FCBL", 3, "FAIA", -xcoor, ycoor,  zcoor, idrotm[8], "ONLY");
-  gMC->Gspos("FCBL", 4, "FAIA",  xcoor, ycoor,  zcoor, idrotm[8], "ONLY");
-  xcoor = xtof*0.5-sawpar[0];
-  ycoor = (kcblh2 - ytof*0.5 + kHoneycombLayerThickness)*0.5;
-  gMC->Gspos("FSAW", 1, "FAIA", -xcoor, ycoor, 0., 0, "ONLY");
-  gMC->Gspos("FSAW", 2, "FAIA",  xcoor, ycoor, 0., 0, "ONLY");
-  if (fTOFHoles) {
-    cblpar[3] = kcbllh *0.5;
-    cblpar[5] = kcblh1*0.5 + kcbllh*tgal;
-    cblpar[7] = kcbllh *0.5;
-    cblpar[9] = cblpar[5];
-    gMC->Gsvolu("FCBB", "TRAP", idtmed[512], cblpar, 11); // cables & tubes mix
-    xcoor = (xtof - kcblw)*0.5 - 2.*sawpar[0];
-    ycoor = (kcblh1 + 2.*cblpar[5])*0.25 - (ytof*0.5 - kHoneycombLayerThickness)*0.5;
-    zcoor = kcbll-kcbllh*0.5;
-    gMC->Gspos("FCBB", 1, "FAIB", -xcoor, ycoor, -zcoor, idrotm[7], "ONLY");
-    gMC->Gspos("FCBB", 2, "FAIB",  xcoor, ycoor, -zcoor, idrotm[7], "ONLY");
-    gMC->Gspos("FCBB", 3, "FAIB", -xcoor, ycoor,  zcoor, idrotm[8], "ONLY");
-    gMC->Gspos("FCBB", 4, "FAIB",  xcoor, ycoor,  zcoor, idrotm[8], "ONLY");
-    xcoor = xtof*0.5 - sawpar[0];
-    ycoor = (kcblh2 - ytof*0.5 + kHoneycombLayerThickness)*0.5;
-    gMC->Gspos("FSAW", 1, "FAIB", -xcoor, ycoor, 0., 0, "ONLY");
-    gMC->Gspos("FSAW", 2, "FAIB",  xcoor, ycoor, 0., 0, "ONLY");
-  }
-
-  // TOF Supermodule cover definition and positioning
-  Float_t covpar[3] = {xtof*0.5, 0.1, zlenA*0.5};
-  gMC->Gsvolu("FCOV", "BOX ", idtmed[505], covpar, 3);    // Al cover
-  xcoor = 0.;
-  ycoor = 12.5*0.5 - 0.1;
-  zcoor = 0.;
-  gMC->Gspos("FCOV", 0, "FAIA", xcoor, ycoor, zcoor, 0, "ONLY");
-  if (fTOFHoles) gMC->Gspos("FCOV", 0, "FAIB", xcoor, ycoor, zcoor, 0, "ONLY");
-
-  // Services Volumes
-
-  // Empty crate weight: 50 Kg, electronics cards + cables ~ 52 Kg.
-  // Per each side (A and C) the total weight is: 2x102 ~ 204 Kg.
-  // ... + weight of the connection pannel for the steel cooling system (Cr 18%, Ni 12%, Fe 70%)
-  // + other remaining elements + various supports
-
-  // Each FEA card weight + all supports
-  // (including all bolts and not including the cable connectors)
-  //  353.1 g.
-  // Per each strip there are 4 FEA cards, then
-  // the total weight of the front-end electonics section is: 353.1 g x 4 = 1412.4 g.
-
-  Float_t serpar[3] = {29.*0.5, 121.*0.5, 90.*0.5};
-  gMC->Gsvolu("FTOS", "BOX ", idtmed[515], serpar, 3); // Al + Cu + steel
-  zcoor = (118.-90.)*0.5;
-  Float_t phi = -10.,  ra = fTOFGeometry->Rmin() + ytof*0.5;
-  for (Int_t i = 0; i < fTOFGeometry->NSectors(); i++) {
-    phi += 20.;
-    xcoor = ra * TMath::Cos(phi * kDegrad);
-    ycoor = ra * TMath::Sin(phi * kDegrad);
-    AliMatrix(idrotm[20+i], 90., phi, 90., phi + 270., 0., 0.);
-    gMC->Gspos("FTOS", i, "BFMO", xcoor, ycoor, zcoor, idrotm[20+i], "ONLY");      
-  }
-  zcoor = (90. - 223.)*0.5;
-  gMC->Gspos("FTOS", 1, "BBCE", ra, 0., zcoor, 0, "ONLY");
-
-}
-//_____________________________________________________________________________
-void AliTOFv6T0::DrawModule() const
-{
-  //
-  // Draw a shaded view of the Time Of Flight version 5
-  //
-
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-
-  //
-  //Set volumes visible
-  // 
-
-  //Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN", 0);
-
-//=====> Level 1
-  // Level 1 for TOF volumes
-  gMC->Gsatt("B077","seen", 0);
-
-//=====> Level 2
-  // Level 2 for TOF volumes
-  gMC->Gsatt("B071","seen", 0);
-  gMC->Gsatt("B074","seen", 0);
-  gMC->Gsatt("B075","seen", 0);
-  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
-  gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
-
-  // Level 2 of B071
-  gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
-  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
-  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
-  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
-  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
-
-  char name[16];
-  for (Int_t isec=0; isecNSectors(); isec++) {
-    sprintf(name, "BREF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
-    sprintf(name, "BTRD%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
-    sprintf(name, "BTOF%d",isec);
-    gMC->Gsatt(name,"seen",-2);  // all BTOF%d sub-levels skipped   -
-  }
-
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 100, 1000, 100, 1000, 100, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
-  gMC->Gdhead(1111, "Time Of Flight");
-  gMC->Gdman(18, 3, "MAN");
-  gMC->Gdopt("hide","off");
-}
-//_____________________________________________________________________________
-void AliTOFv6T0::DrawDetectorModules() const
-{
-  //
-  // Draw a shaded view of the TOF detector SuperModules version 5
-  //
- 
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-
-  //
-  //Set volumes visible
-  // 
-
-  //Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN", 0);
-
-//=====> Level 1
-  // Level 1 for TOF volumes
-  gMC->Gsatt("B077","seen", 0);
-
-//=====> Level 2
-  // Level 2 for TOF volumes
-  gMC->Gsatt("B071","seen", 0);
-  gMC->Gsatt("B074","seen", 0);
-  gMC->Gsatt("B075","seen", 0);
-  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
-  gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
-
-  // Level 2 of B071
-  gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
-  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
-  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
-  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
-  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
-
-  char name[16];
-  for (Int_t isec=0; isecNSectors(); isec++) {
-    sprintf(name, "BREF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
-    sprintf(name, "BTRD%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
-    sprintf(name, "BTOF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTOF%d sub-levels skipped   -
-  }
-
-  // Level 3 of B071, B075 and B074
-  gMC->Gsatt("FTOA","seen",-2);  // all FTOA sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FTOB","seen",-2);  // all FTOB sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FTOC","seen",-2);  // all FTOC sub-levels skipped   -
-
-  // Level 3 of B071, B075 and B074
-  gMC->Gsatt("FAIA","seen",-1);  // all FAIA sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FAIB","seen",-1);  // all FAIB sub-levels skipped   -
-
-  // Level 3 of B071, B075 and B074
-  gMC->Gsatt("FPEA","seen",1);  // all FPEA sub-levels skipped   -
-  if (fTOFHoles) gMC->Gsatt("FPEB","seen",1);  // all FPEB sub-levels skipped   -
-
-  gMC->Gdopt("hide","on");
-  gMC->Gdopt("shad","on");
-  gMC->Gsatt("*", "fill", 5);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 100, 1000, 100, 1000, 0, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
-  gMC->Gdhead(1111,"TOF detector");
-  gMC->Gdman(18, 3, "MAN");
-  gMC->Gdopt("hide","off");
-}                                 
-
-//_____________________________________________________________________________
-void AliTOFv6T0::DrawDetectorStrips() const
-{
-  //
-  // Draw a shaded view of the TOF strips for version 5
-  //
-
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-
-  //
-  //Set volumes visible
-  // 
-  
-  //Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN", 0);
-  
-//=====> Level 1
-  // Level 1 for TOF volumes
-  gMC->Gsatt("B077","seen", 0);
-
-//=====> Level 2
-  // Level 2 for TOF volumes
-  gMC->Gsatt("B071","seen", 0);
-  gMC->Gsatt("B074","seen", 0);
-  gMC->Gsatt("B075","seen", 0);
-  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
-  gMC->Gsatt("B080","seen", 0);  // B080 does not has sub-level                
-
-  // Level 2 of B071
-  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
-  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
-  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
-  gMC->Gsatt("B056","seen", 0);  // B056 does not has sub-levels  -
-  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
-
-  char name[16];
-  for (Int_t isec=0; isecNSectors(); isec++) {
-    sprintf(name, "BREF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BREF%d sub-levels skipped   -
-    sprintf(name, "BTRD%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTRD%d sub-levels skipped   -
-    sprintf(name, "BTOF%d",isec);
-    gMC->Gsatt(name,"seen", 0);  // all BTOF%d sub-levels skipped   -
-  }
-
-  // Level 3 of B071, B074 and B075
-  gMC->Gsatt("FTOA","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FTOB","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FTOC","SEEN", 0);
-
-  // Level 4 of B071, B074 and B075
-  gMC->Gsatt("FLTA","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FLTB","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FLTC","SEEN", 0);
-
-  // Level 5 of B071, B074 and B075
-  gMC->Gsatt("FAIA","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FAIB","SEEN", 0);
-
-  gMC->Gsatt("FPEA","SEEN", 1);
-  if (fTOFHoles) gMC->Gsatt("FPEB","SEEN", 1);
-
-  gMC->Gsatt("FSTR","SEEN",-2);  // all FSTR sub-levels skipped   -
-
-  gMC->Gsatt("FWZ1","SEEN", 1);
-  gMC->Gsatt("FWZ2","SEEN", 1);
-  gMC->Gsatt("FWZ3","SEEN", 1);
-  gMC->Gsatt("FWZ4","SEEN", 1);
-
-
-  // Level 2 of FAIA
-  // Level 2 of FAIB
-  gMC->Gsatt("FCA1","SEEN", 0);
-  gMC->Gsatt("FCA2","SEEN", 0);
-  gMC->Gsatt("FCAB","SEEN", 0);
-  gMC->Gsatt("FTUB","SEEN",-1);  // all FTUB sub-levels skipped   -
-  gMC->Gsatt("FTLN","SEEN", 0);
-  gMC->Gsatt("FLTN","SEEN", 0);
-  gMC->Gsatt("FCBL","SEEN", 0);
-  gMC->Gsatt("FSAW","SEEN", 0);
-  gMC->Gsatt("FCOV","SEEN", 0);
-  if (fTOFHoles) gMC->Gsatt("FCBB","SEEN", 0);
-
-  // Level 2 of FTUB
-  gMC->Gsatt("FITU","SEEN", 0);
-
-  // Level 2 of FSTR
-  gMC->Gsatt("FHON","SEEN", 1);
-  gMC->Gsatt("FPC1","SEEN", 1);
-  gMC->Gsatt("FPC2","SEEN", 1);
-  gMC->Gsatt("FPCB","SEEN", 1);
-  gMC->Gsatt("FRGL","SEEN", 1);
-  gMC->Gsatt("FGLF","SEEN", 1);
-
-  // Level 2 of FPCB => Level 3 of FSTR
-  gMC->Gsatt("FSEN","SEEN", 0);
-  gMC->Gsatt("FSEZ","SEEN", 0);
-  gMC->Gsatt("FPAD","SEEN", 1);
-
-  gMC->Gdopt("hide","on");
-  gMC->Gdopt("shad","on");
-  gMC->Gsatt("*", "fill", 5);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .018, .018);
-  gMC->Gdhead(1111,"TOF Strips");
-  gMC->Gdman(18, 3, "MAN");
-  gMC->Gdopt("hide","off");
-}
-
-//_____________________________________________________________________________
-void AliTOFv6T0::CreateMaterials()
-{
-  //
-  // Define materials for the Time Of Flight
-  //
-
-  //AliTOF::CreateMaterials();
-
-  AliMagF *magneticField = (AliMagF*)gAlice->Field();
-
-  Int_t   isxfld = magneticField->Integ();
-  Float_t sxmgmx = magneticField->Max();
-
-  Float_t we[7], na[7];
-
-  //--- Quartz (SiO2) to simulate float glass
-  //    density tuned to have correct float glass 
-  //    radiation length
-  Float_t   aq[2] = { 28.09,16. };
-  Float_t   zq[2] = { 14.,8. };
-  Float_t   wq[2] = { 1.,2. };
-  //Float_t   dq = 2.55; // std value: 2.2
-  Float_t   dq = 2.7;    // (+5.9%)
-  Int_t nq = -2;
-
-  // --- Nomex
-  Float_t anox[4] = {12.01,1.01,16.00,14.01};
-  Float_t znox[4] = { 6.,  1.,  8.,  7.};
-  Float_t wnox[4] = {14., 22., 2., 2.};
-  //Float_t dnox  = 0.048; //old value
-  Float_t dnox  = 0.22;    // (x 4.6)
-  Int_t nnox   = -4;
-
-  // --- glass+freon { Si, O, C, F, H, S }
-  Float_t agfr[6]= {28.09,16.00,12.01,19.00,1.01,32.065};
-  Float_t zgfr[6]= {14.,  8.,  6.,  9.,  1.,  16.};
-  Float_t wgfr[6]= {0.465, 0.530, 0.000484, 0.00383, 4.0e-05, 0.000646};
-  Int_t ngfr  = 6;
-  AliDebug(1,Form("wgfr: %d  %d  %d  %d  %d %d", wgfr[0], wgfr[1], wgfr[2], wgfr[3], wgfr[4], wgfr[5]));
-  //Float_t dgfr = 1.35; // + FISHLINE (old value)
-  Float_t dgfr = 1.6;    // + FISHLINE(+18.5 %)
-
-  // --- G10  {Si, O, C, H, O}
-  Float_t ag10[5] = {28.09,16.00,12.01,1.01,16.00};
-  Float_t zg10[5] = {14., 8., 6., 1., 8.};
-  Float_t wmatg10[5];
-  Int_t nlmatg10 = 5;
-  na[0]= 1. ,   na[1]= 2. ,   na[2]= 0. ,   na[3]= 0. ,   na[4]= 0.;
-  MaterialMixer(we,ag10,na,5);
-  wmatg10[0]= we[0]*0.6;
-  wmatg10[1]= we[1]*0.6;
-  na[0]= 0. ,   na[1]= 0. ,   na[2]= 14. ,   na[3]= 20. ,   na[4]= 3.;
-  MaterialMixer(we,ag10,na,5);
-  wmatg10[2]= we[2]*0.4;
-  wmatg10[3]= we[3]*0.4;
-  wmatg10[4]= we[4]*0.4;
-  AliDebug(1,Form("wg10  %d  %d  %d  %d  %d", wmatg10[0], wmatg10[1], wmatg10[2], wmatg10[3], wmatg10[4]));
-  //  Float_t densg10 = 1.7; //old value
-  Float_t densg10 = 2.0; // (+17.8%)
-
-  // -- Water
-  Float_t awa[2] = {  1., 16. };
-  Float_t zwa[2] = {  1.,  8. };
-  Float_t wwa[2] = {  2.,  1. };
-  Float_t dwa    = 1.0;
-  Int_t nwa = -2;
-
-  // AIR
-  Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
-  Float_t zAir[4]={6.,7.,8.,18.};
-  Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
-  Float_t dAir   = 1.20479E-3;
-
-  // --- fibre glass
-  Float_t afg[4] = {28.09,16.00,12.01,1.01};
-  Float_t zfg[4] = {14., 8., 6., 1.};
-  Float_t wfg[4] = {0.12906,0.29405,0.51502,0.06187};
-  //Float_t dfg    = 1.111;
-  Float_t dfg    = 2.; // (+1.8%)
-  Int_t nfg      = 4;
-
-  // --- Freon C2F4H2 + SF6
-  Float_t afre[4]= {12.01,1.01,19.00,32.07};
-  Float_t zfre[4]= { 6., 1., 9., 16.};
-  Float_t wfre[4]= {0.21250,0.01787,0.74827,0.021355};
-  Float_t densfre= 0.00375;
-  Int_t nfre     = 4;
-
-  // --- Al + Cu + G10  {Al, Cu, Si, O, C, H, O}
-  Float_t acar[7]= {26.98,63.55,28.09,16.00,12.01,1.01,16.00};
-  Float_t zcar[7]= {13., 29., 14., 8., 6., 1., 8.};
-  Float_t wcar[7];
-  wcar[0]= 0.7;
-  wcar[1]= 0.05;
-  wcar[2]= 0.25*wmatg10[0];
-  wcar[3]= 0.25*wmatg10[1];
-  wcar[4]= 0.25*wmatg10[2];
-  wcar[5]= 0.25*wmatg10[3];
-  wcar[6]= 0.25*wmatg10[4];
-  AliDebug(1,Form("wcar  %d  %d  %d  %d  %d  %d  %d", wcar[0], wcar[1], wcar[2], wcar[3], wcar[4], wcar[5], wcar[6]));
-  Float_t dcar= 1.9;
-
-  // --- Cables, tubes {Al, Cu} ---
-  Float_t acbt[2]= {26.98,63.55};
-  Float_t zcbt[2]= {13., 29.};
-  //Float_t wcbt[2]= {0.541,0.459};
-  Float_t wcbt[2]= {0.407,0.593};
-  //Float_t decbt  = 0.95;
-  Float_t decbt  = 0.68;
-
-  // --- Cable {Al, Cu}
-  Float_t wcb[2] = {0.165,0.835};
-  Float_t decb   = 0.962;
-
-  // --- Honeycomb layer {Al, Cu}
-  Float_t whon[2]= {0.9,0.1};
-  //Float_t dhon   = 0.44;
-  Float_t dhon   = 1.095; // (x 2.56)
-
-  // --- Crates boxes {Al, Cu, Fe, Cr, Ni}
-  Float_t acra[5]= {26.98,63.55,55.845,52.00,58.69};
-  Float_t zcra[5]= {13., 29., 26., 24., 28.};
-  Float_t wcra[5]= {0.7,0.2,0.07,0.018,0.012};
-  Float_t dcra   = 0.77;
-
-  AliMixture ( 0, "Air$", aAir, zAir, dAir, 4, wAir);
-  AliMixture ( 1, "Nomex$", anox, znox, dnox, nnox, wnox);
-  AliMixture ( 2, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
-  AliMixture ( 3, "fibre glass$", afg, zfg, dfg, nfg, wfg);
-  AliMaterial( 4, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
-  AliMixture ( 5, "Al+Cu honeycomb$", acbt, zcbt, dhon, 2, whon);
-  AliMixture ( 6, "Freon$", afre, zfre, densfre, nfre, wfre);
-  AliMixture ( 7, "Glass$", aq, zq, dq, nq, wq);
-  AliMixture ( 8, "glass-freon$", agfr, zgfr, dgfr, ngfr, wgfr);
-  AliMixture ( 9, "Water$",  awa, zwa, dwa, nwa, wwa);
-  AliMixture (10, "Al+Cu$", acbt, zcbt, decbt, 2, wcbt);
-  AliMaterial(11, "Cu $", 63.54, 29., 3.392, 1.43, 10.);
-  AliMixture (12, "Al+Cu (cable)$", acbt, zcbt, decb, 2, wcb);
-  AliMixture (13, "Al+Cu+G10$", acar, zcar, dcar, 7, wcar);
-  AliMixture (14, "Al+Cu+steel$", acra, zcra, dcra, 5, wcra);
-
-  Float_t epsil, stmin, deemax, stemax;
-
-  //   STD data
-  //  EPSIL  = 0.1   ! Tracking precision,
-  //  STEMAX = 0.1   ! Maximum displacement for multiple scattering
-  //  DEEMAX = 0.1   ! Maximum fractional energy loss, DLS
-  //  STMIN  = 0.1
-
-  // TOF data
-  epsil  = .001;  // Tracking precision,
-  stemax = -1.;   // Maximum displacement for multiple scattering
-  deemax = -.3;   // Maximum fractional energy loss, DLS
-  stmin  = -.8;
-
-  AliMedium( 1, "Air$",         0, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 2,"Nomex$",        1, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 3,"G10$",          2, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 4,"fibre glass$",  3, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 5,"glass-freon$",  8, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 6,"Al Frame$",     4, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 7,"honeycomb$",    5, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 8,"Fre$",          6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 9,"Cu-S$",        11, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(10,"Glass$",        7, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(11,"Water$",        9, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(12,"Cable$",       12, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(13,"Al+Cables$",   10, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(14,"Copper$",      11, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(15,"Cards$",       13, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium(16,"Crates$",      14, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-
-}
-//_____________________________________________________________________________
-void AliTOFv6T0::Init()
-{
-  //
-  // Initialise the detector after the geometry has been defined
-  //
-  AliDebug(1, "**************************************"
-           "  TOF  "
-           "**************************************");
-  AliDebug(1, "  Version 4 of TOF initialing, "
-	   "symmetric TOF - Full Coverage version");
-  
-  AliTOF::Init();
-  
-  fIdFTOA = gMC->VolId("FTOA");
-  if (fTOFHoles) {
-    fIdFTOB = gMC->VolId("FTOB");
-    fIdFTOC = gMC->VolId("FTOC");
-  }
-  fIdFLTA = gMC->VolId("FLTA");
-  if (fTOFHoles) {
-    fIdFLTB = gMC->VolId("FLTB");
-    fIdFLTC = gMC->VolId("FLTC");
-  }
-
-  AliDebug(1, "**************************************"
-           "  TOF  "
-           "**************************************");
-}
- 
-//_____________________________________________________________________________
-void AliTOFv6T0::StepManager()
-{
-
-  //
-  // Procedure called at each step in the Time Of Flight
-  //
-
-  TLorentzVector mom, pos;
-  Float_t xm[3],pm[3],xpad[3],ppad[3];
-  Float_t hits[14];
-  Int_t   vol[5];
-  Int_t   sector, plate, padx, padz, strip;
-  Int_t   copy, padzid, padxid, stripid, i;
-  Int_t   *idtmed = fIdtmed->GetArray()-499;
-  Float_t incidenceAngle;
-
-  const char* volpath;
-
-  Int_t index = 0;
-
-  if(
-     gMC->IsTrackEntering()
-     && gMC->TrackCharge()
-     //&& gMC->GetMedium()==idtmed[508]
-     && gMC->CurrentMedium()==idtmed[508]
-     && gMC->CurrentVolID(copy)==fIdSens
-     )
-  {
-
-    AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
-
-    AddTrackReference(mcApplication->GetCurrentTrackNumber());
-    //AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
-
-    // getting information about hit volumes
-    
-    padzid=gMC->CurrentVolOffID(1,copy);
-    padz=copy;
-    padz--;
-
-    padxid=gMC->CurrentVolOffID(0,copy);
-    padx=copy; 
-    padx--;
-    
-    stripid=gMC->CurrentVolOffID(4,copy);
-    strip=copy; 
-    strip--;
-
-    gMC->TrackPosition(pos);
-    gMC->TrackMomentum(mom);
-
-    Double_t normMom=1./mom.Rho();
-
-    //  getting the coordinates in pad ref system
-
-    xm[0] = (Float_t)pos.X();
-    xm[1] = (Float_t)pos.Y();
-    xm[2] = (Float_t)pos.Z();
-
-    pm[0] = (Float_t)mom.X()*normMom;
-    pm[1] = (Float_t)mom.Y()*normMom;
-    pm[2] = (Float_t)mom.Z()*normMom;
- 
-    gMC->Gmtod(xm,xpad,1); // from MRS to DRS: coordinates convertion
-    gMC->Gmtod(pm,ppad,2); // from MRS to DRS: direction cosinus convertion
-
-
-    if (TMath::Abs(ppad[1])>1) {
-      AliWarning("Abs(ppad) > 1");
-      ppad[1]=TMath::Sign((Float_t)1,ppad[1]);
-    }
-    incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
-
-    plate = -1;
-    if      (strip <  fTOFGeometry->NStripC()) {
-      plate = 0;
-      //strip = strip;
-    }
-    else if (strip >= fTOFGeometry->NStripC() && 
-	     strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB()) {
-      plate = 1;
-      strip = strip - fTOFGeometry->NStripC();
-    }
-    else if (strip >= fTOFGeometry->NStripC() + fTOFGeometry->NStripB() &&
-	     strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA()) {
-      plate = 2;
-      strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB();
-    }
-    else if (strip >= fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA() &&
-	     strip <  fTOFGeometry->NStripC() + fTOFGeometry->NStripB() + fTOFGeometry->NStripA() + fTOFGeometry->NStripB()) {
-      plate = 3;
-      strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB() - fTOFGeometry->NStripA();
-    }
-    else                                {
-      plate = 4;
-      strip = strip - fTOFGeometry->NStripC() - fTOFGeometry->NStripB() - fTOFGeometry->NStripA() - fTOFGeometry->NStripB();
-    }
-
-    volpath=gMC->CurrentVolOffName(7);
-    index=atoi(&volpath[4]);
-    sector=-1;
-    sector=index;
-
-    //Old 6h convention
-    // if(index<5){
-    //   sector=index+13;
-    //	}
-    // else{
-    //   sector=index-5;
-    // } 
- 
-    for(i=0;i<3;++i) {
-      hits[i]   = pos[i];
-      hits[i+3] = pm[i];
-    }
-
-    hits[6] = mom.Rho();
-    hits[7] = pos[3];
-    hits[8] = xpad[0];
-    hits[9] = xpad[1];
-    hits[10]= xpad[2];
-    hits[11]= incidenceAngle;
-    hits[12]= gMC->Edep();
-    hits[13]= gMC->TrackLength();
-    
-    vol[0]= sector;
-    vol[1]= plate;
-    vol[2]= strip;
-    vol[3]= padx;
-    vol[4]= padz;    
-
-    AddT0Hit(mcApplication->GetCurrentTrackNumber(),vol, hits);
-    //AddT0Hit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
-  }
-}
-//-------------------------------------------------------------------
-void AliTOFv6T0::MaterialMixer(Float_t* p,Float_t* a,Float_t* m,Int_t n) const
-{
-  // a[] atomic weights vector      (in)
-  //     (atoms present in more compound appear separately)
-  // m[] number of corresponding atoms in the compound  (in)
-  Float_t t = 0.;
-  for (Int_t i = 0; i < n; ++i) {
-    p[i] = a[i]*m[i];
-    t  += p[i];
-  }
-  for (Int_t i = 0; i < n; ++i) {
-    p[i] = p[i]/t;
-    //AliDebug(1,Form((\n weight[%i] = %f (,i,p[i]));
-  }
-}
diff --git a/TOF/AliTOFv6T0.h b/TOF/AliTOFv6T0.h
deleted file mode 100644
index 176e12f6872..00000000000
--- a/TOF/AliTOFv6T0.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef ALITOFv6T0_H
-#define ALITOFv6T0_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-//_________________________________________________________________________//
-//                                                                         //
-// Implementation version v6 of TOF Manager class                          //
-// FULL COVERAGE VERSION + OPTION FOR PHOS HOLES                           //
-//                                                                         //
-// -- Authors: G. Cara Romeo, A. De Caro                                   //
-//                                                                         //
-//_________________________________________________________________________//
-
-#include "AliTOF.h"
- 
- 
-class AliTOFv6T0 : public AliTOF {
-
-public:
-  AliTOFv6T0();
-  AliTOFv6T0(const char *name, const char *title);
-  virtual ~AliTOFv6T0() {};
-  virtual void   BuildGeometry();
-  virtual void   CreateGeometry();
-  virtual void   CreateMaterials();
-  virtual void   Init();
-  virtual Int_t  IsVersion() const {return 8;}
-  virtual void   AddAlignableVolumes() const;
-  virtual void   TOFpc(Float_t xtof,  Float_t ytof, Float_t zlenA);
-  virtual void   TOFpc(Float_t, Float_t, Float_t, Float_t) {};
-  virtual void   TOFpc(Float_t, Float_t, Float_t, Float_t, Float_t, Float_t) {};
-  virtual void   StepManager();
-  virtual void   DrawModule() const;
-  virtual void   DrawDetectorModules() const;
-  virtual void   DrawDetectorStrips() const;
- 
- protected:
-
-  void MaterialMixer(Float_t* p,Float_t* a,Float_t* m,Int_t n) const;
-
-private:
-  Int_t fIdFTOA; // FTOA volume identifier (outer plate A)
-  Int_t fIdFTOB; // FTOB volume identifier (outer plate B)
-  Int_t fIdFTOC; // FTOC volume identifier (outer plate C)
-  Int_t fIdFLTA; // FLTA volume identifier (inner plate A)
-  Int_t fIdFLTB; // FLTB volume identifier (inner plate B)
-  Int_t fIdFLTC; // FLTC volume identifier (inner plate C)
-  Bool_t fTOFHoles; // Selecting Geometry with and w/o holes
- 
-  ClassDef(AliTOFv6T0,0)  //Time Of Flight version 6
-};
- 
-#endif /* ALITOFv6T0_H */
diff --git a/TOF/MakeTOFFullMisAlignment.C b/TOF/MakeTOFFullMisAlignment.C
index 02bddee17e5..bfe54c8dbcf 100644
--- a/TOF/MakeTOFFullMisAlignment.C
+++ b/TOF/MakeTOFFullMisAlignment.C
@@ -118,9 +118,9 @@ void MakeTOFFullMisAlignment(){
   for(i=0; i<18; i++) {
     TString symname(Form("TOF/sm%02d",i));
     tofdx = rnd->Gaus(0.,sigmatr);
-    tofdy = rnd->Gaus(0.,sigmatr);
-    tofdz =0;
-    dpsi = 0.;
+    tofdy = 0;
+    tofdz = rnd->Gaus(0.,sigmatr);
+    dpsi = 0;
     dtheta = rnd->Gaus(0.,sigmarot);
     dphi = 0.;
     new(alobj[j++]) AliAlignObjAngles(symname.Data(), dvoluid, tofdx, tofdy, tofdz, dpsi, dtheta, dphi, kFALSE);
diff --git a/TOF/TOFPreprocessor.C b/TOF/TOFPreprocessor.C
index 6836946811c..a252f2fa009 100644
--- a/TOF/TOFPreprocessor.C
+++ b/TOF/TOFPreprocessor.C
@@ -53,8 +53,7 @@ void TOFPreprocessor()
   AliTOFDataDCS* output = dynamic_cast (chkEntry->GetObject());
   // If everything went fine, draw the result
   if (output)
-    printf("Output found.\n");
-  //    output->Draw();
+    output->Draw();
   
 }
 
@@ -93,11 +92,13 @@ TMap* CreateDCSAliasMap()
   Float_t tentHVv=6500, tentHVi=80, tentLVv=2.7, tentLVi=4.5,
     tentLVv33=3.3, tentLVv50=5.0, tentLVv48=48,
     tentLVi33=100, tentLVi50=3.0, tentLVi48=10,
-    tentFEEthr=1.0, tentFEEtfeac=25, tentFEEttrm=45;
+    tentFEEthr=1.0, tentFEEtfeac=25, tentFEEttrm=45, 
+    tentTemp=25, tentPress=900;
   Float_t sigmaHVv=10, sigmaHVi=10, sigmaLVv=0.2, sigmaLVi=1.0,
     sigmaLVv33=0.1, sigmaLVv50=0.1, sigmaLVv48=1,
     sigmaLVi33=10, sigmaLVi50=0.5, sigmaLVi48=2,
-    sigmaFEEthr=0.1, sigmaFEEtfeac=10, sigmaFEEttrm=4;
+    sigmaFEEthr=0.1, sigmaFEEtfeac=10, sigmaFEEttrm=4, 
+    sigmaTemp=1, sigmaPress=10;
 
   Float_t tent=0, sigma=0, thr=0;
   Int_t NAliases=10514, NHV=90, NLV=576, NLV33=72, NLV50=72, NLV48=72, NFEEthr=1152, NFEEtfeac=576, NFEEttrm=6840, NT=1, NP=1;
@@ -262,6 +263,21 @@ TMap* CreateDCSAliasMap()
       sigma=sigmaFEEttrm;
       //thr=thrFEEthr;
     }
+    else if (nAlias
 #include 
 #include "TTreeStream.h"
-#include "TFile.h"
-#include "TKey.h"
 
 ClassImp(AliTPCCalPad)
 
@@ -261,7 +259,7 @@ Double_t AliTPCCalPad::GetMeanRMS(Double_t &rms)
 
 
 //_____________________________________________________________________________
-Double_t AliTPCCalPad::GetMean(AliTPCCalPad* outlierPad)
+Double_t AliTPCCalPad::GetMean()
 {
     //
     // return mean of the mean of all ROCs
@@ -269,19 +267,17 @@ Double_t AliTPCCalPad::GetMean(AliTPCCalPad* outlierPad)
     Double_t arr[kNsec];
     Int_t n=0;
     for (Int_t isec = 0; isec < kNsec; isec++) {
-       AliTPCCalROC *calRoc = fROC[isec];
-       if ( calRoc ){
-          AliTPCCalROC* outlierROC = 0;
-          if (outlierPad) outlierROC = outlierPad->GetCalROC(isec);
-	       arr[n] = calRoc->GetMean(outlierROC);
-          n++;
-       }
+        AliTPCCalROC *calRoc = fROC[isec];
+	if ( calRoc ){
+	    arr[n] = calRoc->GetMean();
+            n++;
+	}
     }
     return TMath::Mean(n,arr);
 }
 
 //_____________________________________________________________________________
-Double_t AliTPCCalPad::GetRMS(AliTPCCalPad* outlierPad)
+Double_t AliTPCCalPad::GetRMS()
 {
     //
     // return mean of the RMS of all ROCs
@@ -289,19 +285,17 @@ Double_t AliTPCCalPad::GetRMS(AliTPCCalPad* outlierPad)
     Double_t arr[kNsec];
     Int_t n=0;
     for (Int_t isec = 0; isec < kNsec; isec++) {
-       AliTPCCalROC *calRoc = fROC[isec];
-       if ( calRoc ){
-          AliTPCCalROC* outlierROC = 0;
-          if (outlierPad) outlierROC = outlierPad->GetCalROC(isec);
-          arr[n] = calRoc->GetRMS(outlierROC);
-          n++;
-       }
+        AliTPCCalROC *calRoc = fROC[isec];
+	if ( calRoc ){
+	    arr[n] = calRoc->GetRMS();
+            n++;
+	}
     }
     return TMath::Mean(n,arr);
 }
 
 //_____________________________________________________________________________
-Double_t AliTPCCalPad::GetMedian(AliTPCCalPad* outlierPad)
+Double_t AliTPCCalPad::GetMedian()
 {
     //
     // return mean of the median of all ROCs
@@ -309,19 +303,17 @@ Double_t AliTPCCalPad::GetMedian(AliTPCCalPad* outlierPad)
     Double_t arr[kNsec];
     Int_t n=0;
     for (Int_t isec = 0; isec < kNsec; isec++) {
-       AliTPCCalROC *calRoc = fROC[isec];
-       if ( calRoc ){
-          AliTPCCalROC* outlierROC = 0;
-          if (outlierPad) outlierROC = outlierPad->GetCalROC(isec);
-          arr[n] = calRoc->GetMedian(outlierROC);
-          n++;
-       }
+        AliTPCCalROC *calRoc = fROC[isec];
+	if ( calRoc ){
+	    arr[n] = calRoc->GetMedian();
+            n++;
+	}
     }
     return TMath::Mean(n,arr);
 }
 
 //_____________________________________________________________________________
-Double_t AliTPCCalPad::GetLTM(Double_t *sigma, Double_t fraction, AliTPCCalPad* outlierPad)
+Double_t AliTPCCalPad::GetLTM(Double_t *sigma, Double_t fraction)
 {
     //
     // return mean of the LTM and sigma of all ROCs
@@ -335,9 +327,7 @@ Double_t AliTPCCalPad::GetLTM(Double_t *sigma, Double_t fraction, AliTPCCalPad*
         AliTPCCalROC *calRoc = fROC[isec];
 	if ( calRoc ){
 	    if ( sigma ) sTemp=arrs+n;
-       AliTPCCalROC* outlierROC = 0;
-       if (outlierPad) outlierROC = outlierPad->GetCalROC(isec);
-	    arrm[n] = calRoc->GetLTM(sTemp,fraction, outlierROC);
+	    arrm[n] = calRoc->GetLTM(sTemp,fraction);
             n++;
 	}
     }
@@ -428,51 +418,12 @@ TH2F *AliTPCCalPad::MakeHisto2D(Int_t side){
 
 
 
-void AliTPCCalPad::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad* outlierPad, Float_t ltmFraction) {
+void AliTPCCalPad::MakeTree(const char * fileName, TObjArray * array) {
   //
   // Write tree with all available information
   //
-   AliTPCROC* tpcROCinstance = AliTPCROC::Instance();
-
-   TObjArray* mapIROCs = 0;
-   TObjArray* mapOROCs = 0;
-   TVectorF *mapIROCArray = 0;
-   TVectorF *mapOROCArray = 0;
-   Int_t mapEntries = 0;
-   TString* mapNames = 0;
-   
-   if (mapFileName) {
-      TFile mapFile(mapFileName, "read");
-      
-      TList* listOfROCs = mapFile.GetListOfKeys();
-      mapEntries = listOfROCs->GetEntries()/2;
-      mapIROCs = new TObjArray(mapEntries*2);
-      mapOROCs = new TObjArray(mapEntries*2);
-      mapIROCArray = new TVectorF[mapEntries];
-      mapOROCArray = new TVectorF[mapEntries];
-      
-      mapNames = new TString[mapEntries];
-      for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
-         TString ROCname(((TKey*)(listOfROCs->At(ivalue*2)))->GetName());
-         ROCname.Remove(ROCname.Length()-4, 4);
-         mapIROCs->AddAt((AliTPCCalROC*)mapFile.Get((ROCname + "IROC").Data()), ivalue);
-         mapOROCs->AddAt((AliTPCCalROC*)mapFile.Get((ROCname + "OROC").Data()), ivalue);
-         mapNames[ivalue].Append(ROCname);
-      }
-      
-      for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
-         mapIROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(0));
-         mapOROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(36));
-      
-         for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(0); ichannel++)
-            (mapIROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel);
-         for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(36); ichannel++)
-            (mapOROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel);
-      }
-
-   } //  if (mapFileName)
-  
    TTreeSRedirector cstream(fileName);
+   AliTPCROC* tpcROCinstance = AliTPCROC::Instance();
    Int_t arrayEntries = array->GetEntries();
    
    TString* names = new TString[arrayEntries];
@@ -487,12 +438,6 @@ void AliTPCCalPad::MakeTree(const char * fileName, TObjArray * array, const char
       TVectorF mean(arrayEntries);
       TVectorF rms(arrayEntries);
       TVectorF ltm(arrayEntries);
-      TVectorF ltmrms(arrayEntries);
-      TVectorF medianWithOut(arrayEntries);
-      TVectorF meanWithOut(arrayEntries);
-      TVectorF rmsWithOut(arrayEntries);
-      TVectorF ltmWithOut(arrayEntries);
-      TVectorF ltmrmsWithOut(arrayEntries);
       
       TVectorF *vectorArray = new TVectorF[arrayEntries];
       for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++)
@@ -501,35 +446,17 @@ void AliTPCCalPad::MakeTree(const char * fileName, TObjArray * array, const char
       for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
          AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue);
          AliTPCCalROC* calROC = calPad->GetCalROC(isector);
-         AliTPCCalROC* outlierROC = 0;
-         if (outlierPad) outlierROC = outlierPad->GetCalROC(isector);
          if (calROC) {
             median[ivalue] = calROC->GetMedian();
             mean[ivalue] = calROC->GetMean();
             rms[ivalue] = calROC->GetRMS();
-            Double_t ltmrmsValue = 0;
-            ltm[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction);
-            ltmrms[ivalue] = ltmrmsValue;
-            if (outlierROC) {
-               medianWithOut[ivalue] = calROC->GetMedian(outlierROC);
-               meanWithOut[ivalue] = calROC->GetMean(outlierROC);
-               rmsWithOut[ivalue] = calROC->GetRMS(outlierROC);
-               ltmrmsValue = 0;
-               ltmWithOut[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction, outlierROC);
-               ltmrmsWithOut[ivalue] = ltmrmsValue;
-            }
+            ltm[ivalue] = calROC->GetLTM();
          }
          else {
             median[ivalue] = 0.;
             mean[ivalue] = 0.;
             rms[ivalue] = 0.;
             ltm[ivalue] = 0.;
-            ltmrms[ivalue] = 0.;
-            medianWithOut[ivalue] = 0.;
-            meanWithOut[ivalue] = 0.;
-            rmsWithOut[ivalue] = 0.;
-            ltmWithOut[ivalue] = 0.;
-            ltmrmsWithOut[ivalue] = 0.;
          }
       }
       
@@ -575,16 +502,7 @@ void AliTPCCalPad::MakeTree(const char * fileName, TObjArray * array, const char
             (Char_t*)((names[ivalue] + "_Median=").Data()) << median[ivalue] <<
             (Char_t*)((names[ivalue] + "_Mean=").Data()) << mean[ivalue] <<
             (Char_t*)((names[ivalue] + "_RMS=").Data()) << rms[ivalue] <<
-            (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue] <<
-            (Char_t*)((names[ivalue] + "_RMS_LTM=").Data()) << ltmrms[ivalue];
-         if (outlierPad) {
-            cstream << "calPads" <<
-               (Char_t*)((names[ivalue] + "_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] <<
-               (Char_t*)((names[ivalue] + "_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] <<
-               (Char_t*)((names[ivalue] + "_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] <<
-               (Char_t*)((names[ivalue] + "_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] <<
-               (Char_t*)((names[ivalue] + "_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue];
-         }
+            (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue];
       }
 
       for  (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
@@ -592,17 +510,6 @@ void AliTPCCalPad::MakeTree(const char * fileName, TObjArray * array, const char
             (Char_t*)((names[ivalue] + ".=").Data()) << &vectorArray[ivalue];
       }
 
-      if (mapFileName) {
-         for  (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
-            if (isector < 36)
-               cstream << "calPads" <<
-                  (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapIROCArray[ivalue];
-            else
-               cstream << "calPads" <<
-                  (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapOROCArray[ivalue];
-         }
-      }
-
       cstream << "calPads" <<
          "row.=" << &posArray[0] <<
          "pad.=" << &posArray[1] <<
@@ -618,13 +525,6 @@ void AliTPCCalPad::MakeTree(const char * fileName, TObjArray * array, const char
       delete[] vectorArray;
    }
    delete[] names;
-   if (mapFileName) {
-      delete mapIROCs;
-      delete mapOROCs;
-      delete[] mapIROCArray;
-      delete[] mapOROCArray;
-      delete[] mapNames;
-   }
 }
 
 
diff --git a/TPC/AliTPCCalPad.h b/TPC/AliTPCCalPad.h
index 095d14334cd..86fc7fdc0b4 100644
--- a/TPC/AliTPCCalPad.h
+++ b/TPC/AliTPCCalPad.h
@@ -40,14 +40,14 @@ class AliTPCCalPad : public TNamed {
   void Divide(const AliTPCCalPad * pad);
   //
   Double_t GetMeanRMS(Double_t &rms);
-  Double_t GetMean(AliTPCCalPad* outlierPad = 0);
-  Double_t GetRMS(AliTPCCalPad* outlierPad = 0) ;
-  Double_t GetMedian(AliTPCCalPad* outlierPad = 0) ;
-  Double_t GetLTM(Double_t *sigma=0, Double_t fraction=0.9, AliTPCCalPad* outlierPad = 0);
+  Double_t GetMean();
+  Double_t GetRMS() ;
+  Double_t GetMedian() ;
+  Double_t GetLTM(Double_t *sigma=0, Double_t fraction=0.9);
   TGraph  *MakeGraph(Int_t type=0, Float_t ratio=0.7);
   TH2F    *MakeHisto2D(Int_t side=0);
   TH1F    *MakeHisto1D(Float_t min=4, Float_t max=-4, Int_t type=0);  
-  static void MakeTree(const char * fileName, TObjArray * array, const char * mapFileName = 0, AliTPCCalPad* outlierPad = 0, Float_t ltmFraction = 0.9);
+  static void MakeTree(const char * fileName, TObjArray * array);
  protected:
   AliTPCCalROC *fROC[kNsec];                    //  Array of ROC objects which contain the values per pad
   ClassDef(AliTPCCalPad,1)                      //  TPC calibration class for parameters which are saved per pad
diff --git a/TPC/AliTPCCalROC.cxx b/TPC/AliTPCCalROC.cxx
index f8e23dcb77b..831c3e11489 100644
--- a/TPC/AliTPCCalROC.cxx
+++ b/TPC/AliTPCCalROC.cxx
@@ -36,8 +36,6 @@
 #include "AliTPCCalROC.h"
 #include "AliMathBase.h"
 
-#include "TRandom3.h"      // only needed by the AliTPCCalROCTest() method
-
 ClassImp(AliTPCCalROC)
 
 
@@ -183,66 +181,18 @@ void AliTPCCalROC::Divide(const AliTPCCalROC*  roc) {
   }
 }
 
-Double_t AliTPCCalROC::GetMean(AliTPCCalROC* outlierROC) {
-   if (!outlierROC) return TMath::Mean(fNChannels, fData);
-   Double_t *ddata = new Double_t[fNChannels];
-   Int_t NPoints = 0;
-   for (UInt_t i=0;iGetValue(i))) {
-         ddata[NPoints]= fData[NPoints];
-         NPoints++;
-      }
-   }
-   Double_t mean = TMath::Mean(NPoints, ddata);
-   delete [] ddata;
-   return mean;
-}
 
-Double_t AliTPCCalROC::GetMedian(AliTPCCalROC* outlierROC) {
-   if (!outlierROC) return TMath::Median(fNChannels, fData);
-   Double_t *ddata = new Double_t[fNChannels];
-   Int_t NPoints = 0;
-   for (UInt_t i=0;iGetValue(i))) {
-         ddata[NPoints]= fData[NPoints];
-         NPoints++;
-      }
-   }
-   Double_t mean = TMath::Median(NPoints, ddata);
-   delete [] ddata;
-   return mean;
-}
 
-Double_t AliTPCCalROC::GetRMS(AliTPCCalROC* outlierROC) {
-   if (!outlierROC) return TMath::RMS(fNChannels, fData);
-   Double_t *ddata = new Double_t[fNChannels];
-   Int_t NPoints = 0;
-   for (UInt_t i=0;iGetValue(i))) {
-         ddata[NPoints]= fData[NPoints];
-         NPoints++;
-      }
-   }
-   Double_t mean = TMath::RMS(NPoints, ddata);
-   delete [] ddata;
-   return mean;
-}
 
-Double_t AliTPCCalROC::GetLTM(Double_t *sigma, Double_t fraction, AliTPCCalROC* outlierROC){
+Double_t AliTPCCalROC::GetLTM(Double_t *sigma, Double_t fraction){
   //
   //  Calculate LTM mean and sigma
   //
   Double_t *ddata = new Double_t[fNChannels];
   Double_t mean=0, lsigma=0;
-  UInt_t NPoints = 0;
-  for (UInt_t i=0;iGetValue(i))) {
-        ddata[NPoints]= fData[NPoints];
-        NPoints++;
-     }
-  }
-  Int_t hh = TMath::Min(TMath::Nint(fraction *NPoints), Int_t(NPoints));
-  AliMathBase::EvaluateUni(NPoints,ddata, mean, lsigma, hh);
+  Int_t hh = TMath::Min(TMath::Nint(fraction *fNChannels), Int_t(fNChannels));
+  for (UInt_t i=0;iGetNPads(irow))
       printf("NPads - Read/Write error\trow=%d\n",irow);
     for (UInt_t ipad = 0; ipad GetValue(irow,ipad)!=value){
-        printf("Read/Write error\trow=%d\tpad=%d\n",irow,ipad);
+	printf("Read/Write error\trow=%d\tpad=%d\n",irow,ipad);
       }
     }
-  }
-
-  // 
-  // Algebra Tests
-  //
-  
-  // Add constant
-  AliTPCCalROC roc3(roc0);
-  roc3.Add(1.5);
-  for (UInt_t irow = 0; irow  kEpsilon){
-        printf("Add constant - error\trow=%d\tpad=%d\n",irow,ipad);
-      }
-    }
-  }
-
-  // Add another CalROC
-  AliTPCCalROC roc4(roc0);
-  roc4.Add(&roc0, -1.5);
-  for (UInt_t irow = 0; irow  kEpsilon){
-        printf("Add CalROC - error\trow=%d\tpad=%d\n",irow,ipad);
-      }
-    }
-  }
-  
-  // Multiply with constant
-  AliTPCCalROC roc5(roc0);
-  roc5.Multiply(-1.4);
-  for (UInt_t irow = 0; irow  kEpsilon){
-        printf("Multiply with constant - error\trow=%d\tpad=%d\n",irow,ipad);
-      }
-    }
-  }
-
-  // Multiply another CalROC
-  AliTPCCalROC roc6(roc0);
-  roc6.Multiply(&roc0);
-  for (UInt_t irow = 0; irow  kEpsilon*100){
-        printf("Multiply with CalROC - error\trow=%d\tpad=%d\n",irow,ipad);
-      }
-    }
-  }
-
-
-  // Divide by CalROC
-  AliTPCCalROC roc7(roc0);
-  roc7.Divide(&roc0);
-  for (UInt_t irow = 0; irow  kEpsilon){
-        printf("Multiply with CalROC - error\trow=%d\tpad=%d\n",irow,ipad);
-      }
-    }
-  }
-
-  //
-  // Statistics Test
-  //
-  
-  // create CalROC with defined values
-  TRandom3 rnd(0);
-  AliTPCCalROC sroc0(0);
-  for (UInt_t ichannel = 0; ichannel < sroc0.GetNchannels(); ichannel++){
-    Float_t value  = rnd.Gaus(10., 2.);
-    sroc0.SetValue(ichannel,value);
-  }
-
-  printf("Mean   (should be close to 10): %f\n", sroc0.GetMean());
-  printf("RMS    (should be close to  2): %f\n", sroc0.GetRMS());
-  printf("Median (should be close to 10): %f\n", sroc0.GetMedian());
-  printf("LTM    (should be close to 10): %f\n", sroc0.GetLTM());
-
-  //AliTPCCalROC* sroc1 = sroc0.LocalFit(4, 8);
-  
-  //delete sroc1;
-
-//        std::cout << TMath::Abs(roc5.GetValue(irow,ipad)-value) << std::endl;
+  }   
 }
 
 
@@ -574,16 +427,13 @@ Double_t AliTPCCalROC::GetNeighbourhoodValue(TLinearFitter* fitterQ, Int_t row,
   
   TArrayI *neighbourhoodRows = 0;
   TArrayI *neighbourhoodPads = 0;
-  
-  //std::cerr << "Trying to get neighbourhood for row " << row << ", pad " << pad << std::endl;
   GetNeighbourhood(neighbourhoodRows, neighbourhoodPads, row, pad, rRadius, pRadius);
-  //std::cerr << "Got neighbourhood for row " << row << ", pad " << pad << std::endl;
   
   Int_t r, p;
   for (Int_t i=0; i < (2*rRadius+1)*(2*pRadius+1); i++) {
     r = neighbourhoodRows->At(i);
     p = neighbourhoodPads->At(i);
-    if (r == -1 || p == -1) continue;   // window is bigger than ROC
+    if (r == -1 || p == -1) continue;
     tpcROCinstance->GetPositionLocal(fSector, r, p, localXY);   // calculate position localXY by pad and row number
     dlx = lPad[0] - localXY[0];
     dly = lPad[1] - localXY[1];
@@ -593,15 +443,11 @@ Double_t AliTPCCalROC::GetNeighbourhoodValue(TLinearFitter* fitterQ, Int_t row,
     xx[3] = dlx*dlx;
     xx[4] = dly*dly;
     xx[5] = dlx*dly;
-    if (!ROCoutliers || ROCoutliers->GetValue(r,p) != 1) {
+    if (ROCoutliers && ROCoutliers->GetValue(r,p) != 1) {
       fitterQ->AddPoint(xx, GetValue(r, p), 1);
       npoints++;
     }
   }
-  
-  delete neighbourhoodRows;
-  delete neighbourhoodPads;
-  
   if (npoints < 0.5 * ((2*rRadius+1)*(2*pRadius+1)) ) {
     // std::cerr << "Too few data points for fitting @ row " << row << ", pad " << pad << " in sector " << fSector << std::endl;
     return 0.;  // for diagnostic
@@ -618,6 +464,9 @@ Double_t AliTPCCalROC::GetNeighbourhoodValue(TLinearFitter* fitterQ, Int_t row,
   }
   Double_t value = fitParam[0];
   
+  delete neighbourhoodRows;
+  delete neighbourhoodPads;
+  
   //if (value < 0) std::cerr << "negative fit-value " << value << " in sector "<< this->fSector << " @ row: " << row << " and pad: " << pad << ", with fitter Chi2 = " << chi2Q <<  std::endl;
   
   return value;
@@ -632,8 +481,8 @@ void AliTPCCalROC::GetNeighbourhood(TArrayI* &rowArray, TArrayI* &padArray, Int_
   //
   rowArray = new TArrayI((2*rRadius+1)*(2*pRadius+1));
   padArray = new TArrayI((2*rRadius+1)*(2*pRadius+1));
-  //Int_t* rowArrayTemp = rowArray->GetArray();
-  //Int_t* padArrayTemp = padArray->GetArray();
+  Int_t* rowArrayTemp = rowArray->GetArray();
+  Int_t* padArrayTemp = padArray->GetArray();
   
   Int_t rmin = row - rRadius;
   UInt_t rmax = row + rRadius;
@@ -665,17 +514,17 @@ void AliTPCCalROC::GetNeighbourhood(TArrayI* &rowArray, TArrayI* &padArray, Int_
       if (pmin  < 0 ) pmin = 0; // if the window is bigger than the ROC
     }
     for (Int_t p = pmin; p <= pmax; p++) {
-      (*rowArray)[i] = r;
-      (*padArray)[i] = p;
+      rowArrayTemp[i] = r;
+      padArrayTemp[i] = p;
       i++;
     }
   }
   for (Int_t j = i; j < rowArray->GetSize(); j++){  // unused padArray-entries, in the case that the window is bigger than the ROC
     //std::cout << "trying to write -1" << std::endl;
-    (*rowArray)[j] = -1;
-    (*padArray)[j] = -1;
+    rowArrayTemp[j] = -1;
+    padArrayTemp[j] = -1;
     //std::cout << "writing -1" << std::endl;
-  }
+  } 
 }
 
 
@@ -722,7 +571,7 @@ void AliTPCCalROC::GlobalFit(const AliTPCCalROC* ROCoutliers, Bool_t robust, TVe
 	xx[3] = dlx*dlx;
 	xx[4] = dly*dly;
 	xx[5] = dlx*dly;
-	if (!ROCoutliers || ROCoutliers->GetValue(irow, ipad) != 1) {
+	if (ROCoutliers && ROCoutliers->GetValue(irow, ipad) != 1) {
            npoints++;
 	   fitterG->AddPoint(xx, GetValue(irow, ipad), 1);  
         }
@@ -741,7 +590,7 @@ void AliTPCCalROC::GlobalFit(const AliTPCCalROC* ROCoutliers, Bool_t robust, TVe
 	xx[0] = 1;
 	xx[1] = dlx;
 	xx[2] = dly;
-	if (!ROCoutliers || ROCoutliers->GetValue(irow, ipad) != 1) {
+	if (ROCoutliers && ROCoutliers->GetValue(irow, ipad) != 1) {
            npoints++;
 	   fitterG->AddPoint(xx, GetValue(irow, ipad), 1);  
         }
diff --git a/TPC/AliTPCCalROC.h b/TPC/AliTPCCalROC.h
index c6338681b79..2939c767090 100644
--- a/TPC/AliTPCCalROC.h
+++ b/TPC/AliTPCCalROC.h
@@ -46,10 +46,10 @@ class AliTPCCalROC : public TObject {
   void Divide(const AliTPCCalROC * roc);   
   // statistic
   //
-  Double_t GetMean(AliTPCCalROC* outlierROC = 0);
-  Double_t GetRMS(AliTPCCalROC* outlierROC = 0);
-  Double_t GetMedian(AliTPCCalROC* outlierROC = 0) ;
-  Double_t GetLTM(Double_t *sigma=0, Double_t fraction=0.9, AliTPCCalROC* outlierROC = 0);
+  Double_t GetMean(){return TMath::Mean(fNChannels, fData);}
+  Double_t GetRMS() {return TMath::RMS(fNChannels, fData);}
+  Double_t GetMedian() {return TMath::Median(fNChannels, fData);}
+  Double_t GetLTM(Double_t *sigma=0, Double_t fraction=0.9);
   TH1F * MakeHisto1D(Float_t min=4, Float_t max=-4, Int_t type=0);     
   TH2F * MakeHisto2D(Float_t min=4, Float_t max=-4, Int_t type=0);   
   TH2F * MakeHistoOutliers(Float_t delta=4, Float_t fraction=0.7, Int_t mode=0);
diff --git a/TPC/AliTPCCalibPedestal.cxx b/TPC/AliTPCCalibPedestal.cxx
index a39a7358cf4..43edb868659 100644
--- a/TPC/AliTPCCalibPedestal.cxx
+++ b/TPC/AliTPCCalibPedestal.cxx
@@ -25,59 +25,38 @@
 
 /* $Id$ */
 
-/*
- example: fill pedestal with gausschen noise
- AliTPCCalibPedestal ped;
- ped.TestEvent();
- ped.Analyse();
- //Draw output;
- TCanvas* c1 = new TCanvas;
- c1->Divide(1,2);
- c1->cd(1);
- ped.GetHistoPedestal(0)->SetEntries(1); //needed in order for colz to work, reason: fast filling does not increase the entries counter
- ped.GetHistoPedestal(0)->Draw("colz");
- c1->cd(2);
- ped.GetHistoPedestal(36)->SetEntries(1); //needed in order for colz to work, reason: fast filling does not increase the entries counter
- ped.GetHistoPedestal(36)->Draw("colz");
- TCanvas* c2 = new TCanvas;
- c2->Divide(2,2);
- c2->cd(1);
- ped.GetCalRocPedestal(0)->Draw("colz");
- c2->cd(2);
- ped.GetCalRocRMS(0)->Draw("colz");
- c2->cd(3);
- ped.GetCalRocPedestal(36)->Draw("colz");
- c2->cd(4);
- ped.GetCalRocRMS(36)->Draw("colz");
-
-
-*/
+
 
 //Root includes
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
+
+
 //AliRoot includes
 #include "AliRawReader.h"
 #include "AliRawReaderRoot.h"
-#include "AliRawReaderDate.h"
 #include "AliTPCRawStream.h"
 #include "AliTPCCalROC.h"
+#include "AliTPCCalPad.h"
 #include "AliTPCROC.h"
+#include "AliTPCCalibPedestal.h"
 #include "AliMathBase.h"
-#include "TTreeStream.h"
 
-//date
-#include "event.h"
+#include "TTreeStream.h"
 
-//header file
-#include "AliTPCCalibPedestal.h"
 
 
 ClassImp(AliTPCCalibPedestal) /*FOLD00*/
@@ -97,60 +76,27 @@ AliTPCCalibPedestal::AliTPCCalibPedestal() : /*FOLD00*/
   fROC(AliTPCROC::Instance()),
   fCalRocArrayPedestal(72),
   fCalRocArrayRMS(72),
-  fHistoPedestalArray(72)
-{
-    //
-    // default constructor
-    //
-}
-//_____________________________________________________________________
-AliTPCCalibPedestal::AliTPCCalibPedestal(const AliTPCCalibPedestal &ped) : /*FOLD00*/
-  TObject(ped),
-  fFirstTimeBin(ped.GetFirstTimeBin()),
-  fLastTimeBin(ped.GetLastTimeBin()),
-  fAdcMin(ped.GetAdcMin()),
-  fAdcMax(ped.GetAdcMax()),
-  fROC(AliTPCROC::Instance()),
-  fCalRocArrayPedestal(72),
-  fCalRocArrayRMS(72),
-  fHistoPedestalArray(72)
+  fHistoPedestalArray(72),
+  fDebugStreamer(0),
+  fDebugLevel(0)
 {
     //
-    // copy constructor
+    // AliTPCSignal default constructor
     //
-    for (Int_t iSec = 0; iSec < 72; iSec++){
-	const AliTPCCalROC *calPed = (AliTPCCalROC*)ped.fCalRocArrayPedestal.UncheckedAt(iSec);
-	const AliTPCCalROC *calRMS = (AliTPCCalROC*)ped.fCalRocArrayRMS.UncheckedAt(iSec);
-	const TH2F         *hPed   = (TH2F*)ped.fHistoPedestalArray.UncheckedAt(iSec);
-
-	if ( calPed != 0x0 ) fCalRocArrayPedestal.AddAt(new AliTPCCalROC(*calPed), iSec);
-	if ( calRMS != 0x0 ) fCalRocArrayRMS.AddAt(new AliTPCCalROC(*calRMS), iSec);
-
-	if ( hPed != 0x0 ){
-	    TH2F *hNew = new TH2F(*hPed);
-	    hNew->SetDirectory(0);
-	    fHistoPedestalArray.AddAt(hNew,iSec);
-	}
-    }
+    //debug stream
+    TDirectory *backup = gDirectory;
+    fDebugStreamer = new TTreeSRedirector("deb2.root");
+    if ( backup ) backup->cd();  //we don't want to be cd'd to the debug streamer    
 }
-//_____________________________________________________________________
-AliTPCCalibPedestal& AliTPCCalibPedestal::operator = (const  AliTPCCalibPedestal &source)
-{
-  //
-  // assignment operator
-  //
-  if (&source == this) return *this;
-  new (this) AliTPCCalibPedestal(source);
 
-  return *this;
-}
 //_____________________________________________________________________
 AliTPCCalibPedestal::~AliTPCCalibPedestal() /*FOLD00*/
 {
   //
   // destructor
   //
-  delete fROC;
+    if ( fDebugStreamer ) delete fDebugStreamer;
+    delete fROC;
 }
 
 
@@ -170,73 +116,55 @@ Int_t AliTPCCalibPedestal::Update(const Int_t icsector, /*FOLD00*/
 
     Int_t iChannel  = fROC->GetRowIndexes(icsector)[icRow]+icPad; //  global pad position in sector
 
-    // fast filling methode.
+    // dirty and fast filling methode. No boundary checking!!!
     // Attention: the entry counter of the histogram is not increased
     //            this means that e.g. the colz draw option gives an empty plot
-    Int_t bin = 0;
-    if ( !(((Int_t)csignal>fAdcMax ) || ((Int_t)csignalGetArray()[bin]++;
 
     return 0;
 }
 //_____________________________________________________________________
-Bool_t AliTPCCalibPedestal::ProcessEvent(AliTPCRawStream *rawStream)
+Bool_t AliTPCCalibPedestal::ProcessEvent(AliRawReader *rawReader) /*FOLD00*/
 {
   //
-  // Event Processing loop - AliTPCRawStream
+  //  simple event processing loop
   //
 
-  rawStream->SetOldRCUFormat(1);
+
+    AliTPCRawStream input(rawReader);
+
+  rawReader->Select("TPC");
+
+  input.SetOldRCUFormat(1);
+  printf("start event processing\n");
+
 
   Bool_t withInput = kFALSE;
 
-  while (rawStream->Next()) {
+  while (input.Next()) {
 
-      Int_t isector  = rawStream->GetSector();                       //  current sector
-      Int_t iRow     = rawStream->GetRow();                          //  current row
-      Int_t iPad     = rawStream->GetPad();                          //  current pad
-      Int_t iTimeBin = rawStream->GetTime();                         //  current time bin
-      Float_t signal = rawStream->GetSignal();                       //  current ADC signal
+      Int_t isector  = input.GetSector();                       //  current sector
+      Int_t iRow     = input.GetRow();                          //  current row
+      Int_t iPad     = input.GetPad();                          //  current pad
+      Int_t iTimeBin = input.GetTime();                         //  current time bin
+      Float_t signal = input.GetSignal();                       //  current ADC signal
 
       Update(isector,iRow,iPad,iTimeBin,signal);
       withInput = kTRUE;
   }
 
+  printf("end event processing\n");
+  if ( fDebugLevel>0 )
+      fDebugStreamer->GetFile()->Write();
   return withInput;
 }
 //_____________________________________________________________________
-Bool_t AliTPCCalibPedestal::ProcessEvent(AliRawReader *rawReader)
-{
-  //
-  //  Event processing loop - AliRawReader
-  //
-
-
-  AliTPCRawStream rawStream(rawReader);
-
-  rawReader->Select("TPC");
-
-  return ProcessEvent(&rawStream);
-}
-//_____________________________________________________________________
-Bool_t AliTPCCalibPedestal::ProcessEvent(eventHeaderStruct *event)
-{
-  //
-  //  process date event
-  //
-    AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-    Bool_t result=ProcessEvent(rawReader);
-    delete rawReader;
-    return result;
-}
-//_____________________________________________________________________
 Bool_t AliTPCCalibPedestal::TestEvent() /*FOLD00*/
 {
   //
   //  Test event loop
-  // fill one oroc and one iroc with random gaus
   //
 
     gRandom->SetSeed(0);
@@ -246,7 +174,7 @@ Bool_t AliTPCCalibPedestal::TestEvent() /*FOLD00*/
 	for (UInt_t iRow=0; iRow < fROC->GetNRows(iSec); iRow++){
 	    for (UInt_t iPad=0; iPad < fROC->GetNPads(iSec,iRow); iPad++){
 		for (UInt_t iTimeBin=0; iTimeBin<1024; iTimeBin++){
-		    Float_t signal=(Int_t)(iRow+3+gRandom->Gaus(0,.7));
+		    Float_t signal=(Int_t)(iRow+5+gRandom->Gaus(0,.7));
 		    if ( signal>0 )Update(iSec,iRow,iPad,iTimeBin,signal);
 		}
 	    }
@@ -255,7 +183,7 @@ Bool_t AliTPCCalibPedestal::TestEvent() /*FOLD00*/
     return kTRUE;
 }
 //_____________________________________________________________________
-TH2F* AliTPCCalibPedestal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
+TH2S* AliTPCCalibPedestal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
 				  Int_t nbinsY, Float_t ymin, Float_t ymax,
 				  Char_t *type, Bool_t force)
 {
@@ -264,16 +192,16 @@ TH2F* AliTPCCalibPedestal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
     // if force is true create a new histogram if it doesn't exist allready
     //
     if ( !force || arr->UncheckedAt(sector) )
-	return (TH2F*)arr->UncheckedAt(sector);
+	return (TH2S*)arr->UncheckedAt(sector);
 
     // if we are forced and histogram doesn't yes exist create it
     Char_t name[255], title[255];
 
     sprintf(name,"hCalib%s%.2d",type,sector);
-    sprintf(title,"%s calibration histogram sector %.2d;ADC channel;Channel (pad)",type,sector);
+    sprintf(title,"%s calibration histogram sector %.2d",type,sector);
 
     // new histogram with Q calib information. One value for each pad!
-    TH2F* hist = new TH2F(name,title,
+    TH2S* hist = new TH2S(name,title,
 			  nbinsY, ymin, ymax,
 			  fROC->GetNChannels(sector),0,fROC->GetNChannels(sector)
 			 );
@@ -282,7 +210,7 @@ TH2F* AliTPCCalibPedestal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
     return hist;
 }
 //_____________________________________________________________________
-TH2F* AliTPCCalibPedestal::GetHistoPedestal(Int_t sector, Bool_t force) /*FOLD00*/
+TH2S* AliTPCCalibPedestal::GetHistoPedestal(Int_t sector, Bool_t force) /*FOLD00*/
 {
     //
     // return pointer to T0 histogram
@@ -341,14 +269,17 @@ void AliTPCCalibPedestal::Analyse() /*FOLD00*/
 
     Int_t nbinsAdc = fAdcMax-fAdcMin;
 
+    TH1F *py = new TH1F("htemp_py","htemp_py", nbinsAdc, fAdcMin, fAdcMax);
+    TF1 *gaus = new TF1("fit","gaus");
     TVectorD param(3);
-    TMatrixD dummy(3,3);
 
-    Float_t *array_hP=0;
+    Float_t *array_py=0;
+    Short_t *array_hP=0;
 
+    array_py = py->GetArray();
 
     for (Int_t iSec=0; iSec<72; iSec++){
-	TH2F *hP = GetHistoPedestal(iSec);
+	TH2S *hP = GetHistoPedestal(iSec);
         if ( !hP ) continue;
 
 	AliTPCCalROC *rocPedestal = GetCalRocPedestal(iSec,kTRUE);
@@ -358,17 +289,26 @@ void AliTPCCalibPedestal::Analyse() /*FOLD00*/
         UInt_t nChannels = fROC->GetNChannels(iSec);
 
 	for (UInt_t iChannel=0; iChannelSetValue(iChannel,param[1]);
-            rocRMS->SetValue(iChannel,param[2]);
+
+            // set bin content of py in a dirty but fast way
+	    for (Int_t iAdc=0;iAdcSetParameters(0,0);
+	    py->Fit(gaus,"nq");
+
+	    rocPedestal->SetValue(iChannel,gaus->GetParameter(1));
+            rocRMS->SetValue(iChannel,gaus->GetParameter(2));
+
+	    //AliMathBase::FitGaus(nbinsAdc,array_hP+(iChannel+1)*(nbinsAdc+2),¶m)
+	    //rocPedestal->SetValue(iChannel,param[1]);
+            //rocRMS->SetValue(iChannel,param[2]);
 	}
     }
+    delete py;
+    delete gaus;
+    delete fDebugStreamer;
+    fDebugStreamer = 0x0;
 }
 //_____________________________________________________________________
 void AliTPCCalibPedestal::DumpToFile(const Char_t *filename, const Char_t *dir, Bool_t append) /*FOLD00*/
@@ -377,6 +317,7 @@ void AliTPCCalibPedestal::DumpToFile(const Char_t *filename, const Char_t *dir,
     //  Write class to file
     //
 
+    TDirectory *backup = gDirectory;
     TString sDir(dir);
     TString option;
 
@@ -385,15 +326,14 @@ void AliTPCCalibPedestal::DumpToFile(const Char_t *filename, const Char_t *dir,
     else
         option = "recreate";
 
-    TDirectory *backup = gDirectory;
     TFile f(filename,option.Data());
-    f.cd();
     if ( !sDir.IsNull() ){
 	f.mkdir(sDir.Data());
 	f.cd(sDir);
     }
-    this->Write();
+    gDirectory->WriteTObject(this);
     f.Close();
 
     if ( backup ) backup->cd();
+
 }
diff --git a/TPC/AliTPCCalibPedestal.h b/TPC/AliTPCCalibPedestal.h
index 4ab27cbc7f3..e0302884b98 100644
--- a/TPC/AliTPCCalibPedestal.h
+++ b/TPC/AliTPCCalibPedestal.h
@@ -9,45 +9,37 @@
 
 class TObjArray;
 class TH2F;
+class TH2S;
+class TH1S;
+class TH1F;
+class TH1D;
+class TF1;
 class TTreeSRedirector;
 class AliTPCROC;
-class AliTPCCalROC;
 class AliRawReader;
-struct eventHeaderStruct;
 
 
 class AliTPCCalibPedestal : public TObject {
 
 public:
   AliTPCCalibPedestal();
-  AliTPCCalibPedestal(const AliTPCCalibPedestal &ped);
   virtual ~AliTPCCalibPedestal();
-
-  AliTPCCalibPedestal& operator = (const  AliTPCCalibPedestal &source);
-
-  Bool_t ProcessEvent(AliTPCRawStream *rawStream);
-  Bool_t ProcessEvent(AliRawReader    *rawReader);
-  Bool_t ProcessEvent(eventHeaderStruct   *event);
-
+  
+  Bool_t ProcessEvent(AliRawReader *rawReader); 
   Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
 	       const Int_t iTimeBin, const Float_t signal);
   void Analyse();
   //
-  AliTPCCalROC* GetCalRocPedestal (Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
-  AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE);        // get calibration object - sector
-  const TObjArray* GetCalPadPedestal (){return &fCalRocArrayPedestal;}  // get calibration object
-  const TObjArray* GetCalPadRMS(){return &fCalRocArrayRMS;}             // get calibration object
+  AliTPCCalROC* GetCalRocPedestal (Int_t sector, Bool_t force=kFALSE);  //get calibration object - sector
+  AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE);        //get calibration object - sector
+  const TObjArray* GetCalPadPedestal (){return &fCalRocArrayPedestal;}//get calibration object
+  const TObjArray* GetCalPadRMS(){return &fCalRocArrayRMS;}           //get calibration object
   
-  TH2F* GetHistoPedestal  (Int_t sector, Bool_t force=kFALSE);          // get refernce histogram
-  void  DumpToFile(const Char_t *filename, const Char_t *dir="", const Bool_t append=kFALSE);
+  TH2S* GetHistoPedestal  (Int_t sector, Bool_t force=kFALSE);          //get refernce histogram
+  void DumpToFile(const Char_t *filename, const Char_t *dir="", const Bool_t append=kFALSE);
   //
-  Int_t   GetFirstTimeBin() const { return fFirstTimeBin; }
-  Int_t   GetLastTimeBin()  const { return fLastTimeBin;  }
-  Int_t   GetAdcMin()       const { return fAdcMin;       }
-  Int_t   GetAdcMax()       const { return fAdcMax;       }
-
-  void    SetRangeTime(Int_t tMin, Int_t tMax){ fFirstTimeBin=tMin; fLastTimeBin=tMax; }  // Set time bin range that is used for the pedestal calibration
-  void    SetRangeAdc (Int_t aMin, Int_t aMax){ fAdcMin=aMin; fAdcMax=aMax; }  // Set adc range for the pedestal calibration
+  Short_t GetDebugLevel(){ return fDebugLevel; }
+  void    SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
 
 
   Bool_t TestEvent();  //test the fast approach to fill histogram  - used for test purposes
@@ -66,9 +58,12 @@ class AliTPCCalibPedestal : public TObject {
   
   TObjArray fHistoPedestalArray;    //  Calibration histograms for Pedestal distribution
   
+  TTreeSRedirector *fDebugStreamer;  //! debug streamer
   
+  Short_t fDebugLevel;
+  //! debugging
   
-  TH2F* GetHisto(Int_t sector, TObjArray *arr,
+  TH2S* GetHisto(Int_t sector, TObjArray *arr,
 		 Int_t nbinsY, Float_t ymin, Float_t ymax,
 		 Char_t *type, Bool_t force);
     
diff --git a/TPC/AliTPCCalibSignal.cxx b/TPC/AliTPCCalibSignal.cxx
index 233dee9da54..0f4c59caa2b 100644
--- a/TPC/AliTPCCalibSignal.cxx
+++ b/TPC/AliTPCCalibSignal.cxx
@@ -33,11 +33,19 @@
 //Root includes
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
+
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -45,7 +53,6 @@
 //AliRoot includes
 #include "AliRawReader.h"
 #include "AliRawReaderRoot.h"
-#include "AliRawReaderDate.h"
 #include "AliTPCRawStream.h"
 #include "AliTPCCalROC.h"
 #include "AliTPCCalPad.h"
@@ -53,11 +60,8 @@
 #include "AliTPCParam.h"
 #include "AliTPCCalibSignal.h"
 #include "AliTPCcalibDB.h"
-#include "AliMathBase.h"
-#include "TTreeStream.h"
 
-//date
-#include "event.h"
+#include "TTreeStream.h"
 ClassImp(AliTPCCalibSignal) /*FOLD00*/
 
 AliTPCCalibSignal::AliTPCCalibSignal() : /*FOLD00*/
@@ -66,19 +70,10 @@ AliTPCCalibSignal::AliTPCCalibSignal() : /*FOLD00*/
     fLastTimeBin(120),
     fFirstTimeBinT0(-15),
     fLastTimeBinT0(15),
-    fNbinsT0(200),
-    fXminT0(-2),
-    fXmaxT0(2),
-    fNbinsQ(200),
-    fXminQ(14),
-    fXmaxQ(55),
-    fNbinsRMS(100),
-    fXminRMS(0),
-    fXmaxRMS(5),
     fLastSector(-1),
     fROC(AliTPCROC::Instance()),
     fParam(new AliTPCParam),
-    fPedestalTPC(0x0),
+    fPedestalTPC(0),
     fBpedestal(kFALSE),
     fCalRocArrayT0(72),
     fCalRocArrayQ(72),
@@ -107,6 +102,11 @@ AliTPCCalibSignal::AliTPCCalibSignal() : /*FOLD00*/
     // AliTPCSignal default constructor
     //
 
+    //debug stream
+    TDirectory *backup = gDirectory;
+    fDebugStreamer = new TTreeSRedirector("deb2.root");
+    if ( backup ) backup->cd();  //we don't want to be cd'd to the debug streamer
+    
 }
 //_____________________________________________________________________
 AliTPCCalibSignal::AliTPCCalibSignal(const AliTPCCalibSignal &sig) :
@@ -115,15 +115,6 @@ AliTPCCalibSignal::AliTPCCalibSignal(const AliTPCCalibSignal &sig) :
     fLastTimeBin(sig.fLastTimeBin),
     fFirstTimeBinT0(sig.fFirstTimeBinT0),
     fLastTimeBinT0(sig.fLastTimeBinT0),
-    fNbinsT0(sig.fNbinsT0),
-    fXminT0(sig.fXminT0),
-    fXmaxT0(sig.fXmaxT0),
-    fNbinsQ(sig.fNbinsQ),
-    fXminQ(sig.fXminQ),
-    fXmaxQ(sig.fXmaxQ),
-    fNbinsRMS(sig.fNbinsRMS),
-    fXminRMS(sig.fXminRMS),
-    fXmaxRMS(sig.fXmaxRMS),
     fLastSector(-1),
     fROC(AliTPCROC::Instance()),
     fParam(new AliTPCParam),
@@ -188,6 +179,12 @@ AliTPCCalibSignal::AliTPCCalibSignal(const AliTPCCalibSignal &sig) :
 	}
     }
 
+
+    //debug stream
+    TDirectory *backup = gDirectory;
+    fDebugStreamer = new TTreeSRedirector("deb2.root");
+    if ( backup ) backup->cd();  //we don't want to be cd'd to the debug streamer
+    
 }
 //_____________________________________________________________________
 AliTPCCalibSignal& AliTPCCalibSignal::operator = (const  AliTPCCalibSignal &source)
@@ -255,6 +252,10 @@ Int_t AliTPCCalibSignal::Update(const Int_t icsector, /*FOLD00*/
         fCurrentRow     = icRow;
     }
 
+    if ( fDebugLevel > 6 )
+        if ( icTimeBin == fLastTimeBin )
+	    printf("Filling sector: %d, channel: %d\n",icsector,iChannel);
+
     //fill signals for current pad
     fPadSignal[icTimeBin]=csignal;
     if ( csignal > fMaxPadSignal ){
@@ -269,6 +270,8 @@ void AliTPCCalibSignal::ProcessPad() /*FOLD00*/
     //
     //  Process data of current pad
     //
+    if ( fDebugLevel > 4 )
+	printf("process: sector-pad: %.2d-%.4d ... ", fCurrentSector, fCurrentChannel);
 
     Float_t pedestal = 0;
 
@@ -286,6 +289,8 @@ void AliTPCCalibSignal::ProcessPad() /*FOLD00*/
 	pedestal = pedestalROC->GetValue(fCurrentChannel);
 
     } else {
+	if ( fDebugLevel > 4 )
+	    printf("pedestals ... ");
 
 	//find pedestal for pad on the fly
         //using a few timebins before the signal
@@ -300,6 +305,8 @@ void AliTPCCalibSignal::ProcessPad() /*FOLD00*/
 	}
 
 	if ( sumN>0 ) pedestal/=sumN;
+	if ( fDebugLevel > 4 )
+	    printf("%.2f ... ",pedestal);
     }
 
 
@@ -309,9 +316,11 @@ void AliTPCCalibSignal::ProcessPad() /*FOLD00*/
     Int_t tminus = 2, tplus=7;
     Double_t meanT=0, sigmaT=0, Qsum=0;
 
+    if ( fDebugLevel > 4 )
+	printf(" mean +- sigma (sum) ... ");
 
     for (Int_t i=fMaxTimeBin-tminus; i=fFirstTimeBin && i<=fLastTimeBin ){
+	if ( i>fFirstTimeBin && i 4 )
+	printf("%.3f +- %.3f (%.3f) ... ",meanT,sigmaT,Qsum);
+
+
+    if ( fDebugLevel > 4 )
+	printf("filling ... ");
+
+
     //Fill Event T0 counter
     (*GetPadTimesEvent(fCurrentSector,kTRUE))[fCurrentChannel] = meanT;
 
@@ -347,11 +364,13 @@ void AliTPCCalibSignal::ProcessPad() /*FOLD00*/
     Float_t norm = fParam->GetPadPitchWidth(0)*fParam->GetPadPitchLength(0,0)/(
 	fParam->GetPadPitchWidth(fCurrentSector)*fParam->GetPadPitchLength(fCurrentSector,fCurrentRow));
 
+//    if (fCurrentChannel == 0) printf("sec, norm: %d, %f\n", fCurrentSector, norm);
+
     //Fill Q histogram
-    GetHistoQ(fCurrentSector,kTRUE)->Fill( TMath::Sqrt(Qsum*norm), fCurrentChannel );
+    GetHistoQ(fCurrentSector,kTRUE)->Fill(fCurrentChannel, TMath::Sqrt(Qsum*norm));
 
     //Fill RMS histogram
-    GetHistoRMS(fCurrentSector,kTRUE)->Fill( sigmaT, fCurrentChannel );
+    GetHistoRMS(fCurrentSector,kTRUE)->Fill(fCurrentChannel, sigmaT);
 
 
     //Fill debugging info
@@ -361,7 +380,13 @@ void AliTPCCalibSignal::ProcessPad() /*FOLD00*/
 	(*GetPadQEvent(fCurrentSector,kTRUE))[fCurrentChannel]=Qsum;
     }
 
+    if ( fDebugLevel > 4 )
+	printf("reset pad ...");
+
     ResetPad();
+
+    if ( fDebugLevel > 4 )
+	printf("end\n");
 }
 //_____________________________________________________________________
 void AliTPCCalibSignal::EndEvent() /*FOLD00*/
@@ -369,10 +394,7 @@ void AliTPCCalibSignal::EndEvent() /*FOLD00*/
     //
     //  Process data of current pad
     //
-    //check if last pad has allready been processed, if not do so
-    if ( fMaxTimeBin>-1 ) ProcessPad();
-
-    //loop over all ROCs, fill Time0 histogram corrected for the mean Time0 of each ROC
+    printf("end event\n");
     for ( Int_t iSec = 0; iSec<72; iSec++ ){
 	TVectorF *vTimes = GetPadTimesEvent(iSec);
         if ( !vTimes ) continue;
@@ -381,18 +403,11 @@ void AliTPCCalibSignal::EndEvent() /*FOLD00*/
 	    Float_t Time0 = fVTime0Offset1[iSec]/fVTime0Offset1Counter[iSec];
 	    Float_t Time  = (*vTimes)[iChannel];
 
-            GetHistoT0(iSec,kTRUE)->Fill( Time-Time0,iChannel );
+            GetHistoT0(iSec,kTRUE)->Fill(iChannel,Time-Time0);
 
 
 	    //Debug start
 	    if ( fDebugLevel>0 ){
-		if ( !fDebugStreamer ) {
-                        //debug stream
-		    TDirectory *backup = gDirectory;
-		    fDebugStreamer = new TTreeSRedirector("deb2.root");
-		    if ( backup ) backup->cd();  //we don't want to be cd'd to the debug streamer
-		}
-
 		Int_t row=0;
 		Int_t pad=0;
 		Int_t padc=0;
@@ -439,63 +454,47 @@ void AliTPCCalibSignal::EndEvent() /*FOLD00*/
 
 }
 //_____________________________________________________________________
-Bool_t AliTPCCalibSignal::ProcessEvent(AliTPCRawStream *rawStream) /*FOLD00*/
+Bool_t AliTPCCalibSignal::ProcessEvent(AliRawReader *rawReader) /*FOLD00*/
 {
   //
-  // Event Processing loop - AliTPCRawStream
   //
+  //
+
 
-  rawStream->SetOldRCUFormat(1);
+    AliTPCRawStream input(rawReader);
+
+  rawReader->Select("TPC");
+
+  input.SetOldRCUFormat(1);
+  printf("start event processing\n");
 
   ResetEvent();
 
   Bool_t withInput = kFALSE;
 
-  while (rawStream->Next()) {
+  while (input.Next()) {
 
-      Int_t isector  = rawStream->GetSector();                       //  current sector
-      Int_t iRow     = rawStream->GetRow();                          //  current row
-      Int_t iPad     = rawStream->GetPad();                          //  current pad
-      Int_t iTimeBin = rawStream->GetTime();                         //  current time bin
-      Float_t signal = rawStream->GetSignal();                       //  current ADC signal
+      Int_t isector  = input.GetSector();                       //  current sector
+      Int_t iRow     = input.GetRow();                          //  current row
+      Int_t iPad     = input.GetPad();                          //  current pad
+      Int_t iTimeBin = input.GetTime();                         //  current time bin
+      Float_t signal = input.GetSignal();                       //  current ADC signal
 
       Update(isector,iRow,iPad,iTimeBin,signal);
       withInput = kTRUE;
   }
 
   if (withInput){
+      ProcessPad();
       EndEvent();
   }
 
+  printf("end event processing\n");
+  if ( fDebugLevel>0 )
+      fDebugStreamer->GetFile()->Write();
   return withInput;
 }
 //_____________________________________________________________________
-Bool_t AliTPCCalibSignal::ProcessEvent(AliRawReader *rawReader)
-{
-  //
-  //  Event processing loop - AliRawReader
-  //
-
-
-  AliTPCRawStream rawStream(rawReader);
-
-  rawReader->Select("TPC");
-
-  return ProcessEvent(&rawStream);
-}
-//_____________________________________________________________________
-Bool_t AliTPCCalibSignal::ProcessEvent(eventHeaderStruct *event)
-{
-  //
-  //  Event processing loop - date event
-  //
-    AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-    Bool_t result=ProcessEvent(rawReader);
-    delete rawReader;
-    return result;
-
-}
-//_____________________________________________________________________
 TH2S* AliTPCCalibSignal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
 				  Int_t nbinsY, Float_t ymin, Float_t ymax,
 				  Char_t *type, Bool_t force)
@@ -515,8 +514,8 @@ TH2S* AliTPCCalibSignal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
 
     // new histogram with Q calib information. One value for each pad!
     TH2S* hist = new TH2S(name,title,
-			  nbinsY, ymin, ymax,
-			  fROC->GetNChannels(sector),0,fROC->GetNChannels(sector));
+			  fROC->GetNChannels(sector),0,fROC->GetNChannels(sector),
+			  nbinsY, ymin, ymax);
     hist->SetDirectory(0);
     arr->AddAt(hist,sector);
     return hist;
@@ -529,7 +528,7 @@ TH2S* AliTPCCalibSignal::GetHistoT0(Int_t sector, Bool_t force) /*FOLD00*/
     // if force is true create a new histogram if it doesn't exist allready
     //
     TObjArray *arr = &fHistoT0Array;
-    return GetHisto(sector, arr, fNbinsT0, fXminT0, fXmaxT0, "T0", force);
+    return GetHisto(sector, arr, 200, -2, 2, "T0", force);
 }
 //_____________________________________________________________________
 TH2S* AliTPCCalibSignal::GetHistoQ(Int_t sector, Bool_t force) /*FOLD00*/
@@ -539,7 +538,7 @@ TH2S* AliTPCCalibSignal::GetHistoQ(Int_t sector, Bool_t force) /*FOLD00*/
     // if force is true create a new histogram if it doesn't exist allready
     //
     TObjArray *arr = &fHistoQArray;
-    return GetHisto(sector, arr, fNbinsQ, fXminQ, fXmaxQ, "Q", force);
+    return GetHisto(sector, arr, 150, 24, 55, "Q", force);
 }
 //_____________________________________________________________________
 TH2S* AliTPCCalibSignal::GetHistoRMS(Int_t sector, Bool_t force) /*FOLD00*/
@@ -549,7 +548,7 @@ TH2S* AliTPCCalibSignal::GetHistoRMS(Int_t sector, Bool_t force) /*FOLD00*/
     // if force is true create a new histogram if it doesn't exist allready
     //
     TObjArray *arr = &fHistoRMSArray;
-    return GetHisto(sector, arr, fNbinsRMS, fXminRMS, fXmaxRMS, "RMS", force);
+    return GetHisto(sector, arr, 100, 0, 5, "RMS", force);
 }
 //_____________________________________________________________________
 TVectorF* AliTPCCalibSignal::GetPadInfoEvent(Int_t sector, TObjArray *arr, Bool_t force) /*FOLD00*/
@@ -711,10 +710,6 @@ void AliTPCCalibSignal::Analyse() /*FOLD00*/
     //  Calculate calibration constants
     //
 
-    TVectorD paramQ(3);
-    TVectorD paramT0(3);
-    TVectorD paramRMS(3);
-    TMatrixD dummy(3,3);
 
     for (Int_t iSec=0; iSec<72; iSec++){
 	TH2S *hT0 = GetHistoT0(iSec);
@@ -728,19 +723,13 @@ void AliTPCCalibSignal::Analyse() /*FOLD00*/
 	TH2S *hQ   = GetHistoQ(iSec);
 	TH2S *hRMS = GetHistoRMS(iSec);
 
-	Short_t *array_hQ   = hQ->GetArray();
-	Short_t *array_hT0  = hT0->GetArray();
-	Short_t *array_hRMS = hRMS->GetArray();
-
-        UInt_t nChannels = fROC->GetNChannels(iSec);
-
 	//debug
 	Int_t row=0;
 	Int_t pad=0;
 	Int_t padc=0;
 	//! debug
 
-	for (UInt_t iChannel=0; iChannelGetNChannels(iSec); iChannel++){
 
 
 	    Float_t cogTime0 = -1000;
@@ -748,26 +737,14 @@ void AliTPCCalibSignal::Analyse() /*FOLD00*/
 	    Float_t cogRMS   = -1000;
             Float_t cogOut   = 0;
 
+	    hQ->SetAxisRange(iChannel,iChannel);
+	    hT0->SetAxisRange(iChannel,iChannel);
+	    hRMS->SetAxisRange(iChannel,iChannel);
 
-	    Int_t offsetQ = (fNbinsQ+2)*(iChannel+1)+1;
-	    Int_t offsetT0 = (fNbinsT0+2)*(iChannel+1)+1;
-	    Int_t offsetRMS = (fNbinsRMS+2)*(iChannel+1)+1;
-
+	    cogTime0 = hT0->GetMean(2);
+	    cogQ     = hQ->GetMean(2);
+	    cogRMS   = hRMS->GetMean(2);
 /*
-	    AliMathBase::FitGaus(array_hQ+offsetQ,fNbinsQ,fXminQ,fXmaxQ,¶mQ,&dummy);
-	    AliMathBase::FitGaus(array_hT0+offsetT0,fNbinsT0,fXminT0,fXmaxT0,¶mT0,&dummy);
-            AliMathBase::FitGaus(array_hRMS+offsetRMS,fNbinsRMS,fXminRMS,fXmaxRMS,¶mRMS,&dummy);
-	    cogQ     = paramQ[1];
-	    cogTime0 = paramT0[1];
-	    cogRMS   = paramRMS[1];
-*/
-	    cogQ     = AliMathBase::GetCOG(array_hQ+offsetQ,fNbinsQ,fXminQ,fXmaxQ);
-	    cogTime0 = AliMathBase::GetCOG(array_hT0+offsetT0,fNbinsT0,fXminT0,fXmaxT0);
-            cogRMS   = AliMathBase::GetCOG(array_hRMS+offsetRMS,fNbinsRMS,fXminRMS,fXmaxRMS);
-
-
-
-	    /*
 	    if ( (cogQ < ??) && (cogTime0 > ??) && (cogTime0??) ){
 		cogOut = 1;
 		cogTime0 = 0;
@@ -783,13 +760,6 @@ void AliTPCCalibSignal::Analyse() /*FOLD00*/
 
 	    //debug
 	    if ( fDebugLevel > 0 ){
-		if ( !fDebugStreamer ) {
-                        //debug stream
-		    TDirectory *backup = gDirectory;
-		    fDebugStreamer = new TTreeSRedirector("deb2.root");
-		    if ( backup ) backup->cd();  //we don't want to be cd'd to the debug streamer
-		}
-
 		while ( iChannel > (fROC->GetRowIndexes(iSec)[row]+fROC->GetNPads(iSec,row)-1) ) row++;
 		pad = iChannel-fROC->GetRowIndexes(iSec)[row];
 		padc = pad-(fROC->GetNPads(iSec,row)/2);
@@ -820,6 +790,7 @@ void AliTPCCalibSignal::DumpToFile(const Char_t *filename, const Char_t *dir, Bo
     //  Write class to file
     //
 
+    TDirectory *backup = gDirectory;
     TString sDir(dir);
     TString option;
 
@@ -828,15 +799,14 @@ void AliTPCCalibSignal::DumpToFile(const Char_t *filename, const Char_t *dir, Bo
     else
         option = "recreate";
 
-    TDirectory *backup = gDirectory;
     TFile f(filename,option.Data());
-    f.cd();
     if ( !sDir.IsNull() ){
 	f.mkdir(sDir.Data());
 	f.cd(sDir);
     }
-    this->Write();
+    gDirectory->WriteTObject(this);
     f.Close();
 
     if ( backup ) backup->cd();
+
 }
diff --git a/TPC/AliTPCCalibSignal.h b/TPC/AliTPCCalibSignal.h
index b22f4059ef1..13020e7f7b5 100644
--- a/TPC/AliTPCCalibSignal.h
+++ b/TPC/AliTPCCalibSignal.h
@@ -3,17 +3,14 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-#include 
 class TObjArray;
 class TH2S;
 class TTreeSRedirector;
 class AliTPCCalPad;
 class AliTPCROC;
-class AliTPCCalROC;
 class AliTPCParam;
 class AliRawReader;
-class AliTPCRawStream;
-struct eventHeaderStruct;
+
 
 class AliTPCCalibSignal : public TObject {
 
@@ -25,9 +22,7 @@ class AliTPCCalibSignal : public TObject {
     AliTPCCalibSignal& operator = (const  AliTPCCalibSignal &source);
 
 
-    Bool_t ProcessEvent(AliTPCRawStream *rawStream);
-    Bool_t ProcessEvent(AliRawReader    *rawReader);
-    Bool_t ProcessEvent(eventHeaderStruct   *event);
+    Bool_t ProcessEvent(AliRawReader *rawReader);  //center of gravity approach event by event
 
     Int_t Update(const Int_t isector, const Int_t iRow, const Int_t iPad,
 	       const Int_t iTimeBin, const Float_t signal);
@@ -51,12 +46,6 @@ class AliTPCCalibSignal : public TObject {
     //
     void  SetRangeTime (Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBin=firstTimeBin;   fLastTimeBin=lastTimeBin;  } //Set range in which the pulser signal is expected
     void  SetRangeTime0(Int_t firstTimeBin, Int_t lastTimeBin) { fFirstTimeBinT0=firstTimeBin; fLastTimeBinT0=lastTimeBin;} //Set range for analysis after T0 substraction. Should be smaller than the above and around 0
-    //
-    void  SetRangeRefQ  (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsQ   = nBins; fXminQ   = xMin; fXmaxQ   = xMax; }   //Set range for Q reference histograms
-    void  SetRangeRefT0 (Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsT0  = nBins; fXminT0  = xMin; fXmaxT0  = xMax; }   //Set range for T0 reference histograms
-    void  SetRangeRefRMS(Int_t nBins, Float_t xMin, Float_t xMax){ fNbinsRMS = nBins; fXminRMS = xMin; fXmaxRMS = xMax; }   //Set range for T0 reference histograms
-
-
     void  SetDebugLevel(Short_t debug=1){ fDebugLevel = debug;}
 
     Int_t GetFirstTimeBin()   const { return fFirstTimeBin;  }
@@ -72,17 +61,6 @@ class AliTPCCalibSignal : public TObject {
     Int_t fFirstTimeBinT0;            //  First Time bin after T0 correction
     Int_t fLastTimeBinT0;             //  Last Time bin after T0 correction
 
-    // reference histogram ranges
-    Int_t   fNbinsT0;                 //  Number of bins for T0 reference histogram
-    Float_t fXminT0;                  //  xmin   of T0 reference histogram
-    Float_t fXmaxT0;                  //  xmax   of T0 reference histogram
-    Int_t   fNbinsQ;                  //  Number of bins for T0 reference histogram
-    Float_t fXminQ;                   //  xmin   of T0 reference histogram
-    Float_t fXmaxQ;                   //  xmax   of T0 reference histogram
-    Int_t   fNbinsRMS;                //  Number of bins for T0 reference histogram
-    Float_t fXminRMS;                 //  xmin   of T0 reference histogram
-    Float_t fXmaxRMS;                 //  xmax   of T0 reference histogram
-
     Int_t     fLastSector;            //! Last sector processed
 
     AliTPCROC   *fROC;                //! ROC information
diff --git a/TPC/AliTPCSensorTemp.cxx b/TPC/AliTPCSensorTemp.cxx
index a2074ed7ce5..f86aabb893f 100644
--- a/TPC/AliTPCSensorTemp.cxx
+++ b/TPC/AliTPCSensorTemp.cxx
@@ -33,95 +33,11 @@
  */
 //
 
-#include 
+
 #include "AliTPCSensorTemp.h"
 ClassImp(AliTPCSensorTemp)
 
 
-const Float_t kASideX[18][5]={
-        { 99.6,  117.7,  161.2,  187.3,  213.5},
-	{ 87.6,  103.7,  142.6,  165.6,  188.6},
-	{ 65.0,   77.3,  106.8,  123.8,  140.9},
-	{ 34.6,   41.5,   58.1,   67.2,   76.3},
-	{    0,    0.7,    2.4,    2.4,    2.4},
-	{-34.6,  -40.2,  -53.6,  -62.7,  -71.7},
-	{-65.0,  -76.2, -103.1, -120.2, -137.2},
-	{-87.6, -103.1, -140.2, -163.2, -186.2},
-	{-99.6, -117.5, -160.4, -186.5, -212.6},
-	{-99.6, -117.7, -161.2, -187.3, -213.5},
-	{-87.6, -103.7, -142.6, -165.6, -188.6},
-	{-65.0,  -77.3, -106.8, -123.8, -140.9},
-	{-34.6,  -41.5,  -58.1,  -67.2,  -76.3},
-	{    0,   -0.7,   -2.4,   -2.4,   -2.4},
-	{ 34.6,   40.2,   53.6,   62.7,   71.7},
-	{ 65.0,   76.2,  103.1,  120.2,  137.2},
-	{ 87.6,  103.1,  140.2,  163.2,  186.2},
-	{ 99.6,  117.5,  160.4,  186.5,  212.6}};
-	
-const Float_t kASideY[18][5]={
-        { 17.6,   20.1,   26.0,   30.6,   35.2},
-	{ 50.6,   59.1,   79.5,   92.8,  106.1},
-	{ 77.4,   91.0,  123.5,  143.9,  164.2},
-	{ 95.0,  112.0,  152.6,  177.5,  202.5},
-	{101.1,  119.4,  163.3,  189.8,  216.4},
-	{ 95.0,  112.4,  154.2,  179.2,  204.1},
-	{ 77.4,   91.9,  126.6,  146.9,  167.3},
-	{ 50.6,   60.3,   83.7,   97.0,  110.3},
-	{ 17.6,   21.4,   30.7,   35.3,   39.9},
-	{-17.6,  -20.1,  -26.0,  -30.6,  -35.2},
-	{-50.6,  -59.1,  -79.5,  -92.8, -106.1},
-	{-77.4,  -91.0, -123.5, -143.9, -164.2},
-	{-95.0, -112.0, -152.6, -177.5, -202.5},
-       {-101.1, -119.4, -163.3, -189.8, -216.4},
-        {-95.0, -112.4, -154.2, -179.2, -204.1},
-	{-77.4,  -91.9, -126.6, -146.9, -167.3},
-	{-50.6,  -60.3,  -83.7,  -97.0, -110.3},
-	{-17.6,  -21.4,  -30.7,  -35.3,  -39.9}};  
-	
-const Float_t kCSideX[18][5]={
-        { 99.6,  117.5,  160.4,  186.5,  212.6},
-	{ 87.6,  103.1,  140.2,  163.2,  186.2},
-	{ 65.0,   76.2,  103.1,  120.2,  137.2},
-	{ 34.6,   40.2,   53.6,   62.7,   71.7},
-	{    0,   -0.7,   -2.4,   -2.4,   -2.4},
-	{-34.6,  -41.5,  -58.1,  -67.2,  -76.3},
-	{-65.0,  -77.3, -106.8, -123.8, -140.9},
-	{-87.6, -103.7, -142.6, -165.6, -188.6},
-	{-99.6, -117.7, -161.2, -187.3, -213.5},
-	{-99.6, -117.5, -160.4, -186.5, -212.6},
-	{-87.6, -103.1, -140.2, -163.2, -186.2},
-	{-65.0,  -76.2, -103.1, -120.2, -137.2},
-	{-34.6,  -40.2,  -53.6,  -62.7,  -71.7},
-	{    0,    0.7,    2.4,    2.4,    2.4},
-	{ 34.6,   41.5,   58.1,   67.2,   76.3},
-	{ 65.0,   77.3,  106.8,  123.8,  140.9},
-	{ 87.6,  103.7,  142.6,  165.6,  188.6},
-	{ 99.6,  117.7,  161.2,  187.3,  213.5}};
-
-const Float_t kCSideY[18][5]={
-        { 17.6,   21.4,   30.7,   35.3,   39.9},
-	{ 50.6,   60.3,   83.7,   97.0,  110.3},
-	{ 77.4,   91.9,  126.6,  146.9,  167.3},
-	{ 95.0,  112.4,  154.2,  179.2,  204.1},
-	{101.1,  119.4,  163.3,  189.8,  216.4},
-	{ 95.0,  112.0,  152.6,  177.5,  202.5},
-	{ 77.4,   91.0,  123.5,  143.9,  164.2},
-	{ 50.6,   59.1,   79.5,   92.8,  106.1},
-	{ 17.6,   20.1,   26.0,   30.6,   35.2},
-	{-17.6,  -21.4,  -30.7,  -35.3,  -39.9},
-	{-50.6,  -60.3,  -83.7,  -97.0, -110.3},
-	{-77.4,  -91.9, -126.6, -146.9, -167.3},
-	{-95.0, -112.4, -154.2, -179.2, -204.1},
-       {-101.1, -119.4, -163.3, -189.8, -216.4},
-        {-95.0, -112.0, -152.6, -177.5, -202.5},
-	{-77.4,  -91.0, -123.5, -143.9, -164.2},
-	{-50.6,  -59.1,  -79.5,  -92.8, -106.1},
-	{-17.6,  -20.1,  -26.0,  -30.6,  -35.2}};  
-
-const Float_t kIFCrad[5] = {67.2, 64.4, 60.7, 64.4, 67.2};
-
-
-
 AliTPCSensorTemp::AliTPCSensorTemp(): AliDCSSensor(),
   fType(0),
   fSide(0),
@@ -216,18 +132,13 @@ TClonesArray * AliTPCSensorTemp::ReadListInd(const char *fname,
     //temp->SetX(x);
 
     if (temp->GetType()==0){
-//	temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
-      if (side[0]=='C') {
-          temp->SetX(kCSideX[sector][num]);
-      } else {
-          temp->SetX(kASideX[sector][num]);
-      }      
+	temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
     }
     if ((temp->GetType()==1) || (temp->GetType()==4)){
-      temp->SetX(TMath::Cos((2*sector+1)*0.1745)*278);
+      temp->SetX(TMath::Cos((2*sector+1)*0.1745)*260);
     }
     if ((temp->GetType()==2) || (temp->GetType()==3)){
-      temp->SetX(TMath::Cos((2*sector+1)*0.1745)*kIFCrad[num]);
+      temp->SetX(TMath::Cos((2*sector+1)*0.1745)*83);
     }
     if ((temp->GetType()==5) || (temp->GetType()==6)){
       temp->SetX(0);
@@ -235,46 +146,41 @@ TClonesArray * AliTPCSensorTemp::ReadListInd(const char *fname,
     
     //temp->SetY(y);
     if (temp->GetType()==0){
-//	  temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
-      if (side[0]=='C') {
-          temp->SetY(kCSideY[sector][num]);
-      } else {
-          temp->SetY(kASideY[sector][num]);
-      }      
+	  temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
     }
     if ((temp->GetType()==1) || (temp->GetType()==4)){
-      temp->SetY(TMath::Sin((2*sector+1)*0.1745)*278);
+      temp->SetY(TMath::Sin((2*sector+1)*0.1745)*260);
     }
     if ((temp->GetType()==2) || (temp->GetType()==3)){
-      temp->SetY(TMath::Sin((2*sector+1)*0.1745)*kIFCrad[num]);
+      temp->SetY(TMath::Sin((2*sector+1)*0.1745)*83);
     }
     if ((temp->GetType()==5) || (temp->GetType()==6)){
       temp->SetY(0);
     }
     //temp->SetZ(z);
     if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==0) {
-      temp->SetZ(250);
+      temp->SetZ(260);
       }
     if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==1){
-      temp->SetZ(-250);
+      temp->SetZ(-260);
       }
     if((temp->GetType()==1 || temp->GetType()==2) && (num==0)) {
-      temp->SetZ(240);
+      temp->SetZ(250);
       }
     if((temp->GetType()==1 || temp->GetType()==2) && (num==1)) {
-      temp->SetZ(168.4);
+      temp->SetZ(180);
       }
     if((temp->GetType()==1 || temp->GetType()==2) && (num==2)) {
-      temp->SetZ(51);
+      temp->SetZ(60);
       }
     if((temp->GetType()==1 || temp->GetType()==2) && (num==3)) {
-      temp->SetZ(-51);
+      temp->SetZ(-60);
       }
     if((temp->GetType()==1 || temp->GetType()==2) && (num==4)) {
-      temp->SetZ(-168.4);
+      temp->SetZ(-180);
       }
     if((temp->GetType()==1 || temp->GetType()==2) && (num==5)) {
-      temp->SetZ(-240);
+      temp->SetZ(-250);
       }
   }
   delete tree;  
diff --git a/TPC/AliTPCSensorTempArray.cxx b/TPC/AliTPCSensorTempArray.cxx
index 52e4e37066a..89948fab239 100644
--- a/TPC/AliTPCSensorTempArray.cxx
+++ b/TPC/AliTPCSensorTempArray.cxx
@@ -157,27 +157,3 @@ TMap* AliTPCSensorTempArray::ExtractDCS(TMap *dcsMap)
  return values;
 }
 
-//_____________________________________________________________________________
-AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t type, Int_t side, Int_t sector, Int_t num) 
-{
- //
- //  Return sensor information for sensor specified by type, side, sector and num
- //
- Int_t nsensors = fSensors->GetEntries();
- for (Int_t isensor=0; isensorAt(isensor);
-   if (entry->GetSide() == side &&
-       entry->GetType() == type &&
-       entry->GetSector() == sector &&
-       entry->GetNum() == num ) return entry;
- }
- return 0;
-}
-//_____________________________________________________________________________
-AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t IdDCS){
-  return dynamic_cast(AliDCSSensorArray::GetSensor(IdDCS));
-}
-//_____________________________________________________________________________
-AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){
-  return dynamic_cast(AliDCSSensorArray::GetSensor(x,y,z));
-}
diff --git a/TPC/AliTPCSensorTempArray.h b/TPC/AliTPCSensorTempArray.h
index 075d9ad4cc3..add3950707a 100644
--- a/TPC/AliTPCSensorTempArray.h
+++ b/TPC/AliTPCSensorTempArray.h
@@ -12,8 +12,8 @@
 
 #include "TSystem.h"
 
-#include "AliDCSSensorArray.h"
 #include "AliTPCSensorTemp.h"
+#include "AliDCSSensorArray.h"
 
 class TTimeStamp;
 class TMap;
@@ -41,9 +41,6 @@ class AliTPCSensorTempArray : public AliDCSSensorArray {
   const char* GetAmandaString() { return fAmandaString.Data(); }
   void SetAmandaString(const char* string) {fAmandaString=string;}
   TMap* ExtractDCS  (TMap *dcsMap);
-  AliTPCSensorTemp* GetSensor (Int_t type, Int_t side, Int_t sector, Int_t num);
-  AliTPCSensorTemp* GetSensor (Int_t IdDCS);
-  AliTPCSensorTemp* GetSensor (Double_t x, Double_t y, Double_t z);
 
  protected:
 
diff --git a/TPC/AliTPCcalibDB.cxx b/TPC/AliTPCcalibDB.cxx
index 62064802cdc..528a17b3887 100644
--- a/TPC/AliTPCcalibDB.cxx
+++ b/TPC/AliTPCcalibDB.cxx
@@ -78,22 +78,23 @@ void AliTPCcalibDB::Terminate()
 }
 
 //_____________________________________________________________________________
-AliTPCcalibDB::AliTPCcalibDB():
-  fRun(-1),
-  fPadGainFactor(0),
-  fPadTime0(0),
-  fPadPRFWidth(0),
-  fPadNoise(0),
-  fPedestals(0),
-  fTemperature(0),
-  fPressure(0),
-  fParam(0)
-
+AliTPCcalibDB::AliTPCcalibDB()
 {
   //
   // constructor
   //  
+  fRun = -1;
+      
+  //
   //
+  //
+  fPadGainFactor = 0;
+  fPadTime0      = 0;
+  fPadPRFWidth   = 0;
+  fPadNoise      = 0;
+  fPedestals     = 0;
+  fTemperature   = 0;
+  fParam         = 0;
   Update();    // temporary
 }
 
@@ -195,14 +196,6 @@ void AliTPCcalibDB::Update(){
     fTemperature = (AliTPCSensorTempArray*)entry->GetObject();
   }
 
-  entry          = GetCDBEntry("TPC/Calib/Pressure");
-  if (entry){
-    //if (fPressure) delete fPressure;
-    entry->SetOwner(kTRUE);
-    fPressure = (AliTPCSensorPressureArray*)entry->GetObject();
-  }
-
-
   entry          = GetCDBEntry("TPC/Calib/Parameters");
   if (entry){
     //if (fPadNoise) delete fPadNoise;
@@ -215,20 +208,3 @@ void AliTPCcalibDB::Update(){
   AliCDBManager::Instance()->SetCacheFlag(cdbCache); // reset original CDB cache
   
 }
-AliTPCcalibDB::AliTPCcalibDB(const AliTPCcalibDB& org)
-{
-  //
-  // Copy constructor invalid -- singleton implementation
-  //
-   Error("copy constructor","invalid -- singleton implementation");
-}
-
-AliTPCcalibDB& AliTPCcalibDB::operator= (const AliTPCcalibDB& rhs)
-{
-//
-// Singleton implementation - no assignment operator
-//
-  Error("operator =", "assignment operator not implemented");
-  return *this;
-}
-
diff --git a/TPC/AliTPCcalibDB.h b/TPC/AliTPCcalibDB.h
index 63a8d9be06c..b2455880452 100644
--- a/TPC/AliTPCcalibDB.h
+++ b/TPC/AliTPCcalibDB.h
@@ -13,7 +13,6 @@
 #include "TObject.h"
 class AliTPCCalPad;
 class AliTPCSensorTempArray;
-class AliTPCSensorPressureArray;
 class AliCDBEntry;
 class AliTPCParam;
 //class AliCDBStorage;
@@ -33,7 +32,6 @@ class AliTPCcalibDB : public TObject
   AliTPCCalPad* GetPadNoise() {return fPadNoise;}
   AliTPCCalPad* GetPedestals() {return fPedestals;}
   AliTPCSensorTempArray* GetTemperature() {return fTemperature;}
-  AliTPCSensorPressureArray* GetPressure() {return fPressure;}
   AliTPCParam*  GetParameters(){return fParam;}
   //
 protected:
@@ -50,7 +48,6 @@ class AliTPCcalibDB : public TObject
   AliTPCCalPad* fPadNoise;
   AliTPCCalPad* fPedestals;
   AliTPCSensorTempArray* fTemperature;
-  AliTPCSensorPressureArray *fPressure;
   //
   //
   AliTPCParam * fParam;
@@ -58,9 +55,6 @@ class AliTPCcalibDB : public TObject
   static AliTPCcalibDB* fgInstance;
   static Bool_t       fgTerminated;
   ClassDef(AliTPCcalibDB, 0)
- private:
-   AliTPCcalibDB (const AliTPCcalibDB& org);
-   AliTPCcalibDB& operator= (const AliTPCcalibDB& rhs);
 };
 
 
diff --git a/TRD/AliTRDCalibraFillHisto.cxx b/TRD/AliTRDCalibraFillHisto.cxx
index e9bcdfa31e0..c6974b0e758 100644
--- a/TRD/AliTRDCalibraFillHisto.cxx
+++ b/TRD/AliTRDCalibraFillHisto.cxx
@@ -538,7 +538,7 @@ Bool_t AliTRDCalibraFillHisto::UpdateHistograms(AliTRDcluster *cl, AliTRDtrack *
   Int_t    row        = padplane->GetPadRowNumber(pos[2]);
   Double_t offsetz    = padplane->GetPadRowOffset(row,pos[2]);
   Double_t offsettilt = padplane->GetTiltOffset(offsetz);
-  Int_t    col        = padplane->GetPadColNumber(pos[1]+offsettilt,offsetz);
+  Int_t    col        = padplane->GetPadColNumber(pos[1]+offsettilt);
   
   // See if we are not near a masked pad
   if (!IsPadOn(detector,col,row)) {
diff --git a/TRD/AliTRDReconstructor.cxx b/TRD/AliTRDReconstructor.cxx
index 26d154d3aa0..ab56022cb7e 100644
--- a/TRD/AliTRDReconstructor.cxx
+++ b/TRD/AliTRDReconstructor.cxx
@@ -36,8 +36,6 @@
 #include "AliTRDtrigger.h"
 #include "AliTRDtrigParam.h"
 #include "AliTRDgtuTrack.h"
-#include "AliTRDrawData.h"
-#include "AliTRDdigitsManager.h"
 
 ClassImp(AliTRDReconstructor)
 
@@ -45,17 +43,53 @@ Bool_t AliTRDReconstructor::fgkSeedingOn  = kFALSE;
 Int_t  AliTRDReconstructor::fgStreamLevel = 0;      // Stream (debug) level
 
 //_____________________________________________________________________________
-void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader
-				      , TTree *digitsTree) const
+void AliTRDReconstructor::Reconstruct(AliRunLoader *runLoader) const
 {
   //
-  // Convert raw data digits into digit objects in a root tree
+  // Reconstruct clusters
   //
 
-  AliTRDrawData rawData;
-  AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader);
-  manager->MakeBranch(digitsTree);
-  manager->WriteDigits();
+  AliLoader *loader = runLoader->GetLoader("TRDLoader");
+  loader->LoadRecPoints("recreate");
+
+  runLoader->CdGAFile();
+  Int_t nEvents = runLoader->GetNumberOfEvents();
+
+  for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
+    AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
+    clusterer.Open(runLoader->GetFileName(),iEvent);
+    clusterer.ReadDigits();
+    clusterer.MakeClusters();
+    clusterer.WriteClusters(-1);
+  }
+
+  loader->UnloadRecPoints();
+
+  //
+  // Trigger (tracklets, LTU)
+  //
+  loader->LoadTracks("RECREATE");
+  AliInfo("Trigger tracklets will be produced");
+
+  AliTRDtrigger trdTrigger("Trigger","Trigger class"); 
+
+  AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam"
+                                              ,"TRD Trigger parameters");
+
+  Float_t field = AliTracker::GetBz() * 0.1; // Tesla
+  AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field));
+  trigp->SetField(field);
+  trigp->Init();
+  trdTrigger.SetParameter(trigp);
+
+  for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
+    trdTrigger.Open(runLoader->GetFileName(),iEvent);
+    trdTrigger.ReadDigits();
+    trdTrigger.MakeTracklets();
+    trdTrigger.WriteTracklets(-1);
+  }
+
+  loader->UnloadTracks();
 
 }
 
@@ -121,97 +155,6 @@ void AliTRDReconstructor::Reconstruct(AliRunLoader *runLoader
 
 }
 
-//_____________________________________________________________________________
-void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
-                                    , TTree *clusterTree) const
-{
-  //
-  // Reconstruct clusters
-  //
-
-  AliInfo("Reconstruct TRD clusters from RAW data");
-
-  AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
-  clusterer.OpenOutput(clusterTree);
-  clusterer.ReadDigits(rawReader);
-  clusterer.MakeClusters();
-
-  //
-  // No trigger, since we don't have the output tree for tracklets
-  //
-
-}
-
-//_____________________________________________________________________________
-void AliTRDReconstructor::Reconstruct(TTree *digitsTree
-                                    , TTree *clusterTree) const
-{
-  //
-  // Reconstruct clusters
-  //
-
-  AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
-  clusterer.OpenOutput(clusterTree);
-  clusterer.ReadDigits(digitsTree);
-  clusterer.MakeClusters();
-
-  //
-  // No trigger, since we don't have the output tree for tracklets
-  //
-
-}
-
-//_____________________________________________________________________________
-void AliTRDReconstructor::Reconstruct(AliRunLoader *runLoader) const
-{
-  //
-  // Reconstruct clusters
-  //
-
-  AliLoader *loader = runLoader->GetLoader("TRDLoader");
-  loader->LoadRecPoints("recreate");
-
-  runLoader->CdGAFile();
-  Int_t nEvents = runLoader->GetNumberOfEvents();
-
-  for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
-    AliTRDclusterizerV1 clusterer("clusterer","TRD clusterizer");
-    clusterer.Open(runLoader->GetFileName(),iEvent);
-    clusterer.ReadDigits();
-    clusterer.MakeClusters();
-    clusterer.WriteClusters(-1);
-  }
-
-  loader->UnloadRecPoints();
-
-  //
-  // Trigger (tracklets, LTU)
-  //
-  loader->LoadTracks("RECREATE");
-  AliInfo("Trigger tracklets will be produced");
-
-  AliTRDtrigger trdTrigger("Trigger","Trigger class"); 
-
-  AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam"
-                                              ,"TRD Trigger parameters");
-
-  Float_t field = AliTracker::GetBz() * 0.1; // Tesla
-  AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field));
-  trigp->SetField(field);
-  trigp->Init();
-  trdTrigger.SetParameter(trigp);
-
-  for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
-    trdTrigger.Open(runLoader->GetFileName(),iEvent);
-    trdTrigger.ReadDigits();
-    trdTrigger.MakeTracklets();
-    trdTrigger.WriteTracklets(-1);
-  }
-
-  loader->UnloadTracks();
-
-}
-
 //_____________________________________________________________________________
 AliTracker *AliTRDReconstructor::CreateTracker(AliRunLoader *runLoader) const
 {
@@ -225,60 +168,6 @@ AliTracker *AliTRDReconstructor::CreateTracker(AliRunLoader *runLoader) const
 
 }
 
-//_____________________________________________________________________________
-void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/
-				, AliRawReader* /*rawReader*/
-		         	, AliESD *esd) const
-{
-  //
-  // Make PID
-  //
-
-  AliTRDpidESD trdPID;
-  trdPID.MakePID(esd);
-
-  //
-  // No trigger, since we don't have the output tree for tracklets
-  //
-
-}
-
-//_____________________________________________________________________________
-void AliTRDReconstructor::FillESD(AliRawReader* /*rawReader*/
-				, TTree* /*clusterTree*/
-				, AliESD *esd) const
-{
-  //
-  // Make PID
-  //
-
-  AliTRDpidESD trdPID;
-  trdPID.MakePID(esd);
-
-  //
-  // No trigger, since we don't have the output tree for tracklets
-  //
-
-}
-
-//_____________________________________________________________________________
-void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
-				, TTree* /*clusterTree*/
-				, AliESD *esd) const
-{
-  //
-  // Make PID
-  //
-
-  AliTRDpidESD trdPID;
-  trdPID.MakePID(esd);
-
-  //
-  // No trigger, since we don't have the output tree for tracklets
-  //
-
-}
-
 //_____________________________________________________________________________
 void AliTRDReconstructor::FillESD(AliRunLoader *runLoader
 				, AliESD *esd) const
@@ -293,48 +182,48 @@ void AliTRDReconstructor::FillESD(AliRunLoader *runLoader
   //
   // Trigger (tracks, GTU)
   //
-//   AliTRDtrigger trdTrigger("Trigger","Trigger class"); 
+  AliTRDtrigger trdTrigger("Trigger","Trigger class"); 
 
-//   AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam"
-//                                               ,"TRD Trigger parameters");
+  AliTRDtrigParam *trigp = new AliTRDtrigParam("TRDtrigParam"
+                                              ,"TRD Trigger parameters");
 
-//   Float_t field = AliTracker::GetBz() * 0.1; // Tesla
-//   AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field));
-//   trigp->SetField(field);
-//   trigp->Init();
+  Float_t field = AliTracker::GetBz() * 0.1; // Tesla
+  AliInfo(Form("Trigger set for magnetic field = %f Tesla \n",field));
+  trigp->SetField(field);
+  trigp->Init();
 
-//   trdTrigger.SetParameter(trigp);
-//   trdTrigger.SetRunLoader(runLoader);
-//   trdTrigger.Init();
+  trdTrigger.SetParameter(trigp);
+  trdTrigger.SetRunLoader(runLoader);
+  trdTrigger.Init();
 
-//   Int_t iEvent = runLoader->GetEventNumber(); 
-//   runLoader->GetEvent(iEvent);
-//   trdTrigger.ReadTracklets(runLoader);
+  Int_t iEvent = runLoader->GetEventNumber(); 
+  runLoader->GetEvent(iEvent);
+  trdTrigger.ReadTracklets(runLoader);
 
-//   AliESDTrdTrack *TrdTrack = new AliESDTrdTrack();
-//   AliTRDgtuTrack *GtuTrack;
+  AliESDTrdTrack *TrdTrack = new AliESDTrdTrack();
+  AliTRDgtuTrack *GtuTrack;
 
-//   Int_t nTracks = trdTrigger.GetNumberOfTracks();
-//   for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
+  Int_t nTracks = trdTrigger.GetNumberOfTracks();
+  for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
 
-//     GtuTrack = trdTrigger.GetTrack(iTrack);
+    GtuTrack = trdTrigger.GetTrack(iTrack);
 
-//     TrdTrack->SetYproj(GtuTrack->GetYproj());
-//     TrdTrack->SetZproj(GtuTrack->GetZproj());
-//     TrdTrack->SetSlope(GtuTrack->GetSlope());
-//     TrdTrack->SetDetector(GtuTrack->GetDetector());
-//     TrdTrack->SetTracklets(GtuTrack->GetTracklets());
-//     TrdTrack->SetPlanes(GtuTrack->GetPlanes());
-//     TrdTrack->SetClusters(GtuTrack->GetClusters());
-//     TrdTrack->SetPt(GtuTrack->GetPt());
-//     TrdTrack->SetPhi(GtuTrack->GetPhi());
-//     TrdTrack->SetEta(GtuTrack->GetEta());
-//     TrdTrack->SetLabel(GtuTrack->GetLabel());
-//     TrdTrack->SetPID(GtuTrack->GetPID());
-//     TrdTrack->SetIsElectron(GtuTrack->IsElectron());
+    TrdTrack->SetYproj(GtuTrack->GetYproj());
+    TrdTrack->SetZproj(GtuTrack->GetZproj());
+    TrdTrack->SetSlope(GtuTrack->GetSlope());
+    TrdTrack->SetDetector(GtuTrack->GetDetector());
+    TrdTrack->SetTracklets(GtuTrack->GetTracklets());
+    TrdTrack->SetPlanes(GtuTrack->GetPlanes());
+    TrdTrack->SetClusters(GtuTrack->GetClusters());
+    TrdTrack->SetPt(GtuTrack->GetPt());
+    TrdTrack->SetPhi(GtuTrack->GetPhi());
+    TrdTrack->SetEta(GtuTrack->GetEta());
+    TrdTrack->SetLabel(GtuTrack->GetLabel());
+    TrdTrack->SetPID(GtuTrack->GetPID());
+    TrdTrack->SetIsElectron(GtuTrack->IsElectron());
 
-//     esd->AddTrdTrack(TrdTrack);
+    esd->AddTrdTrack(TrdTrack);
 
-//   }
+  }
 
 }
diff --git a/TRD/AliTRDReconstructor.h b/TRD/AliTRDReconstructor.h
index e14865c775b..8475489f2ab 100644
--- a/TRD/AliTRDReconstructor.h
+++ b/TRD/AliTRDReconstructor.h
@@ -19,30 +19,26 @@ class AliTRDReconstructor: public AliReconstructor {
 
  public:
 
-  AliTRDReconstructor():AliReconstructor()                       { };
-  virtual ~AliTRDReconstructor()                                 { };
+  AliTRDReconstructor(): AliReconstructor()                             { };
+  virtual ~AliTRDReconstructor()                                        { };
 
-  virtual Bool_t      HasDigitConversion() const                 { return kTRUE; };
-  virtual void        ConvertDigits(AliRawReader *rawReader, TTree *digitsTree) const;
-
-  virtual Bool_t      HasLocalReconstruction() const             { return kTRUE; };
-  virtual void        Reconstruct(AliRunLoader *runLoader, AliRawReader *rawReader) const;
-  virtual void        Reconstruct(AliRawReader *rawReader, TTree *clusterTree) const;
-  virtual void        Reconstruct(TTree *digitsTree, TTree *clusterTree) const;
-  virtual void        Reconstruct(AliRunLoader *runLoader) const;
+  virtual void     Reconstruct(AliRunLoader *runLoader, AliRawReader *rawReader) const;
+  virtual void     Reconstruct(AliRawReader*, TTree*) const             { };
+  virtual void     Reconstruct(TTree*, TTree*) const                    { };
+  virtual void     Reconstruct(AliRunLoader *runLoader) const;
 
   virtual AliTracker *CreateTracker(AliRunLoader *runLoader) const;
 
-  virtual void        FillESD(AliRunLoader *runLoader, AliRawReader *rawReader, AliESD *esd) const;
-  virtual void        FillESD(AliRawReader *rawReader, TTree *clusterTree, AliESD *esd) const;
-  virtual void        FillESD(TTree *digitsTree, TTree *clusterTree, AliESD *esd) const;
-  virtual void        FillESD(AliRunLoader *runLoader, AliESD *esd) const;
+  virtual void     FillESD(AliRunLoader*, AliRawReader*, AliESD*) const { };
+  virtual void     FillESD(AliRawReader*, TTree*, AliESD*) const        { };
+  virtual void     FillESD(TTree*, TTree*, AliESD*) const { };
+  virtual void     FillESD(AliRunLoader *runLoader, AliESD *esd) const;
 
-  static  void        SetSeedingOn(Bool_t seeding)               { fgkSeedingOn  = seeding; }  
-  static  void        SetStreamLevel(Int_t level)                { fgStreamLevel = level;   }
+  static  void     SetSeedingOn(Bool_t seeding)               { fgkSeedingOn  = seeding; }  
+  static  void     SetStreamLevel(Int_t level)                { fgStreamLevel = level;   }
 
-  static  Bool_t      SeedingOn()                                { return fgkSeedingOn;     }
-  static  Int_t       StreamLevel()                              { return fgStreamLevel;    }
+  static  Bool_t   SeedingOn()                                { return fgkSeedingOn;     }
+  static  Int_t    StreamLevel()                              { return fgStreamLevel;    }
 
  private:
 
diff --git a/TRD/AliTRDcalibDB.cxx b/TRD/AliTRDcalibDB.cxx
index 66f4e961110..dcd296592d3 100644
--- a/TRD/AliTRDcalibDB.cxx
+++ b/TRD/AliTRDcalibDB.cxx
@@ -610,30 +610,6 @@ Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
 
 }
 
-//_____________________________________________________________________________
-AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
-{
-  //
-  // Returns the PRF calibration object for a given ROC
-  // containing one number per pad 
-  //
-  
-  const AliTRDCalPad     *calPad     = dynamic_cast 
-                                       (GetCachedCDBObject(kIDPRFWidth));
-  if (!calPad) {
-    return 0;
-  }
-
-  AliTRDCalROC           *roc        = calPad->GetCalROC(det);
-  if (!roc) {
-    return 0;
-  }
-  else {
-    return roc;
-  }
-
-}
-
 //_____________________________________________________________________________
 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
 {
diff --git a/TRD/AliTRDcalibDB.h b/TRD/AliTRDcalibDB.h
index dc6dd999730..cf169c25c7c 100644
--- a/TRD/AliTRDcalibDB.h
+++ b/TRD/AliTRDcalibDB.h
@@ -50,7 +50,6 @@ class AliTRDcalibDB : public TObject {
         AliTRDCalROC        *GetGainFactorROC(Int_t det);
   const AliTRDCalDet        *GetGainFactorDet();
 
-        AliTRDCalROC        *GetPRFROC(Int_t det);
   Float_t                    GetPRFWidth(Int_t det, Int_t col, Int_t row);
 
   Int_t                      GetNumberOfTimeBins();
diff --git a/TRD/AliTRDcluster.cxx b/TRD/AliTRDcluster.cxx
index bef947b9296..3f8307212bf 100644
--- a/TRD/AliTRDcluster.cxx
+++ b/TRD/AliTRDcluster.cxx
@@ -31,11 +31,11 @@ ClassImp(AliTRDcluster)
 AliTRDcluster::AliTRDcluster() 
   :AliCluster() 
   ,fDetector(0)
+  ,fX(0)
   ,fTimeBin(0)
   ,fQ(0)
   ,fNPads(0)
   ,fCenter(0)
-  ,fPad(0)
 { 
   //
   // Default constructor
@@ -51,11 +51,11 @@ AliTRDcluster::AliTRDcluster()
 AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p)
   :AliCluster()
   ,fDetector(p.GetDetector())
+  ,fX(0)
   ,fTimeBin(p.GetLocalTimeBin())
   ,fQ(p.GetEnergy())
   ,fNPads(0)
   ,fCenter(0)
-  ,fPad(0)
 {
   //
   // Constructor from AliTRDrecPoint
@@ -79,11 +79,11 @@ AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p)
 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
   :AliCluster()
   ,fDetector(c.fDetector)
+  ,fX(c.fX)
   ,fTimeBin(c.fTimeBin)
   ,fQ(c.fQ)
   ,fNPads(c.fNPads)
   ,fCenter(c.fCenter)
-  ,fPad(c.fPad)
 {
   //
   // Copy constructor 
diff --git a/TRD/AliTRDcluster.h b/TRD/AliTRDcluster.h
index 84a11d02838..c27a402afde 100644
--- a/TRD/AliTRDcluster.h
+++ b/TRD/AliTRDcluster.h
@@ -38,8 +38,8 @@ class AliTRDcluster : public AliCluster {
   virtual void     SetDetector(Int_t d)         { fDetector = d;    } 
           void     SetLocalTimeBin(Int_t t)     { fTimeBin  = t;    }
           void     SetQ(Float_t q)              { fQ        = q;    }
+  virtual void     SetX(Float_t x)              { fX        = x;    }
           void     SetCenter(Float_t c)         { fCenter   = c;    }
-	  void     SetPad(UChar_t pad)          { fPad      = pad;  }
           void     SetSignals(Short_t *signals);
           void     Set2pad()                    { SetBit(k2pad);  fNPads = 2; }
           void     Set3pad()                    { SetBit(k3pad);  fNPads = 3; }
@@ -50,9 +50,9 @@ class AliTRDcluster : public AliCluster {
   virtual Int_t    GetDetector() const          { return fDetector; }
           Int_t    GetLocalTimeBin() const      { return fTimeBin;  }
           Float_t  GetQ() const                 { return fQ;        }
+  virtual Float_t  GetX() const                 { return fX;        }
           Int_t    GetNPads() const             { return fNPads;    }
           Float_t  GetCenter() const            { return fCenter;   }
-	  Int_t    GetPad() const               { return fPad;      }
           Short_t *GetSignals()                 { return fSignals;  }
           Float_t  GetSumS() const;
 
@@ -67,14 +67,14 @@ class AliTRDcluster : public AliCluster {
           };
   
           Int_t   fDetector;       //  TRD detector number
+          Float_t fX;              //  Local x position (first order proportional to time bin)
           Char_t  fTimeBin;        //  Time bin number within the detector
           Float_t fQ;              //  Amplitude 
           Char_t  fNPads;          //  Number of pads in cluster
           Float_t fCenter;         //  Center of the cluster relative to the pad 
-	  UChar_t fPad;            //  Central pad number
           Short_t fSignals[7];     //  Signals in the cluster
   
-  ClassDef(AliTRDcluster,4)        //  Cluster for the TRD
+  ClassDef(AliTRDcluster,3)        //  Cluster for the TRD
  
 };
 
diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx
index ac95778fec7..305d477c0d9 100644
--- a/TRD/AliTRDclusterizer.cxx
+++ b/TRD/AliTRDclusterizer.cxx
@@ -163,22 +163,6 @@ Bool_t AliTRDclusterizer::OpenOutput()
 
 }
 
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizer::OpenOutput(TTree *clusterTree)
-{
-  //
-  // Connect the output tree
-  //
-
-  TObjArray *ioArray = 0;
-
-  fClusterTree = clusterTree;
-  fClusterTree->Branch("TRDcluster","TObjArray",&ioArray,32000,0);
-
-  return kTRUE;
-
-}
-
 //_____________________________________________________________________________
 Bool_t AliTRDclusterizer::OpenInput(Int_t nEvent)
 {
@@ -273,8 +257,7 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
 AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin
                                            , Int_t det, Double_t amp
 				           , Int_t *tracks, Double_t *sig
-                                           , Int_t iType, Int_t col
-                                           , Float_t center)
+                                           , Int_t iType, Float_t center)
 {
   //
   // Add a cluster for the TRD
@@ -291,7 +274,6 @@ AliTRDcluster* AliTRDclusterizer::AddCluster(Double_t *pos, Int_t timebin
   c->SetSigmaZ2(sig[1]);
   c->SetLocalTimeBin(timebin);
   c->SetCenter(center);
-  c->SetPad(col);
 
   if (tracks) {
     c->AddTrackIndex(tracks);
diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h
index c2689f63b62..4fd83714e96 100644
--- a/TRD/AliTRDclusterizer.h
+++ b/TRD/AliTRDclusterizer.h
@@ -36,7 +36,6 @@ class AliTRDclusterizer : public TNamed {
   virtual Bool_t   Open(const Char_t *name, Int_t nEvent = 0);
   virtual Bool_t   OpenInput(Int_t nEvent = 0);
   virtual Bool_t   OpenOutput();
-  virtual Bool_t   OpenOutput(TTree *clusterTree);
   virtual Bool_t   MakeClusters() = 0;
   virtual Bool_t   WriteClusters(Int_t det);
           void     ResetRecPoints();
@@ -44,8 +43,7 @@ class AliTRDclusterizer : public TNamed {
           TObjArray     *RecPoints();
   virtual AliTRDcluster *AddCluster(Double_t *pos, Int_t timebin, Int_t det
                                   , Double_t amp, Int_t *tracks
-			          , Double_t *sig, Int_t iType
-                                  , Int_t col, Float_t center = 0);
+			          , Double_t *sig, Int_t iType, Float_t center = 0);
 
  protected:
 
diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx
index cd29bea6daf..459342e48cf 100644
--- a/TRD/AliTRDclusterizerV1.cxx
+++ b/TRD/AliTRDclusterizerV1.cxx
@@ -146,18 +146,6 @@ Bool_t AliTRDclusterizerV1::ReadDigits()
 
 }
 
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerV1::ReadDigits(TTree *digitsTree)
-{
-  //
-  // Reads the digits arrays from the input tree
-  //
-
-  // Read in the digit arrays
-  return (fDigitsManager->ReadDigits(digitsTree));
-
-}
-
 //_____________________________________________________________________________
 Bool_t AliTRDclusterizerV1::ReadDigits(AliRawReader *rawReader)
 {
@@ -516,9 +504,8 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
 			                           ,dummy
 			                           ,clusterSig
 			                           ,iType
-                                                   ,col
-    		                                   ,clusterPads[1]);
-		
+                                                   ,clusterPads[1]);
+
 		// Store the amplitudes of the pads in the cluster for later analysis
 		Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
 		for (Int_t jPad = col-3; jPad <= col+3; jPad++) {
diff --git a/TRD/AliTRDclusterizerV1.h b/TRD/AliTRDclusterizerV1.h
index cf4dff00b20..955e9b33430 100644
--- a/TRD/AliTRDclusterizerV1.h
+++ b/TRD/AliTRDclusterizerV1.h
@@ -33,7 +33,6 @@ class AliTRDclusterizerV1 : public AliTRDclusterizer {
   virtual Bool_t   MakeClusters();
   virtual Bool_t   ReadDigits();
   virtual Bool_t   ReadDigits(AliRawReader *rawReader);
-  virtual Bool_t   ReadDigits(TTree *digitsTree);
 
  protected:
 
diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx
index 9767950f3bf..8de7143d0f8 100644
--- a/TRD/AliTRDdigitizer.cxx
+++ b/TRD/AliTRDdigitizer.cxx
@@ -74,6 +74,9 @@
 #include "AliTRDSimParam.h"
 #include "AliTRDCommonParam.h"
 
+#include "Cal/AliTRDCalROC.h"
+#include "Cal/AliTRDCalDet.h"
+
 ClassImp(AliTRDdigitizer)
 
 //_____________________________________________________________________________
@@ -317,7 +320,7 @@ AliTRDdigitizer::~AliTRDdigitizer()
 
   if (fMasks) {
     delete [] fMasks;
-    fMasks = 0;
+    fMasks       = 0;
   }
 
   if (fTimeStruct1) {
@@ -710,10 +713,13 @@ Bool_t AliTRDdigitizer::MakeDigits()
   // Number of track dictionary arrays
   const Int_t kNDict     = AliTRDdigitsManager::kNDict;
 
-  // Half the width of the amplification region
-  const Float_t kAmWidth = AliTRDgeometry::AmThick() / 2.0;
+  // Width of the amplification region
+  const Float_t kAmWidth = AliTRDgeometry::AmThick();
   // Width of the drift region
   const Float_t kDrWidth = AliTRDgeometry::DrThick();
+  // Drift + amplification region 
+  const Float_t kDrMin   =          - 0.5 * kAmWidth;
+  const Float_t kDrMax   = kDrWidth + 0.5 * kAmWidth;
   
   Int_t    iRow;
   Int_t    iCol;
@@ -730,8 +736,7 @@ Bool_t AliTRDdigitizer::MakeDigits()
   Int_t    timeBinTRFend   = 1;
 
   Double_t pos[3];
-  Double_t rot[3];
-  Double_t xyz[3];
+  Double_t loc[3];
   Double_t padSignal[kNpad];
   Double_t signalOld[kNpad];
 
@@ -741,46 +746,46 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
   AliTRDpadPlane   *padPlane = 0;
 
+  AliTRDCalROC     *calVdriftROC          = 0;
+  Float_t           calVdriftDetValue     = 0.0;
+  AliTRDCalROC     *calT0ROC              = 0;
+  Float_t           calT0DetValue         = 0.0;
+  AliTRDCalROC     *calGainFactorROC      = 0;
+  Float_t           calGainFactorDetValue = 0.0;
+
   if (!gGeoManager) {
     AliFatal("No geometry manager!");
   }
 
+  if (!fGeo) {
+    AliError("No geometry defined");
+    return kFALSE;
+  }
+  fGeo->ReadGeoMatrices();
+
   AliTRDSimParam    *simParam    = AliTRDSimParam::Instance();
   if (!simParam) {
-    AliError("Could not get simulation parameters");
+    AliFatal("Could not get simulation parameters");
     return kFALSE;
   }
   
   AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
   if (!commonParam) {
-    AliError("Could not get common parameterss");
+    AliFatal("Could not get common parameterss");
     return kFALSE;
   }
-  
-  // Create a container for the amplitudes
-  AliTRDsegmentArray *signalsArray = new AliTRDsegmentArray("AliTRDdataArrayF"
-                                                           ,AliTRDgeometry::Ndet());
 
-  AliTRDcalibDB* calibration = AliTRDcalibDB::Instance();
+  AliTRDcalibDB     *calibration = AliTRDcalibDB::Instance();
   if (!calibration) {
-    AliError("Could not get calibration object");  
+    AliFatal("Could not get calibration object");  
     return kFALSE;
   }
 
-  if (simParam->TRFOn()) {
-    timeBinTRFend = ((Int_t) (simParam->GetTRFhi() 
-                  * commonParam->GetSamplingFrequency())) - 1;
-    AliDebug(1,Form("Sample the TRF up to bin %d",timeBinTRFend));
-  }
-
-  Float_t elAttachProp = simParam->GetElAttachProp() / 100.0; 
-
-  if (!fGeo) {
-    AliError("No geometry defined");
-    return kFALSE;
-  }
-
-  AliDebug(1,"Start creating digits.");
+  AliDebug(1,"Start creating digits");
+  
+  // Create a container for the amplitudes
+  AliTRDsegmentArray *signalsArray = new AliTRDsegmentArray("AliTRDdataArrayF"
+                                                           ,AliTRDgeometry::Ndet());
 
   AliLoader *gimme = fRunLoader->GetLoader("TRDLoader");
   if (!gimme->TreeH()) {
@@ -792,7 +797,7 @@ Bool_t AliTRDdigitizer::MakeDigits()
     return kFALSE;
   }
   fTRD->SetTreeAddress();
-  
+
   // Get the number of entries in the hit tree
   // (Number of primary particles creating a hit somewhere)
   Int_t nTrack = (Int_t) hitTree->GetEntries();
@@ -806,12 +811,23 @@ Bool_t AliTRDdigitizer::MakeDigits()
   else {
     AliDebug(1,"Constant drift velocity in drift cells.");
   }
-  
+  if (simParam->TRFOn()) {
+    timeBinTRFend = ((Int_t) (simParam->GetTRFhi() 
+                  * commonParam->GetSamplingFrequency())) - 1;
+    AliDebug(1,Form("Sample the TRF up to bin %d",timeBinTRFend));
+  }
+
+  // Get the detector wise calibration objects
+  const AliTRDCalDet *calVdriftDet     = calibration->GetVdriftDet();  
+  const AliTRDCalDet *calT0Det         = calibration->GetT0Det();  
+  const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();  
+
   Int_t   detectorOld  = -1;
   Int_t   countHits    =  0;
  
   Int_t   nTimeTotal   = calibration->GetNumberOfTimeBins();
   Float_t samplingRate = commonParam->GetSamplingFrequency();
+  Float_t elAttachProp = simParam->GetElAttachProp() / 100.0; 
 
   // Loop through all entries in the tree
   for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
@@ -842,19 +858,18 @@ Bool_t AliTRDdigitizer::MakeDigits()
       Float_t hittime  = hit->GetTime();
       Int_t   plane    = fGeo->GetPlane(detector);
       Int_t   chamber  = fGeo->GetChamber(detector);
-      Float_t time0    = AliTRDgeometry::GetTime0(plane);
       padPlane         = commonParam->GetPadPlane(plane,chamber);
-      Float_t row0     = padPlane->GetRow0();
+      Float_t row0     = padPlane->GetRow0ROC();
       Int_t   nRowMax  = padPlane->GetNrows();
       Int_t   nColMax  = padPlane->GetNcols();
       Int_t   inDrift  = 1;
 
       // Find the current volume with the geo manager
-      gGeoManager->SetCurrentPoint(pos); 	 
-      gGeoManager->FindNode(); 	 
-      if (strstr(gGeoManager->GetPath(),"/UK")) { 	 
-	inDrift = 0; 	 
-      } 	 
+      gGeoManager->SetCurrentPoint(pos);
+      gGeoManager->FindNode();
+      if (strstr(gGeoManager->GetPath(),"/UK")) {
+	inDrift = 0;
+      }
 
       if (detector != detectorOld) {
 
@@ -887,129 +902,150 @@ Bool_t AliTRDdigitizer::MakeDigits()
             if (fCompress) dictionary[iDict]->Expand();
           }
         }      
+
+	// Get the calibration objects
+	calVdriftROC      = calibration->GetVdriftROC(detector);
+        calVdriftDetValue = calVdriftDet->GetValue(detector);
+	calT0ROC          = calibration->GetT0ROC(detector);
+        calT0DetValue     = calT0Det->GetValue(detector);
+
         detectorOld = detector;
+
       }
 
-      // Rotate the sectors on top of each other       
-      // by using the geoManager
-      Double_t aaa[3];
-      gGeoManager->MasterToLocal(pos,aaa);
+      // Go to the local coordinate system:
+      // loc[0] - row  direction in amplification or driftvolume
+      // loc[1] - col  direction in amplification or driftvolume
+      // loc[2] - time direction in amplification or driftvolume
+      gGeoManager->MasterToLocal(pos,loc);
       if (inDrift) {
-        aaa[2] = time0 - (kDrWidth / 2.0 + kAmWidth) + aaa[2];
+	// Relative to middle of amplification region
+        loc[2] = loc[2] - kDrWidth/2.0 - kAmWidth/2.0;
       } 
-      else {
-        aaa[2] = time0 + aaa[2];
+
+      // The driftlength [cm] (w/o diffusion yet !).
+      // It is negative if the hit is between pad plane and anode wires.
+      Double_t driftlength = -1.0 * loc[2];
+
+      // Stupid patch to take care of TR photons that are absorbed
+      // outside the chamber volume. A real fix would actually need
+      // a more clever implementation of the TR hit generation
+      if (q < 0.0) {
+	if ((loc[1] < padPlane->GetRowEndROC()) ||
+            (loc[1] > padPlane->GetRow0ROC())) {
+          AliDebug(2,Form("Hit outside of sensitive volume, row (z=%f, row0=%f, rowE=%f)\n"
+                         ,loc[1],padPlane->GetRow0ROC(),padPlane->GetRowEndROC()));
+          hit = (AliTRDhit *) fTRD->NextHit();   
+          continue;
+	}
+        if ((driftlength < kDrMin) ||
+            (driftlength > kDrMax)) {
+          AliDebug(2,Form("Hit outside of sensitive volume, time (Q = %d)\n"
+                         ,((Int_t) q)));
+          hit = (AliTRDhit *) fTRD->NextHit();   
+          continue;
+        }
       }
-      aaa[1] = row0 + padPlane->GetLengthRim() + fGeo->RpadW() 
-             - 0.5 * fGeo->GetChamberLength(plane,chamber) 
-             + aaa[1];
-      rot[0] = aaa[2];
-      rot[1] = aaa[0];
-      rot[2] = aaa[1];
 
-      // The driftlength. It is negative if the hit is between pad plane and anode wires.
-      Double_t driftlength = time0 - rot[0];
+      // Get row and col of unsmeared electron to retrieve drift velocity
+      // The pad row (z-direction)
+      Int_t    rowE         = padPlane->GetPadRowNumberROC(loc[1]);
+      if (rowE < 0) {
+        hit = (AliTRDhit *) fTRD->NextHit();   
+        continue;
+      }
+      Double_t rowOffset    = padPlane->GetPadRowOffsetROC(rowE,loc[1]);
+
+      // The pad column (rphi-direction)
+      Double_t offsetTilt   = padPlane->GetTiltOffset(rowOffset);
+      Int_t    colE         = padPlane->GetPadColNumber(loc[0]+offsetTilt);
+      if (colE < 0) {
+        hit = (AliTRDhit *) fTRD->NextHit();   
+        continue;	  
+      }
+      Double_t colOffset    = padPlane->GetPadColOffset(colE,loc[0]+offsetTilt);
+
+      Float_t driftvelocity = calVdriftDetValue * calVdriftROC->GetValue(colE,rowE);
+                    
+      // Normalized drift length
+      Double_t absdriftlength = TMath::Abs(driftlength);
+      if (commonParam->ExBOn()) {
+        absdriftlength /= TMath::Sqrt(GetLorentzFactor(driftvelocity));
+      }
 
       // Loop over all electrons of this hit
       // TR photons produce hits with negative charge
       Int_t nEl = ((Int_t) TMath::Abs(q));
       for (Int_t iEl = 0; iEl < nEl; iEl++) {
 
-        xyz[0] = rot[0];
-        xyz[1] = rot[1];
-        xyz[2] = rot[2];
-
-	// Stupid patch to take care of TR photons that are absorbed
-	// outside the chamber volume. A real fix would actually need
-	// a more clever implementation of the TR hit generation
-        if (q < 0.0) {
-	  if ((xyz[2] < padPlane->GetRowEnd()) ||
-              (xyz[2] > padPlane->GetRow0())) {
-            if (iEl == 0) {
-              AliDebug(2,Form("Hit outside of sensitive volume, row (z=%f, row0=%f, rowE=%f)"
-                             ,xyz[2],padPlane->GetRow0(),padPlane->GetRowEnd()));
-	    }
-            continue;
-	  }
-          Float_t tt = driftlength + kAmWidth;
-          if ((tt < 0.0) || 
-              (tt > kDrWidth + 2.0*kAmWidth)) {
-            if (iEl == 0) {
-              AliDebug(2,Form("Hit outside of sensitive volume, time (Q = %d)"
-                             ,((Int_t) q)));
-	    }
-            continue;
-	  }
-        }
-
-        // Get row and col of unsmeared electron to retrieve drift velocity
-        // The pad row (z-direction)
-        Int_t    rowE         = padPlane->GetPadRowNumber(xyz[2]);
-        if (rowE < 0) continue;
-        Double_t rowOffset    = padPlane->GetPadRowOffset(rowE,xyz[2]);
-
-        // The pad column (rphi-direction)
-	Double_t offsetTilt   = padPlane->GetTiltOffset(rowOffset);
-        Int_t    colE         = padPlane->GetPadColNumber(xyz[1]+offsetTilt,rowOffset);
-        if (colE < 0) continue;	  
-        Double_t colOffset    = padPlane->GetPadColOffset(colE,xyz[1]+offsetTilt);
-
-        Float_t driftvelocity = calibration->GetVdrift(detector,colE,rowE);
-                    
-        // Normalised drift length
-        Double_t absdriftlength = TMath::Abs(driftlength);
-        if (commonParam->ExBOn()) {
-          absdriftlength /= TMath::Sqrt(GetLorentzFactor(driftvelocity));
-        }
+        // Now the real local coordinate system of the ROC
+        // column direction: locC
+        // row direction:    locR 
+        // time direction:   locT
+        // locR and locC are identical to the coordinates of the corresponding
+        // volumina of the drift or amplification region.
+        // locT is defined relative to the wire plane (i.e. middle of amplification
+        // region), meaming locT = 0, and is negative for hits coming from the
+        // drift region. 
+        Double_t locC = loc[0];
+        Double_t locR = loc[1];
+        Double_t locT = loc[2];
 
         // Electron attachment
         if (simParam->ElAttachOn()) {
-          if (gRandom->Rndm() < (absdriftlength * elAttachProp)) continue;
+          if (gRandom->Rndm() < (absdriftlength * elAttachProp)) {
+            continue;
+	  }
         }
           
         // Apply the diffusion smearing
         if (simParam->DiffusionOn()) {
-          if (!(Diffusion(driftvelocity,absdriftlength,xyz))) continue;
+          if (!(Diffusion(driftvelocity,absdriftlength,locR,locC,locT))) {
+            continue;
+	  }
         }
 
         // Apply E x B effects (depends on drift direction)
         if (commonParam->ExBOn()) { 
-          if (!(ExB(driftvelocity,driftlength,xyz))) continue;
+          if (!(ExB(driftvelocity,driftlength,locR))) {
+            continue;
+	  }
         }
 
         // The electron position after diffusion and ExB in pad coordinates.
         // The pad row (z-direction)
-        rowE       = padPlane->GetPadRowNumber(xyz[2]);
+        rowE       = padPlane->GetPadRowNumberROC(locR);
         if (rowE < 0) continue;
-        rowOffset  = padPlane->GetPadRowOffset(rowE,xyz[2]);
+        rowOffset  = padPlane->GetPadRowOffsetROC(rowE,locR);
 
         // The pad column (rphi-direction)
         offsetTilt = padPlane->GetTiltOffset(rowOffset);
-        colE       = padPlane->GetPadColNumber(xyz[1]+offsetTilt,rowOffset);
+        colE       = padPlane->GetPadColNumber(locC+offsetTilt);
         if (colE < 0) continue;         
-        colOffset  = padPlane->GetPadColOffset(colE,xyz[1]+offsetTilt);
+        colOffset  = padPlane->GetPadColOffset(colE,locC+offsetTilt);
 	  
         // Also re-retrieve drift velocity because col and row may have changed
-        driftvelocity = calibration->GetVdrift(detector,colE,rowE);
-        Float_t t0    = calibration->GetT0(detector,colE,rowE);
+        driftvelocity = calVdriftDetValue * calVdriftROC->GetValue(colE,rowE);
+        Float_t t0    = calT0DetValue     + calT0ROC->GetValue(colE,rowE);
 
-        // Convert the position to drift time, using either constant drift velocity or
+        // Convert the position to drift time [mus], using either constant drift velocity or
         // time structure of drift cells (non-isochronity, GARFIELD calculation).
+	// Also add absolute time of hits to take pile-up events into account properly
 	Double_t drifttime;
         if (simParam->TimeStructOn()) {
-	  // Get z-position with respect to anode wire:
-          Double_t Z  =  row0 - xyz[2] + simParam->GetAnodeWireOffset();
-	  Z -= ((Int_t)(2 * Z)) / 2.0;
-	  if (Z > 0.25) {
-            Z  = 0.5 - Z;
+	  // Get z-position with respect to anode wire
+          Double_t zz  =  row0 - locR + simParam->GetAnodeWireOffset();
+	  zz -= ((Int_t)(2 * zz)) / 2.0;
+	  if (zz > 0.25) {
+            zz  = 0.5 - zz;
 	  }
 	  // Use drift time map (GARFIELD)
-          drifttime = TimeStruct(driftvelocity,time0-xyz[0]+kAmWidth,Z)
+          drifttime = TimeStruct(driftvelocity,0.5*kAmWidth-1.0*locT,zz)
                     + hittime;
         } 
         else {
 	  // Use constant drift velocity
-          drifttime = TMath::Abs(time0 - xyz[0]) / driftvelocity
+          drifttime = -1.0 * locT / driftvelocity
                     + hittime;
         }
 
@@ -1026,6 +1062,8 @@ Bool_t AliTRDdigitizer::MakeDigits()
 	  // in units of pad width
 	  Double_t dist = (colOffset - 0.5*padPlane->GetColSize(colE))
                         / padPlane->GetColSize(colE);
+	  // This is still the fixed parametrization, i.e. not dependent on
+	  // calibration values !!!!
           if (!(calibration->PadResponse(signal,dist,plane,padSignal))) continue;
 	}
         else {
@@ -1034,7 +1072,7 @@ Bool_t AliTRDdigitizer::MakeDigits()
           padSignal[2] = 0.0;
         }
 
-        // The time bin (always positive), with t0 correction
+        // The time bin (always positive), with t0 distortion
         Double_t timeBinIdeal = drifttime * samplingRate + t0;
         // Protection 
         if (TMath::Abs(timeBinIdeal) > 2*nTimeTotal) {
@@ -1048,9 +1086,9 @@ Bool_t AliTRDdigitizer::MakeDigits()
 	// Sample the time response inside the drift region
 	// + additional time bins before and after.
         // The sampling is done always in the middle of the time bin
-        for (Int_t iTimeBin = TMath::Max(timeBinTruncated, 0);
-             iTimeBin < TMath::Min(timeBinTruncated+timeBinTRFend,nTimeTotal);
-	     iTimeBin++) {
+        for (Int_t iTimeBin = TMath::Max(timeBinTruncated,0)
+            ;iTimeBin < TMath::Min(timeBinTruncated+timeBinTRFend,nTimeTotal)
+	    ;iTimeBin++) {
 
      	  // Apply the time response
           Double_t timeResponse = 1.0;
@@ -1113,6 +1151,12 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
   AliDebug(1,Form("Finished analyzing %d hits",countHits));
 
+  //____________________________________________________________________
+  //
+  // Create (s)digits
+  //____________________________________________________________________
+  //
+
   // The coupling factor
   Double_t coupling = simParam->GetPadCoupling() 
                     * simParam->GetTimeCoupling();
@@ -1167,13 +1211,19 @@ Bool_t AliTRDdigitizer::MakeDigits()
         (!calibration->IsChamberMasked(iDet))    &&
         ( fGeo->GetSMstatus(sector))) {
 
+      // Get the calibration objects
+      calGainFactorROC      = calibration->GetGainFactorROC(iDet);
+      calGainFactorDetValue = calGainFactorDet->GetValue(iDet);
+
       // Create the digits for this chamber
       for (iRow  = 0; iRow  <  nRowMax;   iRow++ ) {
         for (iCol  = 0; iCol  <  nColMax;   iCol++ ) {
 
           // Check whether pad is masked
 	  // Bridged pads are not considered yet!!!
-          if (calibration->IsPadMasked(iDet,iCol,iRow)) continue;
+          if (calibration->IsPadMasked(iDet,iCol,iRow)) {
+            continue;
+	  }
 
 	  // Create summable digits
           if (fSDigits) {
@@ -1191,17 +1241,19 @@ Bool_t AliTRDdigitizer::MakeDigits()
 	  // Create normal digits
           else {
 
+            Float_t padgain = calGainFactorDetValue 
+                            * calGainFactorROC->GetValue(iCol,iRow);
+            if (padgain <= 0) {
+              AliError(Form("Not a valid gain %f, %d %d %d",padgain,iDet,iCol,iRow));
+            }
+
             for (iTime = 0; iTime < nTimeTotal; iTime++) {         
 
               Float_t signalAmp = signals->GetDataUnchecked(iRow,iCol,iTime);
 
               // Pad and time coupling
               signalAmp *= coupling;
-
-              Float_t padgain = calibration->GetGainFactor(iDet,iCol,iRow);
-              if (padgain <= 0) {
-                AliError(Form("Not a valid gain %f, %d %d %d",padgain,iDet,iCol,iRow));
-              }
+	      // Gain factors
 	      signalAmp *= padgain;
 
               // Add the noise, starting from minus ADC baseline in electrons
@@ -1280,9 +1332,9 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
   AliDebug(1,Form("Total number of analyzed hits = %d",countHits));
   AliDebug(1,Form("Total digits data size = %d, %d, %d, %d",totalSizeDigits
-                                                             ,totalSizeDict0
-                                                             ,totalSizeDict1
-                                                             ,totalSizeDict2));
+                                                           ,totalSizeDict0
+                                                           ,totalSizeDict1
+                                                           ,totalSizeDict2));
 
   return kTRUE;
 
@@ -1328,21 +1380,24 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
   Int_t iCol;
   Int_t iTime;
 
-  AliTRDSimParam *simParam = AliTRDSimParam::Instance();
+  AliTRDCalROC *calGainFactorROC      = 0;
+  Float_t       calGainFactorDetValue = 0.0;
+
+  AliTRDSimParam    *simParam    = AliTRDSimParam::Instance();
   if (!simParam) {
-    AliError("Could not get simulation parameters");
+    AliFatal("Could not get simulation parameters");
     return kFALSE;
   }
   
   AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
   if (!commonParam) {
-    AliError("Could not get common parameters");
+    AliFatal("Could not get common parameters");
     return kFALSE;
   }
   
-  AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
+  AliTRDcalibDB     *calibration = AliTRDcalibDB::Instance();
   if (!calibration) {
-    AliError("Could not get calibration object");
+    AliFatal("Could not get calibration object");
     return kFALSE;
   }
     
@@ -1363,6 +1418,9 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
   AliTRDdataArrayI *digitsOut;
   AliTRDdataArrayI *dictionaryIn[kNDict];
   AliTRDdataArrayI *dictionaryOut[kNDict];
+
+  // Get the detector wise calibration objects
+  const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();  
   
   // Loop through the detectors
   for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) {
@@ -1392,26 +1450,34 @@ Bool_t AliTRDdigitizer::ConvertSDigits()
         (!calibration->IsChamberMasked(iDet))    &&
         ( fGeo->GetSMstatus(sector))) {
 
+      // Get the calibration objects
+      calGainFactorROC      = calibration->GetGainFactorROC(iDet);
+      calGainFactorDetValue = calGainFactorDet->GetValue(iDet);
+
       for (iRow  = 0; iRow  <  nRowMax;   iRow++ ) {
         for (iCol  = 0; iCol  <  nColMax;   iCol++ ) {
 
           // Check whether pad is masked
 	  // Bridged pads are not considered yet!!!
-          if (calibration->IsPadMasked(iDet,iCol,iRow)) continue;
+          if (calibration->IsPadMasked(iDet,iCol,iRow)) {
+            continue;
+	  }
+
+          Float_t padgain = calGainFactorDetValue 
+                          * calGainFactorROC->GetValue(iCol,iRow);
+          if (padgain <= 0) {
+            AliError(Form("Not a valid gain %f, %d %d %d",padgain,iDet,iCol,iRow));
+          }
 
-            for (iTime = 0; iTime < nTimeTotal; iTime++) {
+          for (iTime = 0; iTime < nTimeTotal; iTime++) {
 
  	    // Scale s-digits to normal digits
             Double_t signal = (Double_t) digitsIn->GetDataUnchecked(iRow,iCol,iTime);
             signal         *= sDigitsScale;
-	    // Apply the pad-by-pad gain factors
-            Float_t padgain = calibration->GetGainFactor(iDet,iCol,iRow);
-            if (padgain <= 0.0) {
-              AliError(Form("Not a valid gain %f, %d %d %d",padgain,iDet,iCol,iRow));
-            }
-            signal *= padgain;
             // Pad and time coupling
             signal *= coupling;
+	    // Gain factors
+            signal *= padgain;
             // Add the noise, starting from minus ADC baseline in electrons
             Double_t baselineEl = adcBaseline * (adcInRange / adcOutRange) / convert;
             signal  = TMath::Max((Double_t) gRandom->Gaus(signal,noise),-baselineEl);
@@ -1483,19 +1549,19 @@ Bool_t AliTRDdigitizer::MergeSDigits()
 
   AliTRDSimParam    *simParam    = AliTRDSimParam::Instance();
   if (!simParam) {
-    AliError("Could not get simulation parameters");
+    AliFatal("Could not get simulation parameters");
     return kFALSE;
   }
   
   AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
   if (!commonParam) {
-    AliError("Could not get common parameters");
+    AliFatal("Could not get common parameters");
     return kFALSE;
   }
   
   AliTRDcalibDB     *calibration = AliTRDcalibDB::Instance();
   if (!calibration) {
-    AliError("Could not get calibration object");
+    AliFatal("Could not get calibration object");
     return kFALSE;
   }
   
@@ -1661,7 +1727,7 @@ void AliTRDdigitizer::InitOutput(Int_t iEvent)
     return;  
   }
 
-  AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
+  AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
   if (!loader) {
     AliError("Can not get TRD loader from Run Loader");
     return;
@@ -1791,13 +1857,10 @@ void AliTRDdigitizer::SampleTimeStruct(Float_t vdrift)
   // Drift Time data calculated with Garfield (by C.Lippmann)
   //
   
-  // TODO make caching proper, if same timing structure is selected: do not update timestructs!
-  
-  // Noting to do
+  // Nothing to do
   if (vdrift == fTimeLastVdrift) {
     return;
   }
-
   fTimeLastVdrift = vdrift;
   
   // Drift time maps are saved for some drift velocity values (in drift region):
@@ -2530,19 +2593,19 @@ void AliTRDdigitizer::RecalcDiffusion(Float_t vdrift)
 
   AliTRDSimParam    *simParam    = AliTRDSimParam::Instance();
   if (!simParam) {
-    AliError("Could not get simulation parameters");
+    AliFatal("Could not get simulation parameters");
     return;
   }
   
   AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
   if (!commonParam) {
-    AliError("Could not get common parameters");
+    AliFatal("Could not get common parameters");
     return;
   }
   
   AliTRDcalibDB     *calibration = AliTRDcalibDB::Instance();
   if (!calibration) {
-    AliError("Could not get calibration object");
+    AliFatal("Could not get calibration object");
     return;
   }
   
@@ -2630,20 +2693,22 @@ Float_t AliTRDdigitizer::GetDiffusionT(Float_t vdrift)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDdigitizer::Diffusion(Float_t vdrift, Double_t driftlength, Double_t *xyz)
+Int_t AliTRDdigitizer::Diffusion(Float_t vdrift, Double_t absdriftlength
+                               , Double_t &lRow, Double_t &lCol, Double_t &lTime)
 {
   //
-  // Applies the diffusion smearing to the position of a single electron
+  // Applies the diffusion smearing to the position of a single electron.
+  // Depends on absolute drift length.
   //
   
   RecalcDiffusion(vdrift);
 
-  Float_t driftSqrt = TMath::Sqrt(driftlength);
+  Float_t driftSqrt = TMath::Sqrt(absdriftlength);
   Float_t sigmaT    = driftSqrt * fDiffusionT;
   Float_t sigmaL    = driftSqrt * fDiffusionL;
-  xyz[0] = gRandom->Gaus(xyz[0],sigmaL * GetLorentzFactor(vdrift));
-  xyz[1] = gRandom->Gaus(xyz[1],sigmaT * GetLorentzFactor(vdrift));
-  xyz[2] = gRandom->Gaus(xyz[2],sigmaT);
+  lRow  = gRandom->Gaus(lRow ,sigmaT * GetLorentzFactor(vdrift));
+  lCol  = gRandom->Gaus(lCol ,sigmaT);
+  lTime = gRandom->Gaus(lTime,sigmaL * GetLorentzFactor(vdrift));
 
   return 1;
 
@@ -2663,17 +2728,16 @@ Float_t AliTRDdigitizer::GetLorentzFactor(Float_t vd)
 }
   
 //_____________________________________________________________________________
-Int_t AliTRDdigitizer::ExB(Float_t vdrift, Double_t driftlength, Double_t *xyz)
+Int_t AliTRDdigitizer::ExB(Float_t vdrift, Double_t driftlength, Double_t &lRow)
 {
   //
-  // Applies E x B effects to the position of a single electron
+  // Applies E x B effects to the position of a single electron.
+  // Depends on signed drift length.
   //
   
   RecalcDiffusion(vdrift);
-  
-  xyz[0] = xyz[0];
-  xyz[1] = xyz[1] + fOmegaTau * driftlength;
-  xyz[2] = xyz[2];
+
+  lRow = lRow + fOmegaTau * driftlength;
 
   return 1;
 
diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h
index a5f40cdd705..c27a391aa49 100644
--- a/TRD/AliTRDdigitizer.h
+++ b/TRD/AliTRDdigitizer.h
@@ -67,8 +67,9 @@ class AliTRDdigitizer : public AliDigitizer {
           Float_t  GetLorentzFactor(Float_t vdrift);
 
   virtual Double_t TimeStruct(Float_t vdrift, Double_t time, Double_t z);
-  virtual Int_t    Diffusion(Float_t vdrift, Double_t driftlength, Double_t *xyz);
-  virtual Int_t    ExB(Float_t vdrift, Double_t driftlength, Double_t *xyz);  
+  virtual Int_t    Diffusion(Float_t vdrift, Double_t absdriftlength
+                           , Double_t &lRow, Double_t &lCol, Double_t &lTime);
+  virtual Int_t    ExB(Float_t vdrift, Double_t driftlength, Double_t &lRow);
 
   AliTRDdigitsManager *Digits() const                   { return fDigitsManager;  }
   
diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx
index a7650852384..a964689be96 100644
--- a/TRD/AliTRDgeometry.cxx
+++ b/TRD/AliTRDgeometry.cxx
@@ -261,11 +261,6 @@ void AliTRDgeometry::Init()
   Float_t phi = 0.0;
   for (isect = 0; isect < fgkNsect; isect++) {
     phi = 2.0 * TMath::Pi() /  (Float_t) fgkNsect * ((Float_t) isect + 0.5);
-    fRotA11[isect] = TMath::Cos(phi);
-    fRotA12[isect] = TMath::Sin(phi);
-    fRotA21[isect] = TMath::Sin(phi);
-    fRotA22[isect] = TMath::Cos(phi);
-    phi = -1.0 * phi;
     fRotB11[isect] = TMath::Cos(phi);
     fRotB12[isect] = TMath::Sin(phi);
     fRotB21[isect] = TMath::Sin(phi);
@@ -587,11 +582,11 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
 
       // Position the frames of the chambers in the TRD mother volume
       xpos  = 0.0;
-      ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.0;
+      ypos  = fClength[iplan][0] + fClength[iplan][1] + fClength[iplan][2]/2.0;
       for (Int_t ic = 0; ic < icham; ic++) {
-        ypos += fClength[iplan][ic];        
+        ypos -= fClength[iplan][ic];        
       }
-      ypos += fClength[iplan][icham]/2.0;
+      ypos -= fClength[iplan][icham]/2.0;
       zpos  = fgkVrocsm + fgkSMpltT + fgkCraH/2.0 + fgkCdrH/2.0 - fgkSheight/2.0 
             + iplan * (fgkCH + fgkVspace);
       // The lower aluminum frame, radiator + drift region
@@ -1043,11 +1038,11 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed)
       gMC->Gsvolu(cTagV,"BOX",idtmed[1302-1],parServ,kNparServ);
 
       xpos  = 0.0;
-      ypos  = - fClength[iplan][0] - fClength[iplan][1] - fClength[iplan][2]/2.0;
+      ypos  = fClength[iplan][0] + fClength[iplan][1] + fClength[iplan][2]/2.0;
       for (Int_t ic = 0; ic < icham; ic++) {
-        ypos += fClength[iplan][ic];        
+        ypos -= fClength[iplan][ic];        
       }
-      ypos += fClength[iplan][icham]/2.0;
+      ypos -= fClength[iplan][icham]/2.0;
       zpos  = fgkVrocsm + fgkSMpltT + fgkCH + fgkVspace/2.0 - fgkSheight/2.0 
             + iplan * (fgkCH + fgkVspace);
       zpos -= 0.742/2.0;
@@ -1322,38 +1317,18 @@ void AliTRDgeometry::GroupChamber(Int_t iplan, Int_t icham, Int_t *idtmed)
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDgeometry::Rotate(Int_t d, Double_t *pos, Double_t *rot) const
+Bool_t AliTRDgeometry::RotateBack(Int_t det, Double_t *loc, Double_t *glb) const
 {
   //
-  // Rotates all chambers in the position of sector 0 and transforms
-  // the coordinates in the ALICE restframe  into the 
-  // corresponding local frame .
+  // Rotates a chambers to transform the corresponding local frame 
+  // coordinates  into the coordinates of the ALICE restframe .
   //
 
-  Int_t sector = GetSector(d);
+  Int_t sector = GetSector(det);
 
-  rot[0] =  pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector];
-  rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector];
-  rot[2] =  pos[2];
-
-  return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDgeometry::RotateBack(Int_t d, Double_t *rot, Double_t *pos) const
-{
-  //
-  // Rotates a chambers from the position of sector 0 into its
-  // original position and transforms the corresponding local frame 
-  // coordinates  into the coordinates of the ALICE restframe .
-  //
-
-  Int_t sector = GetSector(d);
-
-  pos[0] =  rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector];
-  pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector];
-  pos[2] =  rot[2];
+  glb[0] = loc[0] * fRotB11[sector] - loc[1] * fRotB12[sector];
+  glb[1] = loc[0] * fRotB21[sector] + loc[1] * fRotB22[sector];
+  glb[2] = loc[2];
 
   return kTRUE;
 
@@ -1414,7 +1389,6 @@ Int_t AliTRDgeometry::GetSector(Int_t d) const
 
 }
 
-//CL
 //_____________________________________________________________________________
 Int_t AliTRDgeometry::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
 {
@@ -1423,20 +1397,30 @@ Int_t AliTRDgeometry::GetPadRowFromMCM(Int_t irob, Int_t imcm) const
 
   return fgkMCMrow*(irob/2) + imcm/fgkMCMrow;
 
-;
 }
 
 //_____________________________________________________________________________
 Int_t AliTRDgeometry::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const
 {
   //
-  // return which pad is connected to this adc channel. return -1 if it
-  // is one of the not directly connected adc channels (0, 1 20)
+  // return which pad is connected to this adc channel.
+  //
+  // ADC channels 2 to 19 are connected directly to a pad via PASA.
+  // ADC channels 0, 1 and 20 are not connected to the PASA on this MCM.
+  // So the mapping (for MCM 0 on ROB 0 at least) is
+  //
+  // ADC channel  :   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
+  // Pad          :   x  x 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0  x
+  // Func. returns:  19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 -1
+  //
+  // Here we assume that 21 ADC channels are transmitted. Maybe it will only be
+  // 18 later on!!!
+  //
+  // This function maps also correctly the channels that cross from MCM to MCM
+  // (ADC channels 0, 1, 20).
   //
 
-  if (iadc < 2 || iadc > 19 ) return -1;
-
-  return (iadc-2) + (imcm%fgkMCMrow)*fgkPadmax + GetRobSide(irob)*fgkColmax/2;
+  return (17-(iadc-2)) + (imcm%fgkMCMrow)*fgkPadmax + GetRobSide(irob)*fgkColmax/2;
 
 }
 
@@ -1511,7 +1495,7 @@ AliTRDgeometry *AliTRDgeometry::GetGeometry(AliRunLoader *runLoader)
     // If it is not in the file, try to get it from the run loader 
     if (runLoader->GetAliRun()) {
       AliTRD *trd = (AliTRD *) runLoader->GetAliRun()->GetDetector("TRD");
-      geom = trd->GetGeometry();
+      if (trd) geom = trd->GetGeometry();
     }
   }
   if (!geom) {
@@ -1528,7 +1512,13 @@ AliTRDgeometry *AliTRDgeometry::GetGeometry(AliRunLoader *runLoader)
 Bool_t AliTRDgeometry::ReadGeoMatrices()
 {
   //
-  // Read geo matrices from current gGeoManager for each TRD sector
+  // Read the geo matrices from the current gGeoManager for each TRD detector
+  //
+  // This fill three arrays of TGeoHMatrix, ordered by detector numbers 
+  // for fast access:
+  //   fMatrixArray:           Used for transformation local <-> global ???
+  //   fMatrixCorrectionArray: Used for transformation local <-> tracking system
+  //   fMatrixGeo:             Alignable objects
   //
 
   if (!gGeoManager) {
@@ -1538,11 +1528,11 @@ Bool_t AliTRDgeometry::ReadGeoMatrices()
   fMatrixArray           = new TObjArray(kNdet); 
   fMatrixCorrectionArray = new TObjArray(kNdet);
   fMatrixGeo             = new TObjArray(kNdet);
-  AliAlignObjAngles o;
 
   for (Int_t iLayer = AliAlignObj::kTRD1; iLayer <= AliAlignObj::kTRD6; iLayer++) {
     for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) {
 
+      // Find the path to the different alignable objects (ROCs)
       UShort_t     volid   = AliAlignObj::LayerToVolUID(iLayer,iModule);
       const char  *symname = AliAlignObj::SymName(volid);
       TGeoPNEntry *pne     = gGeoManager->GetAlignableEntry(symname);
@@ -1553,36 +1543,38 @@ Bool_t AliTRDgeometry::ReadGeoMatrices()
       if (!gGeoManager->cd(path)) {
         return kFALSE;
       }
-      TGeoHMatrix *m         = gGeoManager->GetCurrentMatrix();
-      Int_t        iLayerTRD = iLayer - AliAlignObj::kTRD1;
-      Int_t        isector   = Nsect() - 1 - (iModule/Ncham());
-      Int_t        ichamber  = Ncham() - 1 - (iModule%Ncham());
-      Int_t        lid       = GetDetector(iLayerTRD,ichamber,isector);    
-
-      //
-      // Local geo system z-x-y  to x-y--z 
-      //
-      fMatrixGeo->AddAt(new TGeoHMatrix(*m),lid);
-      
-      TGeoRotation mchange; 
-      mchange.RotateY(90); 
-      mchange.RotateX(90);
-
-      TGeoHMatrix gMatrix(mchange.Inverse());
-      gMatrix.MultiplyLeft(m);
-      fMatrixArray->AddAt(new TGeoHMatrix(gMatrix),lid); 
-
-      //
-      // Cluster transformation matrix
-      //
-      TGeoHMatrix  rotMatrix(mchange.Inverse());
-      rotMatrix.MultiplyLeft(m);
+
+      // Get the geo matrix of the current alignable object
+      // and add it to the corresponding list
+      TGeoHMatrix *matrix   = gGeoManager->GetCurrentMatrix();
+      Int_t        iplane   = iLayer - AliAlignObj::kTRD1;
+      Int_t        isector  = iModule / Ncham();
+      Int_t        ichamber = iModule % Ncham();
+      Int_t        idet     = GetDetector(iplane,ichamber,isector);
+      fMatrixGeo->AddAt(new TGeoHMatrix(* matrix),idet);
+
+      // Construct the geo matrix for the local <-> global transformation
+      // and add it to the corresponding list.
+      // In addition to the original geo matrix also a rotation of the
+      // kind z-x-y to x-y--z is applied.
+      TGeoRotation rotMatrixA;
+      rotMatrixA.RotateY(90); 
+      rotMatrixA.RotateX(90);
+      TGeoHMatrix matrixGlobal(rotMatrixA.Inverse());
+      matrixGlobal.MultiplyLeft(matrix);
+      fMatrixArray->AddAt(new TGeoHMatrix(matrixGlobal),idet);
+
+      // Construct the geo matrix for the cluster transformation
+      // and add it to the corresponding list.
+      // In addition to the original geo matrix also a rotation of the
+      // kind x-y--z to z-x-y and a rotation by the sector angle is applied.
       Double_t sectorAngle = 20.0 * (isector % 18) + 10.0;
-      TGeoHMatrix  rotSector;
+      TGeoHMatrix rotMatrixB(rotMatrixA.Inverse());
+      rotMatrixB.MultiplyLeft(matrix);
+      TGeoHMatrix rotSector;
       rotSector.RotateZ(sectorAngle);
-      rotMatrix.MultiplyLeft(&rotSector);      
-
-      fMatrixCorrectionArray->AddAt(new TGeoHMatrix(rotMatrix),lid);       
+      rotMatrixB.MultiplyLeft(&rotSector);      
+      fMatrixCorrectionArray->AddAt(new TGeoHMatrix(rotMatrixB),idet);
 
     }    
   }
diff --git a/TRD/AliTRDgeometry.h b/TRD/AliTRDgeometry.h
index 95a543d1f55..5a300c39617 100644
--- a/TRD/AliTRDgeometry.h
+++ b/TRD/AliTRDgeometry.h
@@ -36,11 +36,10 @@ class AliTRDgeometry : public AliGeometry {
   virtual void     Init();
   virtual void     CreateGeometry(Int_t *idtmed);
   virtual Int_t    IsVersion()                                         { return 1;               }
-  virtual Bool_t   Impact(const TParticle* ) const                     { return kTRUE;           }
+  virtual Bool_t   Impact(const TParticle *) const                     { return kTRUE;           }
   virtual Bool_t   IsHole(Int_t /*p*/, Int_t /*c*/, Int_t /*s*/) const { return kFALSE;          }
 
-  virtual Bool_t   Rotate(Int_t d, Double_t *pos, Double_t *rot) const;
-  virtual Bool_t   RotateBack(Int_t d, Double_t *rot, Double_t *pos) const;
+  virtual Bool_t   RotateBack(Int_t det, Double_t *loc, Double_t *glb) const;
 
           void     GroupChamber(Int_t iplan, Int_t icham, Int_t *idtmed);
           void     CreateFrame(Int_t *idtmed);
@@ -72,8 +71,8 @@ class AliTRDgeometry : public AliGeometry {
           Float_t  GetChamberWidth(Int_t p) const                      { return fCwidth[p];      }
           Float_t  GetChamberLength(Int_t p, Int_t c) const            { return fClength[p][c];  }
 
-  virtual void     GetGlobal(const AliRecPoint*, TVector3&, TMatrixF& ) const { }; 
-  virtual void     GetGlobal(const AliRecPoint*, TVector3& ) const            { };
+  virtual void     GetGlobal(const AliRecPoint*, TVector3&, TMatrixF&) const { }; 
+  virtual void     GetGlobal(const AliRecPoint*, TVector3&) const            { };
  
   static  Double_t GetAlpha()                                          { return 2.0 
                                                                            * 3.14159265358979324 
@@ -196,11 +195,6 @@ class AliTRDgeometry : public AliGeometry {
   Float_t               fCwidth[kNplan];                     //  Outer widths of the chambers
   Float_t               fClength[kNplan][kNcham];            //  Outer lengths of the chambers
 
-  Float_t               fRotA11[kNsect];                     //  Matrix elements for the rotation
-  Float_t               fRotA12[kNsect];                     //  Matrix elements for the rotation
-  Float_t               fRotA21[kNsect];                     //  Matrix elements for the rotation
-  Float_t               fRotA22[kNsect];                     //  Matrix elements for the rotation
-
   Float_t               fRotB11[kNsect];                     //  Matrix elements for the backward rotation
   Float_t               fRotB12[kNsect];                     //  Matrix elements for the backward rotation
   Float_t               fRotB21[kNsect];                     //  Matrix elements for the backward rotation
@@ -219,11 +213,11 @@ class AliTRDgeometry : public AliGeometry {
   Float_t               fChamberUFboxd[3*kNdets][3];         //  [3] = x, y, z
   Float_t               fChamberUUboxd[3*kNdets][3];         // 
 
-  TObjArray            *fMatrixArray;                        //! Transformation Global to Local
-  TObjArray            *fMatrixCorrectionArray;              //! Transformation Cluster to  Tracking systerm
+  TObjArray            *fMatrixArray;                        //! Transformation global to local
+  TObjArray            *fMatrixCorrectionArray;              //! Transformation cluster to tracking system
   TObjArray            *fMatrixGeo;                          //! Geo matrices
 
-  ClassDef(AliTRDgeometry,12)                                //  TRD geometry class
+  ClassDef(AliTRDgeometry,13)                                //  TRD geometry class
 
 };
 
diff --git a/TRD/AliTRDgtuTrack.cxx b/TRD/AliTRDgtuTrack.cxx
index dad3d160cb7..47befff89aa 100644
--- a/TRD/AliTRDgtuTrack.cxx
+++ b/TRD/AliTRDgtuTrack.cxx
@@ -448,14 +448,8 @@ void AliTRDgtuTrack::MakePID()
 
     // HEAD28Mar06 new distributions: factor = 6.0
 
-		// A.Bercuci on 2nd May 2007
-		// Temporary modification to deal with more energy slices. The values
-		// attached to charge slices and track length are dummy
-		Double_t dedx[3];
-		dedx[0] = dedx[1] = q*3.; dedx[2] = 0.;
-		Double_t length = 3.7;
-    probEle *= pd->GetProbability(0, TMath::Abs(fPt), dedx, length);
-    probPio *= pd->GetProbability(2, TMath::Abs(fPt), dedx, length);
+    probEle *= pd->GetProbability(0,TMath::Abs(fPt),q*6.0);
+    probPio *= pd->GetProbability(2,TMath::Abs(fPt),q*6.0);
 
   }
 
diff --git a/TRD/AliTRDpadPlane.cxx b/TRD/AliTRDpadPlane.cxx
index 89cf7140b1a..23e40f01ecf 100644
--- a/TRD/AliTRDpadPlane.cxx
+++ b/TRD/AliTRDpadPlane.cxx
@@ -57,6 +57,7 @@ AliTRDpadPlane::AliTRDpadPlane()
   ,fTiltingTan(0)
   ,fPadRow(0)
   ,fPadCol(0)
+  ,fPadRowSMOffset(0)
 {
   //
   // Default constructor
@@ -86,6 +87,7 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c)
   ,fTiltingTan(0)
   ,fPadRow(0)
   ,fPadCol(0)
+  ,fPadRowSMOffset(0)
 {
   //
   // Constructor that initializes a given pad plane type
@@ -265,14 +267,9 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c)
   // Row direction
   //
   fPadRow = new Double_t[fNrows];
-  Double_t row = fGeo->GetChamberLength(p,0)
-    	       + fGeo->GetChamberLength(p,1)
-               + fGeo->GetChamberLength(p,2) / 2.0
+  Double_t row = fGeo->GetChamberLength(p,c) / 2.0
                - fGeo->RpadW()
                - fLengthRim;
-  for (Int_t ic = 0; ic < c; ic++) {
-    row -= fGeo->GetChamberLength(p,ic);
-  }
   for (Int_t ir = 0; ir < fNrows; ir++) {
     fPadRow[ir] = row;
     row -= fRowSpacing;
@@ -300,6 +297,15 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c)
       col -= fWidthIPad;
     }
   }
+  // Calculate the offset to translate from the local ROC system into
+  // the local supermodule system, which is used for clusters
+  Double_t rowTmp = fGeo->GetChamberLength(p,0)
+    	          + fGeo->GetChamberLength(p,1)
+                  + fGeo->GetChamberLength(p,2) / 2.0;
+  for (Int_t ic = 0; ic < c; ic++) {
+    rowTmp -= fGeo->GetChamberLength(p,ic);
+  }
+  fPadRowSMOffset = rowTmp - fGeo->GetChamberLength(p,c)/2.0;
 
 }
 
@@ -325,6 +331,7 @@ AliTRDpadPlane::AliTRDpadPlane(const AliTRDpadPlane &p)
   ,fTiltingTan(p.fTiltingTan)
   ,fPadRow(0)
   ,fPadCol(0)
+  ,fPadRowSMOffset(p.fPadRowSMOffset)
 {
   //
   // AliTRDpadPlane copy constructor
@@ -398,28 +405,30 @@ void AliTRDpadPlane::Copy(TObject &p) const
 
   Int_t iBin = 0;
 
-  ((AliTRDpadPlane &) p).fGeo          = 0;
+  ((AliTRDpadPlane &) p).fGeo            = 0;
+
+  ((AliTRDpadPlane &) p).fPla            = fPla;
+  ((AliTRDpadPlane &) p).fCha            = fCha;
 
-  ((AliTRDpadPlane &) p).fPla          = fPla;
-  ((AliTRDpadPlane &) p).fCha          = fCha;
+  ((AliTRDpadPlane &) p).fLength         = fLength;
+  ((AliTRDpadPlane &) p).fWidth          = fWidth;
+  ((AliTRDpadPlane &) p).fLengthRim      = fLengthRim;
+  ((AliTRDpadPlane &) p).fWidthRim       = fWidthRim;
+  ((AliTRDpadPlane &) p).fLengthOPad     = fLengthOPad;
+  ((AliTRDpadPlane &) p).fWidthOPad      = fWidthOPad;
+  ((AliTRDpadPlane &) p).fLengthIPad     = fLengthIPad;
+  ((AliTRDpadPlane &) p).fWidthIPad      = fWidthIPad;
 
-  ((AliTRDpadPlane &) p).fLength       = fLength;
-  ((AliTRDpadPlane &) p).fWidth        = fWidth;
-  ((AliTRDpadPlane &) p).fLengthRim    = fLengthRim;
-  ((AliTRDpadPlane &) p).fWidthRim     = fWidthRim;
-  ((AliTRDpadPlane &) p).fLengthOPad   = fLengthOPad;
-  ((AliTRDpadPlane &) p).fWidthOPad    = fWidthOPad;
-  ((AliTRDpadPlane &) p).fLengthIPad   = fLengthIPad;
-  ((AliTRDpadPlane &) p).fWidthIPad    = fWidthIPad;
+  ((AliTRDpadPlane &) p).fRowSpacing     = fRowSpacing;
+  ((AliTRDpadPlane &) p).fColSpacing     = fColSpacing;
 
-  ((AliTRDpadPlane &) p).fRowSpacing   = fRowSpacing;
-  ((AliTRDpadPlane &) p).fColSpacing   = fColSpacing;
+  ((AliTRDpadPlane &) p).fNrows          = fNrows;
+  ((AliTRDpadPlane &) p).fNcols          = fNcols;
 
-  ((AliTRDpadPlane &) p).fNrows        = fNrows;
-  ((AliTRDpadPlane &) p).fNcols        = fNcols;
+  ((AliTRDpadPlane &) p).fTiltingAngle   = fTiltingAngle;
+  ((AliTRDpadPlane &) p).fTiltingTan     = fTiltingTan;
 
-  ((AliTRDpadPlane &) p).fTiltingAngle = fTiltingAngle;
-  ((AliTRDpadPlane &) p).fTiltingTan   = fTiltingTan;
+  ((AliTRDpadPlane &) p).fPadRowSMOffset = fPadRowSMOffset;
 
   if (((AliTRDpadPlane &) p).fPadRow) {
     delete [] ((AliTRDpadPlane &) p).fPadRow;
@@ -445,7 +454,7 @@ void AliTRDpadPlane::Copy(TObject &p) const
 Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
 {
   //
-  // Finds the pad row number for a given global z-position
+  // Finds the pad row number for a given z-position in local supermodule system
   //
 
   Int_t row    = 0;
@@ -458,6 +467,48 @@ Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
 
     row = -1;
 
+  }
+  else {
+
+    nabove = fNrows + 1;
+    nbelow = 0;
+    while (nabove - nbelow > 1) {
+      middle = (nabove + nbelow) / 2;
+      if (z == (fPadRow[middle-1] + fPadRowSMOffset)) {
+        row    = middle;
+      }
+      if (z  > (fPadRow[middle-1] + fPadRowSMOffset)) {
+        nabove = middle;
+      }
+      else {
+        nbelow = middle;
+      }
+    }
+    row = nbelow - 1;
+
+  }
+
+  return row;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDpadPlane::GetPadRowNumberROC(Double_t z) const
+{
+  //
+  // Finds the pad row number for a given z-position in local ROC system
+  //
+
+  Int_t row    = 0;
+  Int_t nabove = 0;
+  Int_t nbelow = 0;
+  Int_t middle = 0;
+
+  if ((z > GetRow0ROC()  ) || 
+      (z < GetRowEndROC())) {
+
+    row = -1;
+
   }
   else {
 
@@ -484,17 +535,16 @@ Int_t AliTRDpadPlane::GetPadRowNumber(Double_t z) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi
-				    , Double_t /*rowOffset*/) const
+Int_t AliTRDpadPlane::GetPadColNumber(Double_t rphi) const
 {
   //
   // Finds the pad column number for a given global rphi-position
   //
 
-  Int_t    col    = 0;
-  Int_t    nabove = 0;
-  Int_t    nbelow = 0;
-  Int_t    middle = 0;
+  Int_t col    = 0;
+  Int_t nabove = 0;
+  Int_t nbelow = 0;
+  Int_t middle = 0;
 
   if ((rphi > GetCol0()  ) || 
       (rphi < GetColEnd())) {
diff --git a/TRD/AliTRDpadPlane.h b/TRD/AliTRDpadPlane.h
index d9bcaf827cd..000166b3482 100644
--- a/TRD/AliTRDpadPlane.h
+++ b/TRD/AliTRDpadPlane.h
@@ -33,10 +33,18 @@ class AliTRDpadPlane : public TObject {
   virtual void       Copy(TObject &p) const;
 
   Int_t    GetPadRowNumber(Double_t z) const;
-  Int_t    GetPadColNumber(Double_t rphi, Double_t rowOffset) const;
+  Int_t    GetPadRowNumberROC(Double_t z) const;
+  Int_t    GetPadColNumber(Double_t rphi) const;
+
   Double_t GetTiltOffset(Double_t rowOffset) const 
                                              { return fTiltingTan * (rowOffset - 0.5*fLengthIPad); };
+
   Double_t GetPadRowOffset(Int_t row, Double_t z) const
+                                             { if ((row < 0) || (row >= fNrows))
+                                                 return -1.0;
+                                               else 
+                                                 return fPadRow[row] + fPadRowSMOffset - z;        };
+  Double_t GetPadRowOffsetROC(Int_t row, Double_t z) const
                                              { if ((row < 0) || (row >= fNrows))
                                                  return -1.0;
                                                else 
@@ -53,13 +61,16 @@ class AliTRDpadPlane : public TObject {
   Int_t    GetNrows() const                  { return fNrows;        };
   Int_t    GetNcols() const                  { return fNcols;        };
 
-  Double_t GetRow0() const                   { return fPadRow[0];    };
+  Double_t GetRow0() const                   { return fPadRow[0] + fPadRowSMOffset;    };
+  Double_t GetRow0ROC() const                { return fPadRow[0];    };
   Double_t GetCol0() const                   { return fPadCol[0];    };
 
-  Double_t GetRowEnd() const                 { return fPadRow[fNrows-1] - fLengthOPad; };
+  Double_t GetRowEnd() const                 { return fPadRow[fNrows-1] - fLengthOPad + fPadRowSMOffset; };
+  Double_t GetRowEndROC() const              { return fPadRow[fNrows-1] - fLengthOPad; };
   Double_t GetColEnd() const                 { return fPadCol[fNcols-1] - fWidthOPad;  };
 
-  Double_t GetRowPos(Int_t row) const        { return fPadRow[row];  };
+  Double_t GetRowPos(Int_t row) const        { return fPadRow[row] + fPadRowSMOffset;  };
+  Double_t GetRowPosROC(Int_t row) const     { return fPadRow[row];  };
   Double_t GetColPos(Int_t col) const        { return fPadCol[col];  };
   
   Double_t GetRowSize(Int_t row) const       { if ((row == 0) || (row == fNrows-1))
@@ -103,7 +114,9 @@ class AliTRDpadPlane : public TObject {
   Double_t *fPadRow;          //! Pad border positions in row direction
   Double_t *fPadCol;          //! Pad border positions in column direction
 
-  ClassDef(AliTRDpadPlane,2)  //  TRD ROC pad plane
+  Double_t  fPadRowSMOffset;  //  To be added to translate local ROC system to local SM system
+
+  ClassDef(AliTRDpadPlane,3)  //  TRD ROC pad plane
 
 };
 
diff --git a/TRD/AliTRDpidESD.cxx b/TRD/AliTRDpidESD.cxx
index 52d1aa7b28e..c16ef1964b2 100644
--- a/TRD/AliTRDpidESD.cxx
+++ b/TRD/AliTRDpidESD.cxx
@@ -13,8 +13,6 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
-
 ////////////////////////////////////////////////////////////////////////////
 //                                                                        //
 // Implementation of the TRD PID class                                    //
@@ -25,9 +23,8 @@
 // momentum (mom) and particle type k                                     //
 // from the precalculated distributions.                                  //
 //                                                                        //
-// Authors :                                                              //
-// Prashant Shukla  (Original version)//
-// Alex Bercuci (a.bercuci@gsi.de)                                        //
+// Original version:                                                      //
+// Prashant Shukla                    //
 //                                                                        //
 ////////////////////////////////////////////////////////////////////////////
 
@@ -38,8 +35,6 @@
 #include "AliTRDpidESD.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDcalibDB.h"
-#include "AliRun.h"
-#include "AliTRDtrack.h"
 #include "Cal/AliTRDCalPIDLQ.h"
 
 ClassImp(AliTRDpidESD)
@@ -49,8 +44,7 @@ ClassImp(AliTRDpidESD)
   Int_t AliTRDpidESD::fMinPlane          = 0;
 
 //_____________________________________________________________________________
-AliTRDpidESD::AliTRDpidESD()
-  :TObject()
+AliTRDpidESD::AliTRDpidESD():TObject()
 {
   //
   // Default constructor
@@ -59,8 +53,7 @@ AliTRDpidESD::AliTRDpidESD()
 }
 
 //_____________________________________________________________________________
-AliTRDpidESD::AliTRDpidESD(const AliTRDpidESD &p)
-  :TObject(p)
+AliTRDpidESD::AliTRDpidESD(const AliTRDpidESD &p):TObject(p)
 {
   //
   // AliTRDpidESD copy constructor
@@ -89,9 +82,9 @@ void AliTRDpidESD::Copy(TObject &p) const
   // Copy function
   //
 
-  ((AliTRDpidESD &) p).fCheckTrackStatus          = fCheckTrackStatus;
-  ((AliTRDpidESD &) p).fCheckKinkStatus           = fCheckKinkStatus;
-  ((AliTRDpidESD &) p).fMinPlane                  = fMinPlane;
+ ((AliTRDpidESD &) p).fCheckTrackStatus          = fCheckTrackStatus;
+ ((AliTRDpidESD &) p).fCheckKinkStatus           = fCheckKinkStatus;
+ ((AliTRDpidESD &) p).fMinPlane                  = fMinPlane;
 
 }
 
@@ -101,168 +94,108 @@ Int_t AliTRDpidESD::MakePID(AliESD *event)
   //
   // This function calculates the PID probabilities based on TRD signals
   //
-  // The method produces probabilities based on the charge
-  // and the position of the maximum time bin in each layer.
-  // The dE/dx information can be used as global charge or 2 to 3
-  // slices. Check AliTRDCalPIDLQ and AliTRDCalPIDLQRef for the actual
-  // implementation.
-  //
-  // Author
-  // Alex Bercuci (A.Bercuci@gsi.de) 2nd May 2007
-
-	AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
-	if (!calibration) {
-		AliErrorGeneral("AliTRDpidESD::MakePID()"
-			,"No access to calibration data");
-		return -1;
-	}
-	
-	// Retrieve the CDB container class with the probability distributions
-	const AliTRDCalPIDLQ *pd = calibration->GetPIDLQObject();
-	if (!pd) {
-		AliErrorGeneral("AliTRDpidESD::MakePID()"
-			,"No access to AliTRDCalPIDLQ");
-		return -1;
+  // So far this method produces probabilities based on the total charge
+  // in each layer and the position of the maximum time bin in each layer.
+  // In a final version this should also exploit the charge measurement in
+  // the different slices of a given layer.
+  //  
+
+  Double_t p[10];
+  Int_t    nSpecies  = AliPID::kSPECIES;
+  Int_t    nPlanePID = 0;
+  Double_t mom       = 0.0;
+  Double_t probTotal = 0.0;
+
+  AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
+  if (!calibration) {
+    AliErrorGeneral("AliTRDpidESD::MakePID"
+                   ,"No access to calibration data\n");
+    return -1;
+  }  
+
+  // Retrieve the CDB container class with the probability distributions
+  const AliTRDCalPIDLQ *pd = calibration->GetPIDLQObject();
+  if (!pd) {
+    AliErrorGeneral("AliTRDpidESD::MakePID"
+                   ,"No access to AliTRDCalPIDLQ\n");
+    return -1;
+  }
+
+  // Loop through all ESD tracks
+  Int_t ntrk = event->GetNumberOfTracks();
+  for (Int_t i = 0; i < ntrk; i++) {
+
+    AliESDtrack *t = event->GetTrack(i);
+
+    // Check the ESD track status
+    if (fCheckTrackStatus) {
+      if (((t->GetStatus() & AliESDtrack::kTRDout  ) == 0) &&
+	  ((t->GetStatus() & AliESDtrack::kTRDrefit) == 0)) {
+        continue;
+      }
+    }
+
+    // Check for ESD kink tracks
+    if (fCheckKinkStatus) {
+      if (t->GetKinkIndex(0) != 0) {
+        continue;
+      }
+    }
+
+    // Skip tracks that have no TRD signal at all
+    if (t->GetTRDsignal() == 0) {
+      continue;
+    }
+
+    mom       = t->GetP();
+    probTotal = 0.0;
+    nPlanePID = 0;
+    for (Int_t iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
+      p[iSpecies] = 1.0;
+    }
+
+    // Check the different detector layers
+    for (Int_t iPlan = 0; iPlan < AliTRDgeometry::kNplan; iPlan++) {
+
+      // Use the total charge in a given plane
+      Double_t dedx    = t->GetTRDsignals(iPlan,-1);
+      Int_t    timebin = t->GetTRDTimBin(iPlan);
+      if ((dedx    >  0.0) && 
+          (timebin > -1.0)) {
+
+        nPlanePID++;
+
+        // Get the probabilities for the different particle species
+        for (Int_t iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
+
+	  p[iSpecies] *= pd->GetProbability(iSpecies,mom,dedx);
+	  p[iSpecies] *= pd->GetProbabilityT(iSpecies,mom,timebin);
+  	  p[iSpecies] *= 100.0; // ??????????????
+
 	}
 
+      }
 
-	// Loop through all ESD tracks
-	Double_t p[10];
-	AliESDtrack *t = 0x0;
-	Double_t dedx[AliTRDtrack::kNslice], dEdx;
-	Int_t    timebin;
-	Float_t mom, length, probTotal;
-	Int_t nPlanePID;
-	for (Int_t i=0; iGetNumberOfTracks(); i++) {
-		t = event->GetTrack(i);
-
-		// Check track
-		if(!CheckTrack(t)) continue;
-						
-		// Skip tracks which have no TRD signal at all
-		if (t->GetTRDsignal() == 0.) continue;
-	
-		// Loop over detector layers
-		mom       = 0.; //t->GetP();
-		length    = 0.;
-		probTotal = 0.;
-		nPlanePID    = 0;
-		for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) p[iSpecies] = 1.;
-		for (Int_t iPlan = 0; iPlan < AliTRDgeometry::kNplan; iPlan++) {
-			// read data for track segment
-			for(int iSlice=0; iSliceGetTRDsignals(iPlan, iSlice);
-			dEdx    = t->GetTRDsignals(iPlan, -1);
-			timebin = t->GetTRDTimBin(iPlan);
-
-			// check data
-			if ((dEdx <=  0.) || (timebin <= -1.)) continue;
-
-			// retrive kinematic info for this track segment
-			if(!GetTrackSegmentKine(t, iPlan, mom, length)) continue;
-			
-			// this track segment has fulfilled all requierments
-			nPlanePID++;
-			
-			// Get the probabilities for the different particle species
-			for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
-				p[iSpecies] *= pd->GetProbability(iSpecies, mom, dedx, length);
-				p[iSpecies] *= pd->GetProbabilityT(iSpecies, mom, timebin);
-				probTotal   += p[iSpecies];
-			}
-		}
-
-		// normalize probabilities
-		if(probTotal > 0.)
-			for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
-				if(nPlanePID > fMinPlane) p[iSpecies] /= probTotal;
-				else p[iSpecies] = 1.0;
-
-
-		// book PID to the track
-		t->SetTRDpid(p);
-	}
-	
-	return 0;
-}
+    }
 
-//_____________________________________________________________________________
-Bool_t AliTRDpidESD::CheckTrack(AliESDtrack *t)
-{
-  //
-  // Check if track is eligible for PID calculations
-  //
-	
-	// Check the ESD track status
-	if (fCheckTrackStatus) {
-		if (((t->GetStatus() & AliESDtrack::kTRDout  ) == 0) &&
-			((t->GetStatus() & AliESDtrack::kTRDrefit) == 0)) return kFALSE;
-	}
+    for (Int_t iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
+      probTotal += p[iSpecies];
+    }
 
-	// Check for ESD kink tracks
-	if (fCheckKinkStatus && (t->GetKinkIndex(0) != 0)) return kFALSE;
+    for (Int_t iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
+      if ((probTotal >       0.0) &&
+          (nPlanePID > fMinPlane)) {
+        p[iSpecies] /= probTotal;
+      }
+      else {
+        p[iSpecies] = 1.0;
+      }
+    }
 
-	return kTRUE;
-}
+    t->SetTRDpid(p);
 
-//_____________________________________________________________________________
-Bool_t AliTRDpidESD::GetTrackSegmentKine(AliESDtrack *t, Int_t plan, Float_t &mom, Float_t &length)
-{
-  //
-  // Retrive momentum "mom" and track "length" in TRD chamber from plane
-  // "plan" according to information stored in AliESDtrack "t".
-  // 
-
-	if(!gAlice){
-		AliErrorGeneral("AliTRDpidESD::GetTrackSegmentKine()"
-		,"No gAlice object to retrive TRDgeometry and Magnetic fied  - this has to be removed in the future.");
-		return kFALSE;
-	}
-	
-	// Retrieve TRD geometry -> Maybe there is a better way to do this
-	Bool_t kSelfGeom = kFALSE;
-	AliTRDgeometry *TRDgeom =0x0;
-	if(gAlice) TRDgeom = AliTRDgeometry::GetGeometry(gAlice->GetRunLoader());
-	if(!TRDgeom){
-		AliWarningGeneral("AliTRDpidESD::GetTrackSegmentKine()", "Cannot load TRD geometry from gAlice! Build a new one.\n");
-		TRDgeom = new AliTRDgeometry();
-		kSelfGeom = kTRUE;
-	}
-	const Float_t kAmHalfWidth = AliTRDgeometry::AmThick() / 2.;
-  const Float_t kDrWidth = AliTRDgeometry::DrThick();
-	
-
-	// retrive the magnetic field
-	Double_t xyz0[3] = { 0., 0., 0.}, xyz1[3];
-	Double_t b[3], alpha;
-	gAlice->Field(xyz0,b);      // b[] is in kilo Gauss
-	Float_t field = b[2] * 0.1; // Tesla
-
-		
-	// find momentum at chamber entrance and track length in chamber
-	AliExternalTrackParam *param = (plan<3) ? new AliExternalTrackParam(*t->GetInnerParam()) : new AliExternalTrackParam(*t->GetOuterParam());
-
-	param->PropagateTo(TRDgeom->GetTime0(plan)+kAmHalfWidth, field);
-	param->GetXYZ(xyz0);
-	alpha = param->GetAlpha();
-	param->PropagateTo(TRDgeom->GetTime0(plan)-kAmHalfWidth-kDrWidth, field);
-	// eliminate track segments which are crossing SM boundaries along chamber
-	if(TMath::Abs(alpha-param->GetAlpha())>.01){
-		delete param;
-		if(kSelfGeom) delete TRDgeom;
-		return kFALSE;
-	}
-	param->GetXYZ(xyz1);
-	length = sqrt(
-		(xyz1[0]-xyz0[0])*(xyz1[0]-xyz0[0])+
-		(xyz1[1]-xyz0[1])*(xyz1[1]-xyz0[1])+
-		(xyz1[2]-xyz0[2])*(xyz1[2]-xyz0[2])
-	);
-	param->GetPxPyPz(xyz1);
-	mom = sqrt(xyz1[0]*xyz1[0] + xyz1[1]*xyz1[1] + xyz1[2]*xyz1[2]);
-	delete param;
-	if(kSelfGeom) delete TRDgeom;
-
-	return kTRUE;
-}
+  }
 
+  return 0;
+
+}
diff --git a/TRD/AliTRDpidESD.h b/TRD/AliTRDpidESD.h
index 0f2945445f3..974c6e5431e 100644
--- a/TRD/AliTRDpidESD.h
+++ b/TRD/AliTRDpidESD.h
@@ -16,7 +16,7 @@
 #include 
 
 class AliESD;
-class AliESDtrack;
+
 class AliTRDpidESD : public TObject {
 
  public:
@@ -27,7 +27,7 @@ class AliTRDpidESD : public TObject {
   AliTRDpidESD &operator=(const AliTRDpidESD &p);
 
   virtual void    Copy(TObject &p) const;
-  static  Bool_t  CheckTrack(AliESDtrack *t);
+
   static  Int_t   MakePID(AliESD *event);
 
           void    SetCheckTrackStatus(Bool_t status = kTRUE) { fCheckTrackStatus = status; };
@@ -37,7 +37,7 @@ class AliTRDpidESD : public TObject {
 	  Bool_t  GetCheckTrackStatus()                      { return fCheckTrackStatus;   };      
 	  Bool_t  GetCheckKinkStatus()                       { return fCheckKinkStatus;    };      
           Int_t   GetMinPlane()                              { return fMinPlane;           };
-  static  Bool_t  GetTrackSegmentKine(AliESDtrack *t, Int_t plan, Float_t &mom, Float_t &length);
+
  private:
 
   static  Bool_t  fCheckTrackStatus;    // Enable check on ESD track status
diff --git a/TRD/AliTRDtrack.h b/TRD/AliTRDtrack.h
index 058b96d17a8..7bf255d1b8b 100644
--- a/TRD/AliTRDtrack.h
+++ b/TRD/AliTRDtrack.h
@@ -18,7 +18,6 @@
 
 class AliESDtrack;
 class AliTrackReference;
-class AliTRDcluster;
 
 const unsigned kMAXCLUSTERSPERTRACK = 210; 
 
@@ -31,8 +30,7 @@ class AliTRDtrack : public AliKalmanTrack {
        , kNplane    =   6
        , kNcham     =   5
        , kNsect     =  18
-       , kNslice    =   3
-       , kMidTimeBin=  14};
+       , kNslice    =   3 };
 
    AliTRDtrack();
    AliTRDtrack(const AliTRDcluster *c, Int_t index, const Double_t xx[5]
diff --git a/TRD/AliTRDtracker.cxx b/TRD/AliTRDtracker.cxx
index 9efdabc4de9..50b37745c8f 100644
--- a/TRD/AliTRDtracker.cxx
+++ b/TRD/AliTRDtracker.cxx
@@ -3468,65 +3468,57 @@ Double_t AliTRDtracker::GetTiltFactor(const AliTRDcluster *c)
 void AliTRDtracker::CookdEdxTimBin(AliTRDtrack &TRDtrack)
 {
   //
-  // Build the information needed for TRD PID calculations. This are:
-  // - dE/dx - total
-  // - dE/dx - slices (0-14, 15-22, NONE). The Edep per slice is
-  //    calculated as the sum of clusters charge weighted with average
-  //    value from the  spectrum
-  // - Time bin for Max. Cluster
-  //
-  // Authors:
+  // This is setting fdEdxPlane and fTimBinPlane
+  // Sums up the charge in each plane for track TRDtrack and also get the 
+  // Time bin for Max. Cluster
   // Prashant Shukla (shukla@physi.uni-heidelberg.de)
-  // Alex Bercuci (a.bercuci@gsi.de)
+  //
 
   Double_t  clscharge[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
   Double_t  maxclscharge[AliESDtrack::kNPlane];
   Int_t     nCluster[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
   Int_t     timebin[AliESDtrack::kNPlane];
 
-  // Initialization of variables  
+  // Initialization of cluster charge per plane.  
   for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
     for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
-      clscharge[iPlane][iSlice] = 0.;
+      clscharge[iPlane][iSlice] = 0.0;
       nCluster[iPlane][iSlice]  = 0;
     }
+  }
+
+  // Initialization of cluster charge per plane.  
+  for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
     timebin[iPlane]      =  -1;
     maxclscharge[iPlane] = 0.0;
   }
 
-	// Average PH spectrum used for weighting the edep. It has to
-	// come eather from caligration DB or as parameter of the class. To
-	// be discuss with software responsibles
-	const Float_t fAveragePH[] = { 5.010e-03, 2.017e-02, 6.221e-02, 6.706e-02
-                                     , 5.551e-02, 4.812e-02, 4.395e-02, 4.219e-02
-                                     , 4.172e-02, 4.156e-02, 4.162e-02, 4.204e-02
-                                     , 4.278e-02, 4.367e-02, 4.460e-02, 4.554e-02
-                                     , 4.674e-02, 4.810e-02, 5.005e-02, 5.258e-02
-                                     , 5.587e-02, 5.892e-02, 5.587e-02, 5.258e-02 };
-	
   // Loop through all clusters associated to track TRDtrack
-  AliTRDcluster *pTRDcluster = 0x0;
-  for (Int_t iClus = 0; iClus < TRDtrack.GetNumberOfClusters(); iClus++) {
+  Int_t nClus = TRDtrack.GetNumberOfClusters();  // from Kalmantrack
+  for (Int_t iClus = 0; iClus < nClus; iClus++) {
     Double_t charge = TRDtrack.GetClusterdQdl(iClus);
     Int_t    index  = TRDtrack.GetClusterIndex(iClus);
-    if (!(pTRDcluster = (AliTRDcluster*)GetCluster(index))) continue;
-    
-		// check negative time bins ?!?!?
-		Int_t    tb     = pTRDcluster->GetLocalTimeBin();
-
-		// temporary until fix in GetT0
-		if(tb<0){
-			Warning("CookdEdxTimBin()", Form("Negative time bin value in track %d cluster %d", TRDtrack.GetLabel(), iClus));
-			continue;
-		}
-		
+    AliTRDcluster *pTRDcluster = (AliTRDcluster *) GetCluster(index); 
+    if (!pTRDcluster) {
+      continue;
+    }
+    Int_t    tb     = pTRDcluster->GetLocalTimeBin();
+    if (!tb) {
+      continue;
+    }
     Int_t detector  = pTRDcluster->GetDetector();
     Int_t iPlane    = fGeom->GetPlane(detector);
-
-		// 2 slices method
-		Int_t iSlice = (tb < AliTRDtrack::kMidTimeBin) ? 0 : 1;
-		// weighted edep with 
-		clscharge[iPlane][iSlice] += charge * fAveragePH[tb];
+    if (iPlane >= AliESDtrack::kNPlane) {
+      AliError(Form("Wrong plane %d",iPlane));
+      continue;
+    }
+    Int_t iSlice    = tb * AliESDtrack::kNSlice 
+                         / AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
+    if (iSlice >= AliESDtrack::kNSlice) {
+      AliError(Form("Wrong slice %d",iSlice));
+      continue;
+    }
+    clscharge[iPlane][iSlice] = clscharge[iPlane][iSlice] + charge;
     if (charge > maxclscharge[iPlane]) {
       maxclscharge[iPlane] = charge;
       timebin[iPlane]      = tb;
@@ -3534,18 +3526,31 @@ void AliTRDtracker::CookdEdxTimBin(AliTRDtrack &TRDtrack)
     nCluster[iPlane][iSlice]++;
   } // End of loop over cluster
 
-  // Setting the fdEdxPlane and fTimBinPlane variables
-  Double_t totalCharge = 0.;
+  // Setting the fdEdxPlane and fTimBinPlane variabales 
+  Double_t totalCharge = 0.0;
+
   for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
-		for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
-      //if (nCluster[iPlane][iSlice]) {
-      //  clscharge[iPlane][iSlice] /= nCluster[iPlane][iSlice];
-      //}
+    for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
+      if (nCluster[iPlane][iSlice]) {
+        clscharge[iPlane][iSlice] /= nCluster[iPlane][iSlice];
+      }
       TRDtrack.SetPIDsignals(clscharge[iPlane][iSlice],iPlane,iSlice);
-      totalCharge += clscharge[iPlane][iSlice];
+      totalCharge = totalCharge+clscharge[iPlane][iSlice];
     }
-    TRDtrack.SetPIDTimBin(timebin[iPlane],iPlane);
+    TRDtrack.SetPIDTimBin(timebin[iPlane],iPlane);     
   }
+
+  // Still needed ????
+  //  Int_t i;
+  //  Int_t nc=TRDtrack.GetNumberOfClusters(); 
+  //  Float_t dedx=0;
+  //  for (i=0; iReadDigits(digitsTree));
-
-}
-
 //_____________________________________________________________________________
 Bool_t AliTRDtrigger::ReadTracklets(AliRunLoader *rl) 
 {
diff --git a/TRD/AliTRDtrigger.h b/TRD/AliTRDtrigger.h
index 8682f0258c0..1224e546608 100644
--- a/TRD/AliTRDtrigger.h
+++ b/TRD/AliTRDtrigger.h
@@ -49,8 +49,7 @@ class AliTRDtrigger : public TNamed {
 
           Bool_t   Open(const Char_t *name, Int_t nEvent = 0);
           Bool_t   ReadDigits();
-          Bool_t   ReadDigits(AliRawReader *rawReader);
-          Bool_t   ReadDigits(TTree *digitsTree);
+          Bool_t   ReadDigits(AliRawReader* rawReader);
           Bool_t   MakeTracklets(Bool_t makeTracks = kFALSE);
           void     MakeTracks(Int_t det);
           Bool_t   WriteTracklets(Int_t det);
diff --git a/TRD/AliTRDv1.cxx b/TRD/AliTRDv1.cxx
index bc1b5653243..0c238f9c51b 100644
--- a/TRD/AliTRDv1.cxx
+++ b/TRD/AliTRDv1.cxx
@@ -297,11 +297,12 @@ void AliTRDv1::CreateTRhit(Int_t det)
 
     // Add the hit to the array. TR photon hits are marked 
     // by negative charge
+    // The hit time is needed for pile-up events
     AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber()
           ,det
           ,posHit
           ,-q
-          ,gMC->TrackTime()*1.0e06
+	  ,gMC->TrackTime()*1.0e06
           ,kTRUE);
 
   }
@@ -497,7 +498,7 @@ void AliTRDv1::StepManagerGeant()
       cIdChamber[0]   = cIdCurrent[2];
       cIdChamber[1]   = cIdCurrent[3];
       Int_t idChamber = (atoi(cIdChamber) % kNdetsec);
-      cha = kNcham - ((Int_t) idChamber / kNplan) - 1;
+      cha = ((Int_t) idChamber / kNplan);
       pla = ((Int_t) idChamber % kNplan);
 
       // The detector number
@@ -594,11 +595,12 @@ void AliTRDv1::StepManagerGeant()
         qTot = ((Int_t) (eDelta / kWion) + 1);
 
         // Create a new dEdx hit
+        // The hit time is needed for pile-up events
         AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber()
               ,det
               ,hits
               ,qTot
-              ,gMC->TrackTime()*1.0e06
+	      ,gMC->TrackTime()*1.0e06
               ,drRegion);
 
       }
@@ -744,7 +746,7 @@ void AliTRDv1::StepManagerErmilova()
       cIdChamber[0] = cIdCurrent[2];
       cIdChamber[1] = cIdCurrent[3];
       Int_t idChamber = (atoi(cIdChamber) % kNdetsec);
-      cha = kNcham - ((Int_t) idChamber / kNplan) - 1;
+      cha = ((Int_t) idChamber / kNplan);
       pla = ((Int_t) idChamber % kNplan);
 
       // The detector number
@@ -787,12 +789,13 @@ void AliTRDv1::StepManagerErmilova()
         qTot = ((Int_t) (eDelta / kWion) + 1);
 
 	// Create a new dEdx hit
+        // The hit time is needed for pile-up events
         if (drRegion) {
           AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber()
                 ,det
                 ,hits
                 ,qTot
-                ,gMC->TrackTime()*1.0e06
+		,gMC->TrackTime()*1.0e06
                 ,kTRUE);
 	}
         else {
@@ -800,7 +803,7 @@ void AliTRDv1::StepManagerErmilova()
                 ,det
                 ,hits
                 ,qTot
-                ,gMC->TrackTime()*1.0e06
+		,gMC->TrackTime()*1.0e06
                 ,kFALSE);
 	}
 
@@ -936,13 +939,13 @@ void AliTRDv1::StepManagerFixedStep()
   cIdChamber[0]   = cIdCurrent[2];
   cIdChamber[1]   = cIdCurrent[3];
   Int_t idChamber = (atoi(cIdChamber) % kNdetsec);
-  cha = kNcham - ((Int_t) idChamber / kNplan) - 1;
+  cha = ((Int_t) idChamber / kNplan);
   pla = ((Int_t) idChamber % kNplan);
 
   // The detector number
   det = fGeometry->GetDetector(pla,cha,sec);
 
-  // 0: InFlight 1:Entering 2:Exiting
+  // 0:InFlight 1:Entering 2:Exiting
   Int_t trkStat = 0;
 
   // Special hits only in the drift region
@@ -976,6 +979,7 @@ void AliTRDv1::StepManagerFixedStep()
   
   // Calculate the charge according to GEANT Edep
   // Create a new dEdx hit
+  // The hit time is needed for pile-up events
   eDep = TMath::Max(gMC->Edep(),0.0) * 1.0e+09;
   qTot = (Int_t) (eDep / kWion);
   if ((qTot) ||
@@ -984,7 +988,7 @@ void AliTRDv1::StepManagerFixedStep()
           ,det
           ,hits
           ,qTot
-          ,gMC->TrackTime()*1.0e06
+	  ,gMC->TrackTime()*1.0e06
           ,drRegion);
   }
 
diff --git a/TRD/Cal/AliTRDCalPIDLQ.cxx b/TRD/Cal/AliTRDCalPIDLQ.cxx
index c8ab5ca56dd..6d8edcae754 100644
--- a/TRD/Cal/AliTRDCalPIDLQ.cxx
+++ b/TRD/Cal/AliTRDCalPIDLQ.cxx
@@ -15,84 +15,56 @@
 
 /* $Id$ */
 
-//////////////////////////////////////////////////////////////////////////
-//                                                                      //
-// Container for the distributions of dE/dx and the time bin of the     //
-// max. cluster for electrons and pions                                 //
-//                                                                      //
-// Authors:                                                             //
-//   Prashant Shukla                //
-//   Alex Bercuci                                     //
-//                                                                      //
-//////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// Container for the distributions of dE/dx and the time bin of the          //
+// max. cluster for electrons and pions                                      //
+//                                                                           //
+// Author:                                                                   //
+//   Prashant Shukla                     //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
 
 #include 
-#include 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
 
 #include "AliLog.h"
-#include "AliHeader.h"
-#include "AliGenEventHeader.h"
-#include "AliRun.h"
-#include "AliRunLoader.h"
-#include "AliStack.h"
 #include "AliPID.h"
-#include "AliESD.h"
-#include "AliESDtrack.h"
 
 #include "AliTRDCalPIDLQ.h"
-#include "AliTRDCalPIDLQRef.h"
-#include "AliTRDpidESD.h"
-#include "AliTRDcalibDB.h"
-#include "AliTRDtrack.h"
-#include "AliTRDgeometry.h"
 
 ClassImp(AliTRDCalPIDLQ)
 
 Char_t* AliTRDCalPIDLQ::fpartName[AliPID::kSPECIES] = {"electron", "muon", "pion", "kaon", "proton"};
-Char_t* AliTRDCalPIDLQ::fpartSymb[AliPID::kSPECIES] = {"EL", "MU", "PI", "KA", "PR"};
     
 //_________________________________________________________________________
 AliTRDCalPIDLQ::AliTRDCalPIDLQ()
-  :TNamed("pid", "PID for TRD")
+  :TNamed()
   ,fNMom(0)
-  ,fTrackMomentum(0x0)
-  ,fNLength(0)
-  ,fTrackSegLength(0x0)
-  ,fNTimeBins(0)
+  ,fTrackMomentum(0)
   ,fMeanChargeRatio(0)
   ,fNbins(0)
   ,fBinSize(0)
-  ,fHistdEdx(0x0)
-  ,fHistTimeBin(0x0)
-  ,fEstimator(0x0)
+  ,fHistdEdx(0)
+  ,fHistTimeBin(0)
 {
   //
   //  The Default constructor
   //
-
-	Init();
+  
 }
 
 //_________________________________________________________________________
 AliTRDCalPIDLQ::AliTRDCalPIDLQ(const Text_t *name, const Text_t *title) 
   :TNamed(name,title)
   ,fNMom(0)
-  ,fTrackMomentum(0x0)
-  ,fNLength(0)
-  ,fTrackSegLength(0x0)
-  ,fNTimeBins(0)
+  ,fTrackMomentum(0)
   ,fMeanChargeRatio(0)
   ,fNbins(0)
   ,fBinSize(0)
-  ,fHistdEdx(0x0)
-  ,fHistTimeBin(0x0)
-  ,fEstimator(0x0)
+  ,fHistdEdx(0)
+  ,fHistTimeBin(0)
 {
   //
   //  The main constructor
@@ -106,23 +78,31 @@ AliTRDCalPIDLQ::AliTRDCalPIDLQ(const Text_t *name, const Text_t *title)
 AliTRDCalPIDLQ::AliTRDCalPIDLQ(const AliTRDCalPIDLQ &c) 
   :TNamed(c)
   ,fNMom(c.fNMom)
-  ,fTrackMomentum(0x0)
-  ,fNLength(c.fNLength)
-  ,fTrackSegLength(0x0)
-  ,fNTimeBins(c.fNTimeBins)
+  ,fTrackMomentum(0)
   ,fMeanChargeRatio(c.fMeanChargeRatio)
   ,fNbins(c.fNbins)
   ,fBinSize(c.fBinSize)
-  ,fHistdEdx(0x0)
-  ,fHistTimeBin(0x0)
-  ,fEstimator(0x0)
+  ,fHistdEdx(0)
+  ,fHistTimeBin(0)
 {
   //
   // Copy constructor
   //
 
-  if (this != &c) ((AliTRDCalPIDLQ &) c).Copy(*this);
+  AliTRDCalPIDLQ& target = (AliTRDCalPIDLQ &) c;
   
+  target.fTrackMomentum = new Double_t[fNMom];
+  for (Int_t i=0; iClone();
+  }  
+
+  if (fHistTimeBin) {
+    target.fHistTimeBin = (TObjArray*) fHistTimeBin->Clone();
+  }
+
 }
 
 //_________________________________________________________________________
@@ -145,27 +125,17 @@ void AliTRDCalPIDLQ::CleanUp()
 
   if (fHistdEdx) {
     delete fHistdEdx;
-    fHistdEdx = 0x0;
+    fHistdEdx = 0;
   }
   
   if (fHistTimeBin) {
     delete fHistTimeBin;
-    fHistTimeBin = 0x0;
+    fHistTimeBin = 0;
   }
 
   if (fTrackMomentum) {
     delete[] fTrackMomentum;
-    fTrackMomentum = 0x0;
-  }
-
-  if (fTrackSegLength) {
-    delete[] fTrackSegLength;
-    fTrackSegLength = 0x0;
-  }
-
-  if (fEstimator) {
-    delete fEstimator;
-    fEstimator = 0x0;
+    fTrackMomentum = 0;
   }
 
 }
@@ -193,23 +163,16 @@ void AliTRDCalPIDLQ::Copy(TObject &c) const
   
   target.CleanUp();
   
+  target.fNMom            = fNMom;
   target.fNbins           = fNbins;
   target.fBinSize         = fBinSize;
   target.fMeanChargeRatio = fMeanChargeRatio;
-  target.fNTimeBins       = fNTimeBins;
-
-  //target.fNMom            = fNMom;
+  
   target.fTrackMomentum = new Double_t[fNMom];
   for (Int_t i=0; iClone();
   }
@@ -217,8 +180,6 @@ void AliTRDCalPIDLQ::Copy(TObject &c) const
     target.fHistTimeBin = (TObjArray*) fHistTimeBin->Clone();
   }
 
-  target.fEstimator = new AliTRDCalPIDLQRef(*fEstimator);
-
   TObject::Copy(c);
 
 }
@@ -230,54 +191,33 @@ void AliTRDCalPIDLQ::Init()
   // Initialization
   //
 
-  fNMom    = 11;
-  fNLength =  4;
+  const Int_t kNMom = 11;
 
+  fNMom = kNMom;
   fTrackMomentum = new Double_t[fNMom];
-  fTrackMomentum[0] = 0.6;
-  fTrackMomentum[1] = 0.8;
-  fTrackMomentum[2] = 1.0;
-  fTrackMomentum[3] = 1.5;
-  fTrackMomentum[4] = 2.0;
-  fTrackMomentum[5] = 3.0;
-  fTrackMomentum[6] = 4.0;
-  fTrackMomentum[7] = 5.0;
-  fTrackMomentum[8] = 6.0;
-  fTrackMomentum[9] = 8.0;
-  fTrackMomentum[10] = 10.0;
-  
-  fTrackSegLength = new Double_t[fNLength];
-  fTrackSegLength[0] = 3.7;
-  fTrackSegLength[1] = 3.9;
-  fTrackSegLength[2] = 4.2;
-  fTrackSegLength[3] = 5.0;
-
-  fHistdEdx    = new TObjArray(AliPID::kSPECIES * fNMom/* * fNLength*/);
+  Double_t trackMomentum[kNMom] = {  0.6,  0.8,  1.0,  1.5,  2.0
+                                  ,  3.0,  4.0,  5.0,  6.0,  8.0
+                                  , 10.0 };
+  for (Int_t imom = 0; imom < kNMom; imom++) {
+    fTrackMomentum[imom] = trackMomentum[imom];
+  }  
+
+  fHistdEdx    = new TObjArray(AliPID::kSPECIES * fNMom);
   fHistdEdx->SetOwner();
-  fHistTimeBin = new TObjArray(2 * fNMom);
+  fHistTimeBin = new TObjArray(AliPID::kSPECIES * fNMom);
   fHistTimeBin->SetOwner();  
-	// Initialization of estimator at object instantiation because late
-	// initialization in function GetProbability() is not working due to
-	// constantness of this function. 
-	fEstimator = new AliTRDCalPIDLQRef();
-
-	// Number of Time bins
-	AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
-	if(!calibration){
-		AliWarning("No AliTRDcalibDB available. Using 22 time bins.");
-		fNTimeBins = 22;
-	} else fNTimeBins = calibration->GetNumberOfTimeBins();
-	
+  
   // ADC Gain normalization
   fMeanChargeRatio = 1.0;
   
   // Number of bins and bin size
   fNbins   = 0;
   fBinSize = 0.0;
+
 }
 
 //_________________________________________________________________________
-Bool_t AliTRDCalPIDLQ::ReadReferences(Char_t *responseFile)
+Bool_t AliTRDCalPIDLQ::ReadData(Char_t *responseFile)
 {
   //
   // Read the TRD dEdx histograms.
@@ -292,462 +232,211 @@ Bool_t AliTRDCalPIDLQ::ReadReferences(Char_t *responseFile)
   gROOT->cd();
 
   // Read histograms
-  for (Int_t iparticle = 0; iparticle < AliPID::kSPECIES; iparticle++){
-    for (Int_t imom = 0; imom < fNMom; imom++){
-			TH2D* hist = (TH2D*)histFile->Get(Form("h2dEdx%s%02d", fpartSymb[iparticle], imom/*, ilength*/))->Clone();
-			hist->Scale(1./hist->Integral());
-			fHistdEdx->AddAt(hist, GetHistID(iparticle, imom));
-
-			if (iparticle != AliPID::kElectron && iparticle != AliPID::kPion) continue;
-
-			TH1F* ht = (TH1F*)histFile->Get(Form("h1MaxTB%s%02d", fpartSymb[iparticle], imom))->Clone();
-			if(ht->GetNbinsX() != fNTimeBins) AliWarning(Form("The number of time bins %d defined in h1MaxTB%s%02d differs from calibration value of %d. This may lead to erroneous results.", ht->GetNbinsX(), fpartSymb[iparticle], imom, fNTimeBins));
-			ht->Scale(1./ht->Integral());
-			fHistTimeBin->AddAt(ht, ((iparticle==AliPID::kElectron)?0:1)*fNMom + imom);
-		}
+  Char_t text[200];
+  for (Int_t particle = 0; particle < AliPID::kSPECIES; ++particle)
+  {
+    Char_t* particleKey = "";
+    switch (particle)
+    {
+      case AliPID::kElectron: particleKey = "EL"; break;
+      case AliPID::kPion: particleKey = "PI"; break;
+      case AliPID::kMuon: particleKey = "MU"; break;
+      case AliPID::kKaon: particleKey = "KA"; break;
+      case AliPID::kProton: particleKey = "PR"; break;
+    }
+    
+    for (Int_t imom = 0; imom < fNMom; imom++) 
+    {
+      sprintf(text, "h1dEdx%s%01d", particleKey, imom+1);
+      TH1F* hist = (TH1F*)histFile->Get(text)->Clone();
+      hist->Scale(1.0/hist->Integral());
+      fHistdEdx->AddAt(hist, GetHistID(particle, imom));
+  
+      if (particle == AliPID::kElectron || particle == AliPID::kPion)
+      {
+        sprintf(text,"h1MaxTimBin%s%01d", particleKey, imom+1);
+        TH1F* hist = (TH1F*)histFile->Get(text)->Clone();
+        hist->Scale(1.0/hist->Integral());
+        fHistTimeBin->AddAt(hist, GetHistID(particle,imom));
+      }
+    }
   }
   
   histFile->Close();
   delete histFile;
   
   // Number of bins and bin size
-  //TH1F* hist = (TH1F*) fHistdEdx->At(GetHistID(AliPID::kPion, 1));
-  //fNbins   = hist->GetNbinsX();
-  //fBinSize = hist->GetBinWidth(1);
+  TH1F* hist = (TH1F*) fHistdEdx->At(GetHistID(AliPID::kPion, 1));
+  fNbins   = hist->GetNbinsX();
+  fBinSize = hist->GetBinWidth(1);
   
   return kTRUE;
 
 }
 
-// //_________________________________________________________________________
-// Double_t  AliTRDCalPIDLQ::GetMean(Int_t k, Int_t ip) const
-// {
-//   //
-//   // Gets mean of de/dx dist. of e
-//   //
-// 
-//   AliInfo(Form("Mean for particle = %s and momentum = %.2f is:\n"
-//               ,fpartName[k]
-//               ,fTrackMomentum[ip]));
-//   if (k < 0 || k > AliPID::kSPECIES) {
-//     return 0;
-//   }
-// 
-//   return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->GetMean();
-// 
-// }
-// 
-// //_________________________________________________________________________
-// Double_t  AliTRDCalPIDLQ::GetNormalization(Int_t k, Int_t ip) const
-// {
-//   //
-//   // Gets Normalization of de/dx dist. of e
-//   //
-// 
-//   AliInfo(Form("Normalization for particle = %s and momentum = %.2f is:\n"
-//               ,fpartName[k]
-//               ,fTrackMomentum[ip]));
-//   if (k < 0 || k > AliPID::kSPECIES) {
-//     return 0;
-//   }
-//   
-//   return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->Integral();
-// 
-// }
+//_________________________________________________________________________
+Double_t  AliTRDCalPIDLQ::GetMean(Int_t k, Int_t ip) const
+{
+  //
+  // Gets mean of de/dx dist. of e
+  //
+
+  AliInfo(Form("Mean for particle = %s and momentum = %.2f is:\n"
+              ,fpartName[k]
+              ,fTrackMomentum[ip]));
+  if (k < 0 || k > AliPID::kSPECIES) {
+    return 0;
+  }
+
+  return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->GetMean();
+
+}
 
 //_________________________________________________________________________
-TH1* AliTRDCalPIDLQ::GetHistogram(Int_t k, Int_t ip/*, Int_t il*/) const
+Double_t  AliTRDCalPIDLQ::GetNormalization(Int_t k, Int_t ip) const
 {
   //
-  // Returns one selected dEdx histogram
+  // Gets Normalization of de/dx dist. of e
   //
 
-  if (k < 0 || k >= AliPID::kSPECIES) return 0x0;
-	if(ip<0 || ip>= fNMom ) return 0x0;
+  AliInfo(Form("Normalization for particle = %s and momentum = %.2f is:\n"
+              ,fpartName[k]
+              ,fTrackMomentum[ip]));
+  if (k < 0 || k > AliPID::kSPECIES) {
+    return 0;
+  }
+  
+  return ((TH1F*) fHistdEdx->At(GetHistID(k,ip)))->Integral();
+
+}
 
-	AliInfo(Form("Retrive dEdx histogram for %s of %5.2f GeV/c", fpartName[k], fTrackMomentum[ip]));
+//_________________________________________________________________________
+TH1F* AliTRDCalPIDLQ::GetHistogram(Int_t k, Int_t ip) const
+{
+  //
+  // Returns one selected dEdx histogram
+  //
+
+  AliInfo(Form("Histogram for particle = %s and momentum = %.2f is:\n"
+              ,fpartName[k]
+              ,fTrackMomentum[ip]));
+  if (k < 0 || k > AliPID::kSPECIES) {
+    return 0;
+  }
   
-  return (TH1*)fHistdEdx->At(GetHistID(k, ip));
+  return (TH1F*) fHistdEdx->At(GetHistID(k,ip));
 
 }
 
 //_________________________________________________________________________
-TH1* AliTRDCalPIDLQ::GetHistogramT(Int_t k, Int_t ip) const
+TH1F* AliTRDCalPIDLQ::GetHistogramT(Int_t k, Int_t ip) const
 {
   //
   // Returns one selected time bin max histogram
   //
 
-  if (k < 0 || k >= AliPID::kSPECIES) return 0x0;
-	if(ip<0 || ip>= fNMom ) return 0x0;
-	  
- 	AliInfo(Form("Retrive MaxTB histogram for %s of %5.2f GeV/c", fpartName[k], fTrackMomentum[ip]));
+  AliInfo(Form("Histogram for particle = %s and momentum = %.2f is:\n"
+              ,fpartName[k]
+              ,fTrackMomentum[ip]));
+  if (k < 0 || k > AliPID::kSPECIES)
+    return 0;
+  
+  return (TH1F*) fHistTimeBin->At(GetHistID(k,ip));
 
-	return (TH1*)fHistTimeBin->At(((k==AliPID::kElectron)?0:1)*fNMom+ip);
 }
 
 //_________________________________________________________________________
-Double_t AliTRDCalPIDLQ::GetProbability(Int_t spec, Double_t mom, Double_t *dedx, Double_t length) const 
+Double_t AliTRDCalPIDLQ::GetProbability(Int_t k, Double_t mom, Double_t dedx1) const
 {
   //
-	// Core function of AliTRDCalPIDLQ class for calculating the
-	// likelihood for species "spec" (see AliTRDtrack::kNspecie) of a
-	// given momentum "mom" and a given dE/dx (slice "dedx") yield per
-	// layer
+  // Gets the Probability of having dedx at a given momentum (mom)
+  // and particle type k (0 for e) and (2 for pi)
+  // from the precalculated de/dx distributions 
   //
+  
+  Double_t dedx   = dedx1/fMeanChargeRatio;
+  Int_t    iEnBin = ((Int_t) (dedx/fBinSize+1));
+  if(iEnBin > fNbins) iEnBin = fNbins;
 
-	if (spec < 0 || spec >= AliPID::kSPECIES) return 0.;
-		
-	//Double_t dedx   = dedx1/fMeanChargeRatio;
-	
-	// find the interval in momentum and track segment length which applies for this data
-	Int_t ilength = 1;
-  while(ilengthfTrackSegLength[ilength]){
-		ilength++;
-	}
-	Int_t imom = 1;
-  while(imomfTrackMomentum[imom]) imom++;
-	
-	Int_t nbinsx, nbinsy;
-	TAxis *ax = 0x0, *ay = 0x0;
-	Double_t LQ1, LQ2;
-	Double_t mom1 = fTrackMomentum[imom-1], mom2 = fTrackMomentum[imom];
-	TH2 *hist = 0x0;
-	if(!(hist = (TH2D*)fHistdEdx->At(GetHistID(spec, imom-1/*, ilength*/)))){
-		AliInfo(Form("Looking for spec(%d) mom(%f) Ex(%f) Ey(%f) length(%f)", spec, mom, dedx[0], dedx[1], length));
-		AliError(Form("EHistogram id %d not found in DB.", GetHistID(spec, imom-1)));
-		return 0.;
-	}
-	ax = hist->GetXaxis(); nbinsx = ax->GetNbins();
-	ay = hist->GetYaxis(); nbinsy = ay->GetNbins();
-	Bool_t kX = (dedx[0] < ax->GetBinUpEdge(nbinsx));
-	Bool_t kY = (dedx[1] < ay->GetBinUpEdge(nbinsy));
-	if(kX)
-		if(kY) LQ1 = hist->GetBinContent( hist->FindBin(dedx[0], dedx[1])); //fEstimator->Estimate2D2(hist, (Float_t&)dedx[0], (Float_t&)dedx[1]);
-		else LQ1 = hist->GetBinContent(ax->FindBin(dedx[0]), nbinsy);
-	else
-		if(kY) LQ1 = hist->GetBinContent(nbinsx, ay->FindBin(dedx[1]));
-	 	else LQ1 = hist->GetBinContent(nbinsx, nbinsy);
-
-
-	if(!(hist = (TH2D*)fHistdEdx->At(GetHistID(spec, imom/*, ilength*/)))){
-		AliInfo(Form("Looking for spec(%d) mom(%f) Ex(%f) Ey(%f) length(%f)", spec, mom, dedx[0], dedx[1], length));
-		AliError(Form("EHistogram id %d not found in DB.", GetHistID(spec, imom)));
-		return LQ1;
-	}
-	if(kX)
-		if(kY) LQ2 = hist->GetBinContent( hist->FindBin(dedx[0], dedx[1])); //fEstimator->Estimate2D2(hist, (Float_t&)dedx[0], (Float_t&)dedx[1]);
-		else LQ2 = hist->GetBinContent(ax->FindBin(dedx[0]), nbinsy);
-	else
-		if(kY) LQ2 = hist->GetBinContent(nbinsx, ay->FindBin(dedx[1]));
-	 	else LQ2 = hist->GetBinContent(nbinsx, nbinsy);
-
-	
-	// return interpolation over momentum binning
-  return LQ1 + (LQ2 - LQ1)*(mom - mom1)/(mom2 - mom1);
+  if (k < 0 || k > AliPID::kSPECIES) {
+    return 1;
+  }
+  
+  TH1F* hist1 = 0;
+  TH1F* hist2 = 0;
+  Double_t mom1 = 0;
+  Double_t mom2 = 0;
+  
+  // Lower limit
+  if (mom<=fTrackMomentum[0])  {
+    hist1 = (TH1F*) fHistdEdx->At(GetHistID(k,1));
+    hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,0));
+    mom1 = fTrackMomentum[1];
+    mom2 = fTrackMomentum[0];
+  }
+    
+  // Upper Limit
+  if(mom>=fTrackMomentum[fNMom-1]) {
+    hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,fNMom-1));
+    hist1 = (TH1F*) fHistdEdx->At(GetHistID(k,fNMom-2));
+    mom2 = fTrackMomentum[fNMom-1];
+    mom1 = fTrackMomentum[fNMom-2];
+  }
+    
+  // In the range
+  for (Int_t ip=1; ipAt(GetHistID(k,ip));
+      hist2 = (TH1F*) fHistdEdx->At(GetHistID(k,ip-1));
+      mom1 = fTrackMomentum[ip];
+      mom2 = fTrackMomentum[ip-1];
+    }
+  }
+  
+  Double_t slop = (hist1->GetBinContent(iEnBin) - hist2->GetBinContent(iEnBin)) 
+                / (mom1 - mom2);
+  return hist2->GetBinContent(iEnBin) + slop * (mom - mom2);
 
 }
 
 //_________________________________________________________________________
-Double_t AliTRDCalPIDLQ::GetProbabilityT(Int_t spec, Double_t mom, Int_t timbin) const
+Double_t AliTRDCalPIDLQ::GetProbabilityT(Int_t k, Double_t mom, Int_t timbin) const
 {
   //
   // Gets the Probability of having timbin at a given momentum (mom)
-  // and particle type (spec) (0 for e) and (2 for pi)
+  // and particle type k (0 for e) and (2 for pi)
   // from the precalculated timbin distributions 
   //
   
-	if (spec < 0 || spec >= AliPID::kSPECIES) return 0.;
-  if (timbin<0 || timbin >= fNTimeBins) return 0.;
+  if (timbin<=0) {
+    return 0.0;
+  }
 
   Int_t iTBin = timbin+1;
   
   // Everything which is not an electron counts as a pion for time bin max
-  //if(spec != AliPID::kElectron) spec = AliPID::kPion;
-  
-
-  
-	Int_t imom = 1;
-  while(imomfTrackMomentum[imom]) imom++;
-
-	Double_t mom1 = fTrackMomentum[imom-1], mom2 = fTrackMomentum[imom];
-	TH1F *hist = 0x0;
-	if(!(hist = (TH1F*) fHistTimeBin->At(((spec==AliPID::kElectron)?0:1)*fNMom+imom-1))){
-		AliInfo(Form("Looking for spec(%d) mom(%f) timbin(%d)", spec, mom, timbin));
-		AliError(Form("THistogram id %d not found in DB.", ((spec==AliPID::kElectron)?0:1)*fNMom+imom-1));
-		return 0.;
-	}
-	Double_t LQ1 = hist->GetBinContent(iTBin);
-
-	if(!(hist = (TH1F*) fHistTimeBin->At(((spec==AliPID::kElectron)?0:1)*fNMom+imom))){
-		AliInfo(Form("Looking for spec(%d) mom(%f) timbin(%d)", spec, mom, timbin));
-		AliError(Form("THistogram id %d not found in DB.", ((spec==AliPID::kElectron)?0:1)*fNMom+imom));
-		return LQ1;
-	}
-	Double_t LQ2 = hist->GetBinContent(iTBin);
-
-	// return interpolation over momentum binning
-  return LQ1 + (LQ2 - LQ1)*(mom - mom1)/(mom2 - mom1);
-}
+  if (k != AliPID::kElectron) {
+    k = AliPID::kPion;
+  }
 
-//__________________________________________________________________
-Bool_t AliTRDCalPIDLQ::WriteReferences(Char_t *File, Char_t *dir)
-{
-	// Build, Fill and write to file the histograms used for PID.
-	// The simulations are looked in the
-	// directories with the general form Form("p%3.1f", momentum)
-	// starting from dir (default .). Here momentum belongs to the list
-	// of known momentum to PID (see fTrackMomentum).
-	// The output histograms are
-	// written to the file "File" in cwd (default
-	// TRDPIDHistograms.root). In order to build a DB entry
-	// consider running $ALICE_ROOT/Cal/AliTRDCreateDummyCDB.C
-	// 
-	// Author:
-	// Alex Bercuci (A.Bercuci@gsi.de)
-
-	const Int_t nDirs = 1;
-  Int_t partCode[AliPID::kSPECIES] =
-    {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton};
-	
-	// minimal test of simulation location
-	TFile *f = new TFile(Form("%s/p%3.1f/galice.root", dir, 2.));
-	if(!f || f->IsZombie()){
-		AliError(Form("Could not access file galice in directry \"%s/p%3.1f\". Please check the location and try again.", dir, 2.));
-		return kFALSE;
-	}
-	f->Close(); delete f;
-	f = new TFile(Form("%s/p%3.1f/AliESDs.root", dir, 2.));
-	if(!f || f->IsZombie()){
-		AliError(Form("Could not access file AliESDs in directry \"%s/p%3.1f\". Please check the location and try again.", dir, 2.));
-		return kFALSE;
-	}
-	f->Close(); delete f;
-	
-
-	// Init statistics
-	Int_t nPart[AliPID::kSPECIES], nTotPart;
-	printf("P[GeV/c] ");
-	for(Int_t ispec=0; ispec0)?1:0] = new TH1F(Form("h1%s", fpartSymb[ispec]), "", fNTimeBins, -.5, fNTimeBins-.5);
-		h1MaxTB[(ispec>0)?1:0]->SetLineColor(color[ispec]);
+  if (mom<=fTrackMomentum[0]) {
+    return ((TH1F*) fHistTimeBin->At(GetHistID(k,0)))->GetBinContent(iTBin);
+  }
+  if (mom>=fTrackMomentum[fNMom-1]) { 
+    return ((TH1F*) fHistTimeBin->At(GetHistID(k,fNMom-1)))->GetBinContent(iTBin);
   }
-	AliTRDCalPIDLQRef ref;
-	
-	// momentum loop
-	AliRunLoader *fRunLoader = 0x0;
-	TFile *esdFile = 0x0;
-	TTree *esdTree = 0x0;
-	AliESD *esd = 0x0;
-	AliESDtrack *esdTrack = 0x0;
-	for (Int_t imom = 0; imom < fNMom; imom++) {
-	//for (Int_t imom = 4; imom < 5; imom++) {
-		ref.Reset();
-		
-		for(Int_t idir = 0; idirSetDirName(s);
-			fRunLoader->LoadgAlice();
-			gAlice = fRunLoader->GetAliRun();
-			if (!gAlice) {
-				AliError(Form("galice object not found for momentum %3.1f.", fTrackMomentum[imom]));
-				return kFALSE;
-			}
-			fRunLoader->LoadKinematics();
-			fRunLoader->LoadHeader();
-	
-			// open the ESD file
-			esdFile = TFile::Open(Form("%s/p%3.1f/AliESDs.root", dir, fTrackMomentum[imom]));
-			if (!esdFile || esdFile->IsZombie()) {
-				AliError(Form("Opening ESD file failed for momentum", fTrackMomentum[imom]));
-				return kFALSE;
-			}
-			esd = new AliESD;
-			esdTree = (TTree*)esdFile->Get("esdTree");
-			if (!esdTree) {
-				AliError(Form("ESD tree not found for momentum %3.1f.", fTrackMomentum[imom]));
-				return kFALSE;
-			}
-			esdTree->SetBranchAddress("ESD", &esd);
-			nTotPart = 0;
-			for(Int_t ispec=0; ispecGetNumberOfEvents(); iEvent++) {
-				fRunLoader->GetEvent(iEvent);
-	
-				// read stack info
-				AliStack* stack = gAlice->Stack();
-				TArrayF vertex(3);
-				fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(vertex);
-							
-				// Load event summary data
-				esdTree->GetEvent(iEvent);
-				if (!esd) {
-					AliWarning(Form("ESD object not found for event %d. [@ momentum %3.1f]", iEvent, imom));
-					continue;
-				}
-	
-				for(Int_t iTrack=0; iTrackGetNumberOfTracks(); iTrack++){
-					esdTrack = esd->GetTrack(iTrack);
-	
-					if(!AliTRDpidESD::CheckTrack(esdTrack)) continue;
-					//if((esdTrack->GetStatus() & AliESDtrack::kITSrefit) == 0) continue;
-					//if(esdTrack->GetConstrainedChi2() > 1E9) continue;
-					//if ((esdTrack->GetStatus() & AliESDtrack::kESDpid) == 0) continue;
-					if (esdTrack->GetTRDsignal() == 0.) continue;
-	
-					// read MC info
-					Int_t label = esdTrack->GetLabel();
-					if(label<0) continue;
-					if (label > stack->GetNtrack()) continue;     // background
-					TParticle* particle = stack->Particle(label);
-					if(!particle){
-						AliWarning(Form("Retriving particle with index %d from AliStack failed. [@ event %d track %d]", label, iEvent, iTrack));
-						continue;
-					}
-					if(particle->Pt() < 1.E-3) continue;
-					//      if (TMath::Abs(particle->Eta()) > 0.3) continue;
-					TVector3 dVertex(particle->Vx() - vertex[0],
-										particle->Vy() - vertex[1],
-										particle->Vz() - vertex[2]);
-					if (dVertex.Mag() > 1.E-4){
-						//AliInfo(Form("Particle with index %d generated too far from vertex. Skip from analysis. Details follows. [@ event %d track %d]", label, iEvent, iTrack));
-						//particle->Print();
-						continue;
-					}
-					Int_t iGen = -1;
-					for (Int_t ispec=0; ispecGetPdgCode()) == partCode[ispec]){
-							iGen = ispec;
-							break;
-						}
-					if(iGen<0) continue;
-	
-					nPart[iGen]++; nTotPart++;
-					
-					Float_t mom, length;
-					Double_t dedx[AliTRDtrack::kNslice], dEdx;
-					Int_t timebin;
-					for (Int_t iPlane=0; iPlaneGetTRDsignals(iPlane, iSlice);
-						dEdx    = esdTrack->GetTRDsignals(iPlane, -1);
-						timebin = esdTrack->GetTRDTimBin(iPlane);
-			
-						// check data
-						if ((dEdx <=  0.) || (timebin <= -1.)) continue;
-			
-						// retrive kinematic info for this track segment
-						if(!AliTRDpidESD::GetTrackSegmentKine(esdTrack, iPlane, mom, length)) continue;
-						
-						// find segment length and momentum bin
-						Int_t jmom = 1, refMom = -1;
-						while(jmomfTrackMomentum[jmom]) jmom++;
-						if(TMath::Abs(fTrackMomentum[jmom-1] - mom) < fTrackMomentum[jmom-1] * .2) refMom = jmom-1;
-						else if(TMath::Abs(fTrackMomentum[jmom] - mom) < fTrackMomentum[jmom] * .2) refMom = jmom;
-						if(refMom<0){
-							AliInfo(Form("Momentum at plane %d entrance not in momentum window. [@ event %d track %d]", iPlane, iEvent, iTrack));
-							continue;
-						}
-						/*while(jlengfTrackSegLength[jleng]) jleng++;*/
-						
-						// this track segment has fulfilled all requierments
-						//nPlanePID++;
-
-						if(dedx[0] > 0. && dedx[1] > 0.){
-							dedx[0] = log(dedx[0]); dedx[1] = log(dedx[1]);
-							ref.GetPrincipal(iGen)->AddRow(dedx);
-						}
-						h1MaxTB[(iGen>0)?1:0]->Fill(timebin);
-					} // end plane loop
-				} // end track loop
-			} // end events loop
-			
-			delete esd; esd = 0x0;
-			esdFile->Close();
-			delete esdFile; esdFile = 0x0;
-	
-			fRunLoader->UnloadHeader();
-			fRunLoader->UnloadKinematics();
-			delete fRunLoader; fRunLoader = 0x0;
-		} // end directory loop
-		
-		// use data to prepare references
-		ref.Prepare2DReferences();
-		// save this dEdx references
-		ref.SaveReferences(imom, File);
-		// save MaxTB references
-		SaveMaxTimeBin(imom, File);
-
-			
-		// print momentum statistics
-		printf("  %3.1f  ", fTrackMomentum[imom]);
-		for(Int_t ispec=0; ispecGetListOfFiles());
-	while((fSave=(TFile*)it.Next()))
-		if(strcmp(File, fSave->GetName())==0) break;
-
-	fSave->cd();
-	fSave->Close();
-	delete fSave;
-
-	return kTRUE;
-}
 
-//__________________________________________________________________
-void	AliTRDCalPIDLQ::SaveMaxTimeBin(const Int_t mom, const char *fn)
-{
-  //
-  // Save the histograms
-  //
+  for (Int_t ip=1; ipAt(GetHistID(k,ip)))->GetBinContent(iTBin) 
+                     - ((TH1F*) fHistTimeBin->At(GetHistID(k,ip-1)))->GetBinContent(iTBin)) 
+                    / (fTrackMomentum[ip] - fTrackMomentum[ip-1]);
+      // Linear interpolation
+      return ((TH1F*) fHistTimeBin->At(GetHistID(k,ip-1)))->GetBinContent(iTBin) 
+              + slop * (mom - fTrackMomentum[ip-1]);
+    }
+  }
+  
+  return -1;
 
-	TFile *fSave = 0x0;
-	TListIter it((TList*)gROOT->GetListOfFiles());
-	TDirectory *pwd = gDirectory;
-	Bool_t kFOUND = kFALSE;
-	while((fSave=(TFile*)it.Next()))
-		if(strcmp(fn, fSave->GetName())==0){
-			kFOUND = kTRUE;
-			break;
-		}
-	if(!kFOUND) fSave = new TFile(fn, "RECREATE");
-	fSave->cd();
-
-	TH1 *h;
-	h = (TH1F*)h1MaxTB[0]->Clone(Form("h1MaxTBEL%02d", mom));
-	h->SetTitle(Form("Maximum Time Bin distribution for electrons @ %4.1f GeV", fTrackMomentum[mom]));
-	h->GetXaxis()->SetTitle("time [100 ns]");
-	h->GetYaxis()->SetTitle("Probability");
-	h->Write();
-
-	h = (TH1F*)h1MaxTB[1]->Clone(Form("h1MaxTBPI%02d", mom));
-	h->SetTitle(Form("Maximum Time Bin distribution for pions @ %4.1f GeV", fTrackMomentum[mom]));
-	h->GetXaxis()->SetTitle("time [100 ns]");
-	h->GetYaxis()->SetTitle("Probability");
-	h->Write();
-	
-	pwd->cd();
 }
-
diff --git a/TRD/Cal/AliTRDCalPIDLQ.h b/TRD/Cal/AliTRDCalPIDLQ.h
index e47b29170f5..a1c92966db7 100644
--- a/TRD/Cal/AliTRDCalPIDLQ.h
+++ b/TRD/Cal/AliTRDCalPIDLQ.h
@@ -15,78 +15,58 @@
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#ifndef ROOT_TNamed
 #include 
-#endif
 
-class TH1;
+class TH1F;
 class TObjArray;
-class AliTRDCalPIDLQRef;
 
 class AliTRDCalPIDLQ : public TNamed {
 
- friend class AliTRDCalPIDLQRef;
-
  public:
 
-  AliTRDCalPIDLQ();
+  AliTRDCalPIDLQ(); 
   AliTRDCalPIDLQ(const Text_t *name, const Text_t *title);
   AliTRDCalPIDLQ(const AliTRDCalPIDLQ& pd);
-  virtual        ~AliTRDCalPIDLQ();
-  AliTRDCalPIDLQ &operator=(const AliTRDCalPIDLQ &c);
-
-  virtual void Copy(TObject &c) const;
+  virtual          ~AliTRDCalPIDLQ();              
+  AliTRDCalPIDLQ    &operator=(const AliTRDCalPIDLQ &c);
 
-  Bool_t       ReadReferences(Char_t *responseFile);
-  void         SetMeanChargeRatio(Double_t ratio)     { fMeanChargeRatio = ratio;  }
+  virtual void       Copy(TObject &c) const;
 
-  Double_t     GetMeanChargeRatio() const             { return fMeanChargeRatio;   }
-  Double_t     GetMomentum(Int_t ip) const            { return (ip<0 || ip>=fNMom)    ? -1. : fTrackMomentum[ip];  }
-  Double_t     GetLength(Int_t il) const              { return (il<0 || il>=fNLength) ? -1. : fTrackSegLength[il]; }
-  //Double_t   GetMean(Int_t iType, Int_t ip) const;
-  //Double_t   GetNormalization(Int_t iType, Int_t ip) const;
+          Bool_t     ReadData(Char_t *responseFile);     
+          void       SetMeanChargeRatio(Double_t ratio)     { fMeanChargeRatio = ratio;  }  
 
-  TH1*         GetHistogram(Int_t iType, Int_t ip/*, Int_t il*/) const;
-  TH1*         GetHistogramT(Int_t iType, Int_t ip) const;
+          Double_t   GetMeanChargeRatio() const             { return fMeanChargeRatio;   } 
+          Double_t   GetMomentum(Int_t ip) const            { return fTrackMomentum[ip]; }
+          Double_t   GetMean(Int_t iType, Int_t ip) const;        
+          Double_t   GetNormalization(Int_t iType, Int_t ip) const;
 
-  Double_t     GetProbability(Int_t spec, Double_t mom, Double_t *dedx, Double_t length) const;
-  Double_t     GetProbabilityT(Int_t spec, Double_t mom, Int_t timbin) const;
-  //Int_t      GetNbins() const                       { return fNbins;   }
-  //Double_t   GetBinSize() const                     { return fBinSize; }
-  Bool_t       WriteReferences(Char_t *File="TRDPIDHistograms.root", Char_t *dir =".");
-
- protected:
+          TH1F      *GetHistogram(Int_t iType, Int_t ip) const;
+          TH1F      *GetHistogramT(Int_t iType, Int_t ip) const;
 
-  void         Init();
-  void         CleanUp();
+          Double_t   GetProbability(Int_t iType, Double_t mom, Double_t dedx) const;
+          Double_t   GetProbabilityT(Int_t iType, Double_t mom, Int_t timbin) const;
+          Int_t      GetNbins() const                       { return fNbins;   }        
+          Double_t   GetBinSize() const                     { return fBinSize; } 
 
-  inline Int_t GetHistID(Int_t part, Int_t mom/*, Int_t length=0*/) const { return part*fNMom + mom; }
-  void	       SaveMaxTimeBin(const Int_t mom, const char *fn);
-				
  protected:
 
-  static  Char_t    *fpartName[5];     //! Names of particle species
-  static  Char_t    *fpartSymb[5];     //! Symbols of particle species  
-  Int_t              fNMom;            //  Number of momenta
-  Int_t              fNLength;         //  Number of track segment length intervals
-
-  Double_t          *fTrackMomentum;   //[fNMom]    Track momenta for which response functions are available
-  Double_t          *fTrackSegLength;  //[fNLength] Track segment lengths for which response functions are available
-  Int_t              fNTimeBins;       //  Number of time bins
-
-  Double_t           fMeanChargeRatio; //  Ratio of mean charge from real Det. to prob. dist.
-  Int_t              fNbins;           //  Number of energy bins
-  Double_t           fBinSize;         //  Size of energy bin
-
-  TObjArray         *fHistdEdx;        //  Prob. of dEdx for 5 particles and for several momenta
-  TObjArray         *fHistTimeBin;     //  Prob. of max time bin for 5 particles and for several momenta
-
- private:
-
-  TH1 	            *h1MaxTB[2];      //!
-  AliTRDCalPIDLQRef *fEstimator;      //!
-	
-  ClassDef(AliTRDCalPIDLQ, 2)         //   The TRD PID response container class
+          void       Init();      
+          void       CleanUp();   
+  inline  Int_t      GetHistID(Int_t part, Int_t mom) const { return part*fNMom + mom; }
+    
+  static  Char_t    *fpartName[5];                 //! Names of particle species
+    
+          Int_t      fNMom;                        //  Number of momenta  
+          Double_t  *fTrackMomentum;               //[fNMom] Track momenta for which response functions are available
+          Double_t   fMeanChargeRatio;             //  Ratio of mean charge from real Det. to prob. dist.
+
+          Int_t      fNbins;                       //  Number of energy bins
+          Double_t   fBinSize;                     //  Size of energy bin
+    
+          TObjArray *fHistdEdx;                    //  Prob. of dEdx for 5 particles and for several momenta
+          TObjArray *fHistTimeBin;                 //  Prob. of max time bin for 5 particles and for several momenta
+    
+  ClassDef(AliTRDCalPIDLQ, 1)                      //  The TRD PID response container class
 
 };
 
diff --git a/TRD/Cal/AliTRDCalPIDLQRef.cxx b/TRD/Cal/AliTRDCalPIDLQRef.cxx
deleted file mode 100644
index 3ad3de2ef2b..00000000000
--- a/TRD/Cal/AliTRDCalPIDLQRef.cxx
+++ /dev/null
@@ -1,429 +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$ */
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  TRD calibration class for 2-dim PID reference histograms                 //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "AliLog.h"
-#include "AliPID.h"
-#include "AliESD.h"
-
-#include "AliTRDCalPIDLQ.h"
-#include "AliTRDCalPIDLQRef.h"
-
-ClassImp(AliTRDCalPIDLQRef)
-
-//__________________________________________________________________
-AliTRDCalPIDLQRef::AliTRDCalPIDLQRef() 
-  :TObject()
-  ,fFitter2D2(0x0)
-  ,fFitter2D1(0x0)
-{
-  //
-  // AliTRDCalPIDLQRef default constructor
-  //
-
-	// histogram settings
-	for(int ispec=0; ispecCopy(*h2dEdx[ispec]);
-		fPrinc[ispec] = 0x0;
-	}
-	return *this;
-
-}
-
-//__________________________________________________________________
-Double_t AliTRDCalPIDLQRef::Estimate2D2(TH2 *h, Float_t &x, Float_t &y)
-{
-  //
-  // Linear interpolation of data point with a parabolic expresion using
-  // the logarithm of the bin content in a close neighbourhood. It is
-  // assumed that the bin content of h is in number of events !
-  //
-  // Observation:
-  // This function have to be used when the statistics of each bin is
-  // sufficient and all bins are populated. For cases of sparse data
-  // please refere to Estimate2D1().
-  //
-  // Author : Alex Bercuci (A.Bercuci@gsi.de)
-  //
-
-	if(!h){
-		AliError("No histogram defined.");
-		return 0.;
-	}
-
-	TAxis *ax = h->GetXaxis(), *ay = h->GetYaxis();
-	Int_t binx   = ax->FindBin(x);
-	Int_t biny   = ay->FindBin(y);
-	Int_t nbinsx = ax->GetNbins();
-	Int_t nbinsy = ay->GetNbins();
-	Double_t p[2];
-	Double_t entries;
-		
-	fFitter2D2->ClearPoints();
-	Int_t npoints=0;
-	Int_t binx0, binx1, biny0, biny1;
-	for(int bin=0; bin<5; bin++){
-		binx0 = TMath::Max(1, binx-bin);
-		binx1 = TMath::Min(nbinsx, binx+bin);
-		for(int ibin=binx0; ibin<=binx1; ibin++){
-			biny0 = TMath::Max(1, biny-bin);
-			biny1 = TMath::Min(nbinsy, biny+bin);
-			for(int jbin=biny0; jbin<=biny1; jbin++){
-				if(ibin != binx0 && ibin != binx1 && jbin != biny0 && jbin != biny1) continue;
-				if((entries = h->GetBinContent(ibin, jbin)) == 0.) continue;
-				p[0] = ax->GetBinCenter(ibin);
-				p[1] = ay->GetBinCenter(jbin);
-				fFitter2D2->AddPoint(p, log(entries), 1./sqrt(entries));
-				npoints++;
-			}
-		}
-		if(npoints>=25) break;
-	}
-	if(fFitter2D2->Eval() == 1){
-		printf(" x = %9.4f y = %9.4f\n", x, y);
-		printf("\tbinx %d biny %d\n", binx, biny);
-		printf("\tpoints %d\n", npoints);
-
-		return 0.;
-	}
-	TVectorD vec(6);
-	fFitter2D2->GetParameters(vec);
-	Double_t result = vec[0] + x*vec[1] + y*vec[2] + x*x*vec[3] + y*y*vec[4] + x*y*vec[5];
-	return exp(result);
-
-}
-
-//__________________________________________________________________
-Double_t AliTRDCalPIDLQRef::Estimate2D1(TH2 *h, Float_t &x, Float_t &y
-                                      , Float_t &dCT, Float_t &rmin
-                                      , Float_t &rmax)
-{
-  //
-  // Linear interpolation of data point with a plane using
-  // the logarithm of the bin content in the area defined by the
-  // d(cos(phi)) and dr=(rmin, rmax). It is assumed that the bin content
-  // of h is number of events !
-  //
-
-	if(!h){
-		AliError("No histogram defined.");
-		return 0.;
-	}
-
-	TAxis *ax = h->GetXaxis(), *ay = h->GetYaxis();
-// 	Int_t binx   = ax->FindBin(x);
-// 	Int_t biny   = ay->FindBin(y);
-	Int_t nbinsx = ax->GetNbins();
-	Int_t nbinsy = ay->GetNbins();
-	Double_t p[2];
-	Double_t entries;
-	Double_t rxy = sqrt(x*x + y*y), rpxy;
-		
-	fFitter2D1->ClearPoints();
-	Int_t npoints=0;
-	for(int ibin=1; ibin<=nbinsx; ibin++){
-		for(int jbin=1; jbin<=nbinsy; jbin++){
-			if((entries = h->GetBinContent(ibin, jbin)) == 0.) continue;
-			p[0] = ax->GetBinCenter(ibin);
-			p[1] = ay->GetBinCenter(jbin);
-			rpxy = sqrt(p[0]*p[0] + p[1]*p[1]);
-			if((x*p[0] + y*p[1])/rxy/rpxy < dCT) continue;
-			if(rpxy rmax) continue;
-			
-			fFitter2D1->AddPoint(p, log(entries), 1./sqrt(entries));
-			npoints++;
-		}
-	}
-	if(npoints<15) return 0.;
-	if(fFitter2D1->Eval() == 1){
-		printf(" x = %9.4f y = %9.4f\n", x, y);
-		printf("\tpoints %d\n", npoints);
-		return 0.;
-	}
-	TVectorD vec(3);
-	fFitter2D1->GetParameters(vec);
-	Double_t result = vec[0] + x*vec[1] + y*vec[2];
-	return exp(result);
-}
-
-//__________________________________________________________________
-// Double_t	AliTRDCalPIDLQRef::Estimate3D2(TH3 *h, Float_t &x, Float_t &y, Float_t &z)
-// {
-// 	// Author Alex Bercuci (A.Bercuci@gsi.de)
-// 	return 0.;
-// }
-
-//__________________________________________________________________
-void  AliTRDCalPIDLQRef::Prepare2DReferences()
-{
-  //
-  // Prepares the 2-dimensional reference histograms
-  //
-	
-	// histogram settings
-	Float_t xmin, xmax, ymin, ymax;
-	Int_t nbinsx, nbinsy;
-	const Int_t color[] = {4, 3, 2, 7, 6};
-	for(int ispec=0; ispecSetLineColor(color[ispec]);
-		}
-		// build PCA
-		if(fPrinc[ispec]) fPrinc[ispec] = new TPrincipal(2, "ND");
-	}
-
-	// build transformed rotated histograms
-	nbinsx = nbinsy = 100;
-	xmin = ymin = -6.;
-	xmax = 10.; ymax = 6.;
-	TH2I *hProj = 0x0;
-	if(!(hProj = (TH2I*)gDirectory->Get("hProj"))) hProj = new  TH2I("hProj", "", nbinsx, xmin, xmax, nbinsy, ymin, ymax);
-	else hProj->Reset();
-	
-	// build transformed smoothed histogram
-	nbinsx = nbinsy = 200;
-	xmin = -1.5; xmax = 7.5;
-	ymin = -3.; ymax = 7.;
-	TH2D *hSmooth = 0x0;
-	if(!(hSmooth = (TH2D*)gDirectory->Get("hSmooth"))) hSmooth = new TH2D("hSmooth", "", nbinsx, xmin, xmax, nbinsy, ymin, ymax);
-	else hSmooth->Reset();
-	
-
-	printf("Doing interpolation and invertion ... "); fflush(stdout);
-	Bool_t kDebugPlot = kTRUE;
-	//Bool_t kDebugPrint = kFALSE;
-
-	TCanvas *c = 0x0;
-	TEllipse *ellipse = 0x0;
-	TMarker *mark = 0x0;
-	if(kDebugPlot){
-		c=new TCanvas("c2", "Interpolation 2D", 10, 10, 500, 500);
-		ellipse = new TEllipse();
-		ellipse->SetFillStyle(0); ellipse->SetLineColor(2);
-		mark = new TMarker();
-		mark->SetMarkerColor(2); mark->SetMarkerSize(2); mark->SetMarkerStyle(2);
-	}
-	
-	TAxis *ax, *ay;
-	Double_t xy[2], lxy[2];
-	Double_t estimate, position;
-	const TVectorD *eValues;
-	Float_t x0, y0, rx, ry, rc, rmin, rmax, dr, dCT;
-	for(int ispec=0; ispec<5; ispec++){
-		hProj->Reset(); hSmooth->Reset();
-		// calculate covariance ellipse
-		fPrinc[ispec]->MakePrincipals();
-		eValues  = fPrinc[ispec]->GetEigenValues();
-		x0  = 0.;
-		y0  = 0.;
-		rx  = 3.5*sqrt((*eValues)[0]);
-		ry  = 3.5*sqrt((*eValues)[1]);
-
-		// rotate to principal axis
-		Int_t irow = 0;
-		const Double_t *xx;
-		while((xx = fPrinc[ispec]->GetRow(irow++))){
-			fPrinc[ispec]->X2P(xx, lxy);
-			hProj->Fill(lxy[0], lxy[1]);
-		}
-
- 		// debug plot
-		if(kDebugPlot){
-			hProj->Draw();
-			ellipse->DrawEllipse(x0, y0, rx, ry, 0., 360., 0.);
-			mark->DrawMarker(x0, y0);
-			gPad->Modified(); gPad->Update();
-		}
-		
-				
-		// do interpolation
-		ax=hSmooth->GetXaxis();
-		ay=hSmooth->GetYaxis();
-		for(int ibin=1; ibin<=ax->GetNbins(); ibin++){
-			xy[0] = ax->GetBinCenter(ibin); 
-			for(int jbin=1; jbin<=ay->GetNbins(); jbin++){
-				xy[1] = ay->GetBinCenter(jbin);
-
-				// rotate to PCA
-				fPrinc[ispec]->X2P(xy, lxy);
-
-				// calculate border of covariance ellipse
-				position = lxy[0]*lxy[0]/rx/rx+lxy[1]*lxy[1]/ry/ry;
-
-				// interpolation inside the covariance ellipse
-				if(position < 1.) estimate = Estimate2D2(hProj, (Float_t&)lxy[0], (Float_t&)lxy[1]);
-				else{ // interpolation outside the covariance ellipse
-					dCT  = .9977;
-					dr = .5;
-					rc = sqrt(lxy[0]*lxy[0]+lxy[1]*lxy[1]);
-					rmin = rc - dr*sqrt(rc);
-					rmax = rc + dr/rc;
-					while((estimate = Estimate2D1(hProj, (Float_t&)lxy[0], (Float_t&)lxy[1], dCT, rmin, rmax)) < 1.E-8){
-						rmin -= dr;
-						dCT -= .001; 
-					}
-				}
-				hSmooth->SetBinContent(ibin, jbin, estimate);
-			}
-		}
-		
-		// debug plot
-		if(kDebugPlot){
-			hSmooth->Draw("lego2 fb"); gPad->SetLogz();
-			gPad->Modified(); gPad->Update();
-		}
-				
-		// doing invertion
-		ax=h2dEdx[ispec]->GetXaxis();
-		ay=h2dEdx[ispec]->GetYaxis();
-		for(int ibin=1; ibin<=ax->GetNbins(); ibin++){
-			xy[0] = ax->GetBinCenter(ibin); 
-			for(int jbin=1; jbin<=ay->GetNbins(); jbin++){
-				xy[1] = ay->GetBinCenter(jbin);
-				estimate = (ispec ==0 && (ibin==1 || jbin==1)) ? 1.E-10 : hSmooth->GetBinContent(hSmooth->FindBin(log(xy[0]), log(xy[1])))/xy[0]/xy[1];
-				h2dEdx[ispec]->SetBinContent(ibin, jbin, (estimate>0.) ? estimate : 1.E-10);
-			}
-		}
-		h2dEdx[ispec]->Scale(1./h2dEdx[ispec]->Integral());
-	}
-	printf("Done \n");
-}
-
-//__________________________________________________________________
-void	AliTRDCalPIDLQRef::Reset()
-{
-  //
-  // Resets the reference histograms
-  //
-
-	for(int ispec=0; ispecReset();
-		fPrinc[ispec]->Clear();
-	}	
-}
-
-//__________________________________________________________________
-void  AliTRDCalPIDLQRef::SaveReferences(const Int_t mom, const char *fn)
-{
-  //
-  // Save the reference histograms
-  //
-
-	TFile *fSave = 0x0;
-	TListIter it((TList*)gROOT->GetListOfFiles());
-	Bool_t kFOUND = kFALSE;
-	TDirectory *pwd = gDirectory;
-	while((fSave=(TFile*)it.Next()))
-		if(strcmp(fn, fSave->GetName())==0){
-			kFOUND = kTRUE;
-			break;
-		}
-	if(!kFOUND) fSave = new TFile(fn, "RECREATE");
-	fSave->cd();
-
-	TH2 *h;
-	for(int ispec=0; ispecClone(Form("h2dEdx%s%d", AliTRDCalPIDLQ::fpartSymb[ispec], mom));
-		h->SetTitle(Form("2D dEdx for particle %s @ %d", AliTRDCalPIDLQ::fpartName[ispec], mom));
-		h->GetXaxis()->SetTitle("dE/dx_{TRD}^{amplif} [au]");
-		h->GetYaxis()->SetTitle("dE/dx_{TRD}^{drift} [au]");
-		h->GetZaxis()->SetTitle("Entries");
-		h->Write();
-	}
-		
-	pwd->cd();
-}
diff --git a/TRD/Cal/AliTRDCalPIDLQRef.h b/TRD/Cal/AliTRDCalPIDLQRef.h
deleted file mode 100644
index 02c47f50b5f..00000000000
--- a/TRD/Cal/AliTRDCalPIDLQRef.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef ALITRDCALPIDLQREF_H
-#define ALITRDCALPIDLQREF_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  TRD calibration class for 2-dim reference histograms                     //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef ROOT_TObject
-#include "TObject.h"
-#endif
-
-class TH2;
-class TH3;
-class TPrincipal;
-class TLinearFitter;
-
-class AliTRDCalPIDLQRef : public TObject {
-
- public:
-
-  AliTRDCalPIDLQRef();
-  AliTRDCalPIDLQRef(const AliTRDCalPIDLQRef &ref);
-  ~AliTRDCalPIDLQRef();
-  AliTRDCalPIDLQRef& operator=(const AliTRDCalPIDLQRef &ref);
-
-  TPrincipal*	GetPrincipal(const Int_t spec){return (spec>=0 && spec<5) ? fPrinc[spec] : 0x0;}
-  Double_t	Estimate2D2(TH2 *h, Float_t &x, Float_t &y);
-  Double_t	Estimate2D1(TH2 *h, Float_t &x, Float_t &y, Float_t &dCT, Float_t &rmin, Float_t &rmax);
-  //Double_t	  Estimate3D2(TH3 *h, Float_t &x, Float_t &y, Float_t &z);
-  void		Prepare2DReferences();
-  void		Reset();
-  void      	SaveReferences(const Int_t mom, const char *fn);
-	
- private:
-
-  TPrincipal	*fPrinc[5];      // Used for principal component analysis
-  TLinearFitter	*fFitter2D2;     // Working object for linear fitter
-  TLinearFitter	*fFitter2D1;     // Working object for linear fitter
-
-  TH2 		*h2dEdx[5];      // Data holders
-
-  ClassDef(AliTRDCalPIDLQRef, 1) // Reference histograms builder
-
-};
-
-#endif
-
diff --git a/TRD/TRDbaseLinkDef.h b/TRD/TRDbaseLinkDef.h
index 1fa71f794e9..b6ed6496a7d 100644
--- a/TRD/TRDbaseLinkDef.h
+++ b/TRD/TRDbaseLinkDef.h
@@ -35,7 +35,6 @@
 #pragma link C++ class  AliTRDCalDet+;
 #pragma link C++ class  AliTRDCalGlobals+;
 #pragma link C++ class  AliTRDCalPIDLQ+;
-#pragma link C++ class  AliTRDCalPIDLQRef+;
 #pragma link C++ class  AliTRDCalMonitoring+;
 
 #pragma link C++ class  AliTRDCalChamberStatus+;
diff --git a/TRD/libTRDbase.pkg b/TRD/libTRDbase.pkg
index 075086327bd..bcfa0a12e67 100644
--- a/TRD/libTRDbase.pkg
+++ b/TRD/libTRDbase.pkg
@@ -19,7 +19,6 @@ SRCS= AliTRDarrayI.cxx \
       Cal/AliTRDCalDet.cxx \
       Cal/AliTRDCalGlobals.cxx \
       Cal/AliTRDCalPIDLQ.cxx \
-      Cal/AliTRDCalPIDLQRef.cxx \
       Cal/AliTRDCalMonitoring.cxx \
       Cal/AliTRDCalChamberStatus.cxx \
       Cal/AliTRDCalPadStatus.cxx \
diff --git a/build/Makefile.macosx b/build/Makefile.macosx
index 7e298fc85e6..4042d0daf96 100644
--- a/build/Makefile.macosx
+++ b/build/Makefile.macosx
@@ -25,7 +25,7 @@ endif
 
 # Global optimisation
 OPT           = -O -g
-NOOPT         = -O0 -g
+NOOPT         = -g
 
 CXXOPT        = $(OPT) 
 CXXNOOPT      = $(NOOPT) 
@@ -41,19 +41,17 @@ CLIBCXXOPTS   =
 CLIBCOPT      =
 CLIBFOPT      = $(CLIBDEFS)
 
-CXXSTF        =  -pipe -Wall -W -Wno-long-double -pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -Woverloaded-virtual -Weffc++ -fno-default-inline -fno-inline -I/usr/X11R6/include -I$(FINK_ROOT)/include
-
 # Compiler flags
-CXXFLAGS      = $(CXXOPT) $(CXXSTF) -Weffc++
+CXXFLAGS      = $(CXXOPT)   -Wall -W -Wno-long-double -pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -I/usr/X11R6/include -I$(FINK_ROOT)/include -Woverloaded-virtual -Weffc++ 
 
 ifeq (g95,$(findstring g95,$(ROOTBUILD)))
 CXXFLAGS+=-DFORTRAN_G95
 endif
-CXXFLAGSNO    = $(CXXNOOPT) $(CXXSTF) 
+CXXFLAGSNO    = $(CXXNOOPT) -Wall -W -pipe -fsigned-char -fno-common -fmessage-length=0 -I$(FINK_ROOT)/include  -Wno-long-double
 
 CFLAGS	      = $(COPT) -Wall -W -fno-common -pipe -I$(FINK_ROOT)/include
 
-FFLAGS        = $(CLIBFOPT) $(FOPT) -ftrace=full
+FFLAGS        = $(CLIBFOPT) $(FOPT)
 # rmkdepend flags for building dependencies of FORTRAN files
 DEPENDFFLAGS  = $(FFLAGS)
 
diff --git a/build/module.dep b/build/module.dep
index 216df440b76..5e05cdd981c 100644
--- a/build/module.dep
+++ b/build/module.dep
@@ -17,7 +17,7 @@ JETAN/module.mk:	 JETAN/libJETAN.pkg
 MEVSIM/module.mk:	 MEVSIM/libmevsim.pkg
 MICROCERN/module.mk:	 MICROCERN/libmicrocern.pkg
 MONITOR/module.mk:       MONITOR/libMONITOR.pkg MONITOR/binmonitorGDC.pkg MONITOR/binmonitorCheck.pkg MONITOR/binderoot.pkg
-MUON/module.mk:		 MUON/libMUONbase.pkg MUON/libMUONmapping.pkg MUON/libMUONsim.pkg MUON/libMUONcalib.pkg MUON/libMUONraw.pkg MUON/libMUONtrigger.pkg MUON/libMUONevaluation.pkg MUON/libMUONrec.pkg MUON/libMUONgeometry.pkg MUON/libMUONshuttle.pkg
+MUON/module.mk:		 MUON/libMUONrec.pkg MUON/libMUONsim.pkg MUON/libMUONbase.pkg MUON/libMUONraw.pkg MUON/libMUONmapping.pkg MUON/libMUONshuttle.pkg
 LHC/module.mk:		 LHC/libLHC.pkg
 LHAPDF/module.mk:	 LHAPDF/liblhapdf.pkg
 PHOS/module.mk:		 PHOS/libPHOSbase.pkg PHOS/libPHOSsim.pkg PHOS/libPHOSrec.pkg
diff --git a/build/module.tpl b/build/module.tpl
index f927b663b41..9a3f3df560a 100644
--- a/build/module.tpl
+++ b/build/module.tpl
@@ -96,9 +96,7 @@ ifndef CINTHDRS
 @PACKAGE@CINTHDRS:=$(@PACKAGE@H)
 else
 @PACKAGE@CINTHDRS:=$(CINTHDRS:%=@MODULE@/%)
-#@PACKAGE@CINTHDRS:=$(pathsubst %,@MODULE@/%,$(CINTHDRS))
 endif
-@PACKAGE@CINTCLASSES:=$(patsubst %.h,%,$(notdir $(@PACKAGE@CINTHDRS)))
 #############################################################################
 
 # Package Dictionary 
@@ -265,14 +263,14 @@ $(@PACKAGE@DAL): $(@PACKAGE@CINTHDRS) @MODULE@/module.mk @MODULE@/tgt_$(ALICE_TA
 ifndef ALIQUIET
 	 @echo "***** Creating $@ *****";
 endif
-	$(MUTE)echo '//automatically generated ROOT DICT definition' > $@
-	$(MUTE)echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
+	@echo '//automatically generated ROOT DICT definition' > $@
+	@echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
 	$(MUTE)echo '#ifdef __CINT__' >> $@
 	$(MUTE)echo '#pragma link off all globals;' >> $@
 	$(MUTE)echo '#pragma link off all classes;' >> $@
 	$(MUTE)echo '#pragma link off all functions;' >> $@
-	$(MUTE)$(foreach i, $(@PACKAGE@CINTCLASSES), \
-	   echo "#pragma link C++ class $(i);" >> $@ ;)
+	$(MUTE)$(foreach i, $(@PACKAGE@CINTHDRS), \
+	   echo "#pragma link C++ class `echo $(i) | sed -e "s|.*/||g" -e "s|\.h.*||"`;" >> $@ ;)
 	$(MUTE)echo '#endif' >> $@
 
 $(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk @MODULE@/tgt_$(ALICE_TARGET)/@PACKAGE@_srcslist
@@ -430,7 +428,7 @@ smell-@MODULE@: $(@PACKAGE@SMELL)
 	@echo "Creating archive" $@ ...
 	@cd @MODULE@; tar cfzh ../$@ @PACKAGE@
 	@rm -rf @MODULE@/@PACKAGE@
-	@echo $@ "done"
+	@echo "done"
 
 @MODULE@/@PACKAGE@/Makefile: @MODULE@/Makefile
 	@echo Copying $< to $@ with transformations
diff --git a/data/galice.cuts b/data/galice.cuts
index 8367d99c130..d598f1dbf9a 100644
--- a/data/galice.cuts
+++ b/data/galice.cuts
@@ -137,6 +137,23 @@ TPC 13 -1. -1. -1. -1. -1. -1. -1. -1. -1. -1.   -1 -1 -1 1 1 1 3 1 1 1 1
 TPC 14 -1. -1. -1. -1. -1. -1. -1. -1. -1. -1.   -1 -1 -1 1 1 1 3 1 1 1 1
 TPC 15 -1. -1. -1. -1. -1. -1. -1. -1. -1. -1.   -1 -1 -1 1 1 1 3 1 1 1 1
 
+* HMPID
+* ====
+*
+*       GAM   ELEC  NHAD   CHAD  MUON  EBREM MUHAB  EDEL  MUDEL MUPA ANNI BREM COMP DCAY DRAY HADR LOSS MULS PAIR PHOT RAYL
+* Quarz Window        (>1000 keV delta-electrons)
+HMPID  3  1.e-4 1.e-4 1.e-4  -1.   1.e-4 -1.   -1.    1.e-3 1.e-3 -1.  -1   -1   -1   -1   1    -1   1    -1   -1   -1   -1 
+* Freon Radiator      (>  500 keV delta-electrons)
+HMPID  4  1.e-4 1.e-4 1.e-4  -1.   1.e-4 -1.   -1.    5.e-4 5.e-4 -1.  -1   -1   -1   -1   1    -1   1    -1   -1   -1   -1 
+* Methane Gap         (>  100 keV delta-electrons)
+HMPID  5  5.e-5 1.e-5 1.e-4 -1.   1.e-4 -1.   -1.     1.e-4 1.e-4 -1.  -1   -1   -1   -1   1    -1   1    -1   -1   -1   -1 
+* Sensitive Volume    (>  50 keV delta-electrons)
+HMPID  9  1.e-5 1.e-5 1.e-4  -1.   1.e-4 -1.   -1.    5.e-5 5.e-5 -1.  -1   -1   -1   -1   1    -1   1    -1   -1   -1   -1 
+* CSI    (>  50 keV delta-electrons)
+HMPID  6  1.e-5 1.e-5 1.e-4  -1.   1.e-4 -1.   -1.    5.e-5 5.e-5 -1.  -1   -1   -1   -1   1    -1   1    -1   -1   -1   -1 
+* PCB backplane   (>  50 keV delta-electrons)
+HMPID 12  1.e-5 1.e-5 1.e-4  -1.   1.e-4 -1.   -1.    5.e-5 5.e-5 -1.  -1   -1   -1   -1   1    -1   1    -1   -1   -1   -1 
+
 * Front Absorber ABSO
 * ===================
 * CARBON
diff --git a/macros/Config.C b/macros/Config.C
index 38f876a8f17..2f215722c87 100644
--- a/macros/Config.C
+++ b/macros/Config.C
@@ -27,7 +27,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -301,7 +301,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
 
diff --git a/macros/ConfigBeautyPPR.C b/macros/ConfigBeautyPPR.C
index 7356ab3acd0..3aa00ea1240 100644
--- a/macros/ConfigBeautyPPR.C
+++ b/macros/ConfigBeautyPPR.C
@@ -21,7 +21,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymm.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv1.h"
 #include "TRD/AliTRDv1.h"
@@ -295,7 +295,7 @@ void Config()
 
   if(iTOF) {
     //=================== TOF parameters ============================
-    AliTOF *TOF  = new AliTOFv6T0("TOF","normal TOF");
+    AliTOF *TOF  = new AliTOFv5T0("TOF","normal TOF");
   }
 
   if(iHMPID) {
diff --git a/macros/ConfigCharmPPR.C b/macros/ConfigCharmPPR.C
index 47e69d55c86..5f111f7e177 100644
--- a/macros/ConfigCharmPPR.C
+++ b/macros/ConfigCharmPPR.C
@@ -21,7 +21,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymm.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv1.h"
 #include "TRD/AliTRDv1.h"
@@ -294,7 +294,7 @@ void Config()
 
   if(iTOF) {
     //=================== TOF parameters ============================
-    AliTOF *TOF  = new AliTOFv6T0("TOF","normal TOF");
+    AliTOF *TOF  = new AliTOFv5T0("TOF","normal TOF");
   }
 
   if(iHMPID) {
diff --git a/macros/ConfigHBT.C b/macros/ConfigHBT.C
index 1d894de9f5b..1dc2ed95042 100644
--- a/macros/ConfigHBT.C
+++ b/macros/ConfigHBT.C
@@ -29,7 +29,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv1.h"
 #include "TRD/AliTRDv1.h"
@@ -370,7 +370,7 @@ void Config()
     if (iTOF)
     {
         //=================== TOF parameters ============================
-        AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+        AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
     if (iHMPID)
diff --git a/macros/ConfigPPR.C b/macros/ConfigPPR.C
index a01985a2332..0dee41038f7 100644
--- a/macros/ConfigPPR.C
+++ b/macros/ConfigPPR.C
@@ -42,7 +42,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -420,7 +420,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
 
diff --git a/macros/Config_PDC06.C b/macros/Config_PDC06.C
index 74ecb7fbe4a..375e62a97ad 100644
--- a/macros/Config_PDC06.C
+++ b/macros/Config_PDC06.C
@@ -35,7 +35,7 @@
 #include "ITS/AliITSgeom.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -489,7 +489,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
 	// Partial geometry: modules at 2,3,4,6,7,11,12,14,15,16
 	// starting at 6h in positive direction
 	//	Int_t TOFSectors[18]={-1,-1,0,0,0,-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0};
diff --git a/macros/Config_PythiaHeavyFlavours.C b/macros/Config_PythiaHeavyFlavours.C
index fd0fa5d15e8..ebc934eb623 100644
--- a/macros/Config_PythiaHeavyFlavours.C
+++ b/macros/Config_PythiaHeavyFlavours.C
@@ -34,7 +34,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv1.h"
 #include "TRD/AliTRDv1.h"
@@ -439,7 +439,7 @@ void Config()
 
   if(iTOF) {
     //=================== TOF parameters ============================
-    AliTOF *TOF  = new AliTOFv6T0("TOF","normal TOF");
+    AliTOF *TOF  = new AliTOFv5T0("TOF","normal TOF");
   }
 
   if(iHMPID) {
diff --git a/macros/g4ConfigCommon.C b/macros/g4ConfigCommon.C
index bf3b79d918b..9bbe28dd590 100644
--- a/macros/g4ConfigCommon.C
+++ b/macros/g4ConfigCommon.C
@@ -268,7 +268,7 @@ void ConfigCommon(Bool_t interactiveSetup)
     if (iTOF)
     {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
     if (iHMPID)
diff --git a/macros/loadlibs.C b/macros/loadlibs.C
index 3be25f9b5e7..cad8e2b4fa7 100644
--- a/macros/loadlibs.C
+++ b/macros/loadlibs.C
@@ -45,12 +45,10 @@ void loadlibs ()
   gSystem->Load("libMUONmapping");
   gSystem->Load("libMUONgeometry");
   gSystem->Load("libMUONcalib");
-  gSystem->Load("libMUONraw");
-  gSystem->Load("libMUONtrigger");
   gSystem->Load("libMUONbase");
+  gSystem->Load("libMUONraw");
   gSystem->Load("libMUONsim");
   gSystem->Load("libMUONrec");
-  gSystem->Load("libMUONevaluation");
   gSystem->Load("libFMDbase");
   gSystem->Load("libFMDsim");
   gSystem->Load("libFMDrec");
diff --git a/macros/loadlibsrec.C b/macros/loadlibsrec.C
index 08625111619..6c97038ed8b 100644
--- a/macros/loadlibsrec.C
+++ b/macros/loadlibsrec.C
@@ -30,9 +30,8 @@ void loadlibsrec ()
   gSystem->Load("libMUONmapping");
   gSystem->Load("libMUONgeometry");
   gSystem->Load("libMUONcalib");
-  gSystem->Load("libMUONraw");
-  gSystem->Load("libMUONtrigger");
   gSystem->Load("libMUONbase");
+  gSystem->Load("libMUONraw");
   gSystem->Load("libMUONsim");
   gSystem->Load("libMUONrec");
   gSystem->Load("libFMDbase");
diff --git a/macros/loadlibssim.C b/macros/loadlibssim.C
index 10957e84393..911ce679229 100644
--- a/macros/loadlibssim.C
+++ b/macros/loadlibssim.C
@@ -43,9 +43,8 @@ void loadlibssim ()
   gSystem->Load("libMUONmapping");
   gSystem->Load("libMUONgeometry");
   gSystem->Load("libMUONcalib");
-  gSystem->Load("libMUONraw");
-  gSystem->Load("libMUONtrigger");
   gSystem->Load("libMUONbase");
+  gSystem->Load("libMUONraw");
   gSystem->Load("libMUONsim");
   gSystem->Load("libFMDbase");
   gSystem->Load("libFMDsim");
diff --git a/test/PbPbbench/Config.C b/test/PbPbbench/Config.C
index 27bb203c963..02511b80f98 100644
--- a/test/PbPbbench/Config.C
+++ b/test/PbPbbench/Config.C
@@ -42,7 +42,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -418,7 +418,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
 
diff --git a/test/genkine/sim/Config.C b/test/genkine/sim/Config.C
index 9a669e275c7..e8cadd625cd 100644
--- a/test/genkine/sim/Config.C
+++ b/test/genkine/sim/Config.C
@@ -42,7 +42,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -374,7 +374,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
 
diff --git a/test/gun/Config.C b/test/gun/Config.C
index 32bf3732872..032b8fa4346 100644
--- a/test/gun/Config.C
+++ b/test/gun/Config.C
@@ -29,7 +29,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -415,7 +415,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
 	// Partial geometry: modules at 2,3,4,6,7,11,12,14,15,16
 	// starting at 6h in positive direction
 	Int_t TOFSectors[18]={-1,-1,0,0,0,-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0};
diff --git a/test/merge/backgr/Config.C b/test/merge/backgr/Config.C
index ad071f53d37..ac7708ecf8e 100644
--- a/test/merge/backgr/Config.C
+++ b/test/merge/backgr/Config.C
@@ -43,7 +43,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -422,7 +422,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
 
diff --git a/test/merge/signal/Config.C b/test/merge/signal/Config.C
index 926308f3b18..aa190a19bcc 100644
--- a/test/merge/signal/Config.C
+++ b/test/merge/signal/Config.C
@@ -43,7 +43,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -422,7 +422,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
 
diff --git a/test/ppbench/Config.C b/test/ppbench/Config.C
index acba8b03db0..800f1f071f9 100644
--- a/test/ppbench/Config.C
+++ b/test/ppbench/Config.C
@@ -42,7 +42,7 @@
 #include "STRUCT/AliPIPEv0.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -418,7 +418,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
     }
 
 
diff --git a/test/pploadlibs/Config.C b/test/pploadlibs/Config.C
index 5e1eae7e168..be9a3d3980a 100644
--- a/test/pploadlibs/Config.C
+++ b/test/pploadlibs/Config.C
@@ -35,7 +35,7 @@
 #include "ITS/AliITSgeom.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv6T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "HMPID/AliHMPIDv1.h"
 #include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
@@ -489,7 +489,7 @@ void Config()
 
     if (iTOF) {
         //=================== TOF parameters ============================
-	AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+	AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
 	// Partial geometry: modules at 2,3,4,6,7,11,12,14,15,16
 	// starting at 6h in positive direction
 	//	Int_t TOFSectors[18]={-1,-1,0,0,0,-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0};
diff --git a/test/pploadlibs/rec.C b/test/pploadlibs/rec.C
index 8ce4f9edfa0..a2463aa1809 100644
--- a/test/pploadlibs/rec.C
+++ b/test/pploadlibs/rec.C
@@ -1,5 +1,5 @@
 void rec() {
-  gSystem->Load("libProof");
+  gSystem->Load("libTree");
   gROOT->Macro("loadlibsrec.C");
   new AliRun("gAlice","The ALICE Off-line Simulation Framework");
   AliReconstruction reco;
diff --git a/test/pploadlibs/sim.C b/test/pploadlibs/sim.C
index f106ce723c2..679d9f87610 100644
--- a/test/pploadlibs/sim.C
+++ b/test/pploadlibs/sim.C
@@ -1,5 +1,5 @@
 void sim(Int_t nev=4) {
-  gSystem->Load("libProof");
+  gSystem->Load("libTree");
   if (!strcmp(gSystem->GetBuildArch(),"macosx")) gSystem->Load("libf95");
   gROOT->Macro("loadlibssim.C");
   new AliRun("gAlice","The ALICE Off-line Simulation Framework");