Removing calibration components which are only run in MUONTRGda and MUONTRKda
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Apr 2008 13:00:26 +0000 (13:00 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Apr 2008 13:00:26 +0000 (13:00 +0000)
HLT/MUON/HLTMUONLinkDef.h
HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONTrackerCalibratorComponent.cxx [deleted file]
HLT/MUON/OnlineAnalysis/AliHLTMUONTrackerCalibratorComponent.h [deleted file]
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerCalibratorComponent.cxx [deleted file]
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerCalibratorComponent.h [deleted file]
HLT/libAliHLTMUON.pkg

index 538ad0c..97d75cd 100644 (file)
@@ -46,8 +46,6 @@
 #pragma link C++ class AliHLTMUONTriggerRecord+;
 #pragma link C++ class AliHLTMUONMansoTrack+;
 #pragma link C++ class AliHLTMUONRootifierComponent+;
-#pragma link C++ class AliHLTMUONTriggerCalibratorComponent+;
-#pragma link C++ class AliHLTMUONTrackerCalibratorComponent+;
 #pragma link C++ class AliHLTMUONEmptyEventFilterComponent+;
 
 //TODO: The following is temporary.
index 06d9c1c..12f4568 100644 (file)
@@ -29,8 +29,6 @@
 #include "AliHLTMUONHitReconstructorComponent.h"
 #include "AliHLTMUONTriggerReconstructorComponent.h"
 #include "AliHLTMUONMansoTrackerFSMComponent.h"
-#include "AliHLTMUONTriggerCalibratorComponent.h"
-#include "AliHLTMUONTrackerCalibratorComponent.h"
 #include "AliHLTMUONEmptyEventFilterComponent.h"
 #include "AliRunLoader.h"
 
@@ -120,8 +118,6 @@ int AliHLTMUONAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
        pHandler->AddComponent(new AliHLTMUONHitReconstructorComponent);
        pHandler->AddComponent(new AliHLTMUONTriggerReconstructorComponent);
        pHandler->AddComponent(new AliHLTMUONMansoTrackerFSMComponent);
-       pHandler->AddComponent(new AliHLTMUONTriggerCalibratorComponent);
-       pHandler->AddComponent(new AliHLTMUONTrackerCalibratorComponent);
        pHandler->AddComponent(new AliHLTMUONEmptyEventFilterComponent);
        return 0;
 }
diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONTrackerCalibratorComponent.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONTrackerCalibratorComponent.cxx
deleted file mode 100644 (file)
index 99a1a45..0000000
+++ /dev/null
@@ -1,1097 +0,0 @@
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
- * All rights reserved.                                                   *
- *                                                                        *
- * Primary Authors:                                                       *
- *   Artur Szostak <artursz@iafrica.com>                                  *
- *                                                                        *
- * 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$ */
-
-///
-///  @file   AliHLTMUONTrackerCalibratorComponent.cxx
-///  @author Artur Szostak <artursz@iafrica.com>
-///  @date   
-///  @brief  Implementation of the AliHLTMUONTrackerCalibratorComponent class.
-///
-
-#include "AliHLTMUONTrackerCalibratorComponent.h"
-#include "AliHLTMUONConstants.h"
-#include "AliHLTMUONUtils.h"
-#include <cassert>
-
-ClassImp(AliHLTMUONTrackerCalibratorComponent);
-
-
-///////////////////////////////////////////////////////////////////////////////
-// The code from here on was copied from MUONTRKda.cxx and addapted to the
-// HLT framework.
-//TODO: test that any of this actually works and clean up the code.
-///////////////////////////////////////////////////////////////////////////////
-
-#include <iostream>
-#include <fstream>
-using namespace std;
-
-#include <cstdio>
-#include <cstdlib>
-
-//AliRoot
-#include "AliRawReaderMemory.h"
-#include "AliMUONRawStreamTracker.h"
-#include "AliMUONDspHeader.h"
-#include "AliMUONBlockHeader.h"
-#include "AliMUONBusStruct.h"
-#include "AliMUONDDLTracker.h"
-#include "AliMUONVStore.h"
-#include "AliMUON2DMap.h"
-#include "AliMUONCalibParamND.h"
-#include "AliMpIntPair.h"
-#include "AliMpConstants.h"
-#include "AliRawReaderDate.h"
-
-//ROOT
-#include "TFile.h"
-#include "TTree.h"
-#include "TH1F.h"
-#include "TString.h"
-#include "TStopwatch.h"
-#include "TMath.h"
-#include "TTimeStamp.h"
-#include "TGraphErrors.h"
-#include "TF1.h"
-#include "TROOT.h"
-#include "TPluginManager.h"
-#include "TFitter.h"
-
-#define  NFITPARAMS 4
-
-namespace
-{
-
-// global variables
-const Int_t gkNChannels = AliMpConstants::ManuNofChannels();
-const Int_t gkADCMax    = 4095;
-
-AliMUONVStore* gPedestalStore = NULL;
-
-Int_t  gNManu       = 0;
-Int_t  gNChannel    = 0;
-UInt_t gRunNumber   = 0;
-Int_t  gNEvents     = 0;
-Int_t  gNDateEvents = 0;
-Int_t  gPrintLevel  = 1;  // global printout variable
-Int_t  gPlotLevel  = 0;  // global plot variable
-
-TH1F*  gPedMeanHisto  = 0x0;
-TH1F*  gPedSigmaHisto = 0x0;
-Char_t gHistoFileName[256];
-
-// used by makegain 
-TString gHistoFileName_gain = "MuonTrkDA_data.root";
-TString gRootFileName = "MuonTrkDA_gain.root";
-Char_t filenam[256] = "MuonTrkDA_gain.param"; // if gPrintLevel  = 2
-
-TString gCommand("ped");
-
-}; // end of namespace
-
-
-//________________
-Double_t funcLin(Double_t *x, Double_t *par)
-{
-  return par[0] + par[1]*x[0];
-}
-
-//________________
-Double_t funcParabolic(Double_t *x, Double_t *par)
-{
-  return par[0]*x[0]*x[0];
-}
-
-//________________
-Double_t funcCalib(Double_t *x, Double_t *par)
-{
-  Double_t xLim= par[3];
-
-  if(x[0] <= xLim) return par[0] + par[1]*x[0];
-
-  Double_t yLim = par[0]+ par[1]*xLim;
-  return yLim + par[1]*(x[0] - xLim) + par[2]*(x[0] - xLim)*(x[0] - xLim);
-}
-
-//__________
-void MakePed(Int_t busPatchId, Int_t manuId, Int_t channelId, Int_t charge)
-{
-
-    AliMUONVCalibParam* ped = 
-       static_cast<AliMUONVCalibParam*>(gPedestalStore->FindObject(busPatchId, manuId));
-
-    if (!ped) {
-      gNManu++;
-      ped = new AliMUONCalibParamND(2, gkNChannels,busPatchId, manuId, -1.); // put default wise -1, not connected channel
-      gPedestalStore->Add(ped);        
-    }
-
-    if (gNEvents == 1) {
-      ped->SetValueAsDouble(channelId, 0, 0.);
-      ped->SetValueAsDouble(channelId, 1, 0.);
-    }
-
-    Double_t pedMean  = ped->ValueAsDouble(channelId, 0) + charge;
-    Double_t pedSigma = ped->ValueAsDouble(channelId, 1) + charge*charge;
-
-    ped->SetValueAsDouble(channelId, 0, pedMean);
-    ped->SetValueAsDouble(channelId, 1, pedSigma);
-
-}
-
-//________________
-void MakePedStore(TString flatOutputFile = "")
-{
-  TTimeStamp date;
-  Double_t pedMean;
-  Double_t pedSigma;
-  ofstream fileout;
-  Int_t busPatchId;
-  Int_t manuId;
-  Int_t channelId;
-
- // histo
-//   sprintf(gHistoFileName,"mutrkped-%d.root",gRunNumber);
-  sprintf(gHistoFileName,"MuonTrkDA_%d_ped.root",gRunNumber);
-  TFile*  histoFile = new TFile(gHistoFileName,"RECREATE","MUON Tracking pedestals");
-
-  Char_t name[255];
-  Char_t title[255];
-  sprintf(name,"pedmean_allch");
-  sprintf(title,"Pedestal mean all channels");
-  Int_t nx = 1000;
-  Int_t xmin = 0;
-  Int_t xmax = 1000; 
-  gPedMeanHisto = new TH1F(name,title,nx,xmin,xmax);
-  gPedMeanHisto->SetDirectory(histoFile);
-
-  sprintf(name,"pedsigma_allch");
-  sprintf(title,"Pedestal sigma all channels");
-  nx = 200;
-  xmin = 0;
-  xmax = 50; 
-  gPedSigmaHisto = new TH1F(name,title,nx,xmin,xmax);
-  gPedSigmaHisto->SetDirectory(histoFile);
-    
-  TTree* tree = new TTree("t","Pedestal tree");
-  tree->Branch("bp",&busPatchId,"bp/I");
-  tree->Branch("manu",&manuId,",manu/I");
-  tree->Branch("channel",&channelId,",channel/I");
-  tree->Branch("pedMean",&pedMean,",pedMean/D");
-  tree->Branch("pedSigma",&pedSigma,",pedSigma/D");
-
-  if (!flatOutputFile.IsNull()) {
-    fileout.open(flatOutputFile.Data());
-    fileout<<"//===========================================================================" << endl;
-    fileout<<"//                       Pedestal file calculated by MUONTRKda"<<endl;
-    fileout<<"//===========================================================================" << endl;
-    fileout<<"//       * Run           : " << gRunNumber << endl; 
-    fileout<<"//       * Date          : " << date.AsString("l") <<endl;
-    fileout<<"//       * Statictics    : " << gNEvents << endl;
-    fileout<<"//       * # of MANUS    : " << gNManu << endl;
-    fileout<<"//       * # of channels : " << gNChannel << endl;
-    fileout<<"//"<<endl;
-    fileout<<"//---------------------------------------------------------------------------" << endl;
-    fileout<<"//---------------------------------------------------------------------------" << endl;
-//     fileout<<"//format : BUS_PATCH MANU_ID CHANNEL MEAN SIGMA"<<endl;
-    fileout<<"//      BP     MANU     CH.      MEAN    SIGMA"<<endl;
-    fileout<<"//---------------------------------------------------------------------------" << endl;
-
-  }
-
-  // iterator over pedestal
-  TIter next(gPedestalStore->CreateIterator());
-  AliMUONVCalibParam* ped;
-  
-  while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
-  {
-    busPatchId              = ped->ID0();
-    manuId                  = ped->ID1();
-
-    for (channelId = 0; channelId < ped->Size() ; ++channelId) {
-
-      pedMean  = ped->ValueAsDouble(channelId, 0);
-
-      if (pedMean > 0) { // connected channels
-
-       ped->SetValueAsDouble(channelId, 0, pedMean/(Double_t)gNEvents);
-
-       pedMean  = ped->ValueAsDouble(channelId, 0);
-       pedSigma = ped->ValueAsDouble(channelId, 1);
-
-       ped->SetValueAsDouble(channelId, 1, TMath::Sqrt(TMath::Abs(pedSigma/(Double_t)gNEvents - pedMean*pedMean)));
-
-       pedMean  = ped->ValueAsDouble(channelId, 0) + 0.5 ;
-//     pedMean  = ped->ValueAsDouble(channelId, 0) ;
-       pedSigma = ped->ValueAsDouble(channelId, 1);
-
-
-       if (!flatOutputFile.IsNull()) {
-         fileout << "\t" << busPatchId << "\t" << manuId <<"\t"<< channelId << "\t"
-                 << pedMean <<"\t"<< pedSigma << endl;
-       }
-
-       gPedMeanHisto->Fill(pedMean);
-       gPedSigmaHisto->Fill(pedSigma);
-
-       tree->Fill();
-      }
-    }
-  }
-
-  // file outputs
-  if (!flatOutputFile.IsNull()) 
-      fileout.close();
-
-  histoFile->Write();
-  histoFile->Close();
-
-//  delete tree;
-
-
-// not usable need an update of DATE ->5.28, but it compiles
-// uncomment when DATE version ok.
-// setenv DATE_FES_PATH
-// setenv DATE_RUN_NUMBER
-// setenv DATE_ROLE_NAME
-// setenv DATE_DETECTOR_CODE
-
-//   if (!flatOutputFile.IsNull()) {
-
-//     flatOutputFile.Prepend("./");
-
-//     status = daqDA_FES_storeFile(flatOutputFile.Data(),"MUONTRKda_results");
-//     if (status) {
-//       printf("Failed to export file : %d\n",status);
-//       return -1;
-//     }
-//  }
-
-}
-
-//________________
-void MakePedStoreForGain(Int_t injCharge)
-{
-    // store pedestal map in root file
-
-//     Int_t injCharge = 200;
-
-    TTree* tree = 0x0;
-
-    // compute and store pedestals
-    MakePedStore();
-
-    // store in root file
-//     sprintf(gHistoFileName,"mutrkgain.root");
-    
-    TString mode("UPDATE");
-
-    if (gCommand.Contains("cre")) {
-       mode = "RECREATE";
-    }
-    TFile* histoFile = new TFile(gHistoFileName_gain, mode.Data(), "MUON Tracking Gains");
-
-    // second argument should be the injected charge, taken from config crocus file
-    // put also info about run number could be usefull
-    AliMpIntPair* pair   = new AliMpIntPair(gRunNumber, injCharge);
-
-    if (mode.CompareTo("UPDATE") == 0) {
-      tree = (TTree*)histoFile->Get("t");
-      tree->SetBranchAddress("run",&pair);
-      tree->SetBranchAddress("ped",&gPedestalStore);
-
-    } else {
-      tree = new TTree("t","Pedestal tree");
-      tree->Branch("run", "AliMpIntPair",&pair);
-      tree->Branch("ped", "AliMUON2DMap",&gPedestalStore);
-      tree->SetBranchAddress("run",&pair);
-      tree->SetBranchAddress("ped",&gPedestalStore);
-
-    }
-
-    tree->Fill();
-    tree->Write("t", TObject::kOverwrite); // overwrite the tree
-    histoFile->Close();
-
-    delete pair;
-}
-
-//________________
-void MakeGainStore(TString flatOutputFile)
-{
-    Double_t goodA1Min =  0.5;
-    Double_t goodA1Max =  2.;
-    Double_t goodA2Min = -0.5E-03;
-    Double_t goodA2Max =  1.E-03;
-
-    // open file mutrkgain.root
-    // read again the pedestal for the calibration runs (9 runs ?)
-    // need the injection charge from config file (to be done)
-    // For each channel make a TGraphErrors (mean, sigma) vs injected charge
-    // Fit with a polynomial fct
-    // store the result in a flat file.
-
-    Double_t pedMean[11];
-    Double_t pedSigma[11];
-    Double_t injCharge[11];
-    Double_t injChargeErr[11];
-
-    ofstream fileout;
-    TTimeStamp date;
-
-// full print out 
-
-    // why 2 files ? (Ch. F.)
-    FILE *pfilen = 0;
-    if(gPrintLevel==2)
-    {
-//       Char_t filenam[256]="MuonTrkDA_gain.param";
-      cout << " fit parameter file             = " << filenam << "\n";
-      pfilen = fopen (filenam,"w");
-
-      fprintf(pfilen,"//===================================================================\n");
-      fprintf(pfilen,"//  BP MANU CH. a0     a1       a2      xlim  P(chi2) P(chi2)2    Q\n");
-      fprintf(pfilen,"//===================================================================\n");
-    }
-
-    FILE *pfilew=0;
-    if (!flatOutputFile.IsNull()) 
-    {
-      pfilew = fopen (flatOutputFile.Data(),"w");
-
-      fprintf(pfilew,"//=================================================\n");
-      fprintf(pfilew,"//  Calibration file calculated by MUONTRKda \n");
-      fprintf(pfilew,"//=================================================\n");
-      fprintf(pfilew,"//   * Run           : %d \n",gRunNumber); 
-      fprintf(pfilew,"//   * Date          : %s \n",date.AsString("l"));
-      fprintf(pfilew,"//   * Statictics    : %d \n",gNEvents);
-      fprintf(pfilew,"//   * # of MANUS    : %d \n",gNManu);
-      fprintf(pfilew,"//   * # of channels : %d \n",gNChannel);
-      fprintf(pfilew,"//-------------------------------------------------\n");
-      fprintf(pfilew,"//=======================================\n");
-      fprintf(pfilew,"// BP MANU CH.   a1      a2     thres. Q\n");
-      fprintf(pfilew,"//=======================================\n");
-    }
-
-
-
-//     sprintf(gHistoFileName,"mutrkgain.root");
-    TFile*  histoFile = new TFile(gHistoFileName_gain);
-
-    AliMUON2DMap* map[11];
-    AliMUONVCalibParam* ped[11];
-    AliMpIntPair* run[11];
-
-//  plot out 
-
-    TFile* gainFile = 0x0;
-//     sprintf(gRootFileName,"makegain.root");
-    gainFile = new TFile(gRootFileName,"RECREATE");
-
-    Double_t chi2    = 0.;
-    Double_t chi2P2  = 0.;
-    Double_t prChi2  = 0; 
-    Double_t prChi2P2 =0;
-    Double_t a0,a1,a2;
-    Int_t busPatchId ;
-    Int_t manuId     ;
-    Int_t channelId ;
-    Int_t threshold = 0;
-    Int_t Q = 0;
-
-    TTree *tg = new TTree("tg","TTree avec class Manu_DiMu");
-
-    tg->Branch("bp",&busPatchId, "busPatchId/I");
-    tg->Branch("manu",&manuId, "manuId/I");
-    tg->Branch("channel",&channelId, "channelId/I");
-
-    tg->Branch("a0",&a0, "a0/D");
-    tg->Branch("a1",&a1, "a1/D");
-    tg->Branch("a2",&a2, "a2/D");
-    tg->Branch("Pchi2",&prChi2, "prChi2/D");
-    tg->Branch("Pchi2_2",&prChi2P2, "prChi2P2/D");
-    tg->Branch("Threshold",&threshold, "threshold/I");
-    tg->Branch("Q",&Q, "Q/I");
-
-    //read back from root file
-    TTree* tree = (TTree*)histoFile->Get("t");
-    Int_t nEntries = tree->GetEntries();
-//     tree->Branch("a1",&a1, "a1/D");
-
-    if(gPrintLevel) cout << " nEntries = " << nEntries << " DAC values \n" << endl; 
-
-    // read back info
-    for (Int_t i = 0; i < nEntries; ++i) {
-      map[i] = 0x0;
-      run[i] = 0x0;
-      tree->SetBranchAddress("ped",&map[i]);
-      tree->SetBranchAddress("run",&run[i]);
-      tree->GetEvent(i);
-
-//       std::cout << map[i] << " " << run[i] << std::endl;
-    }
-      
-    // Q = f(ADC)
-    TF1 *f1 = new TF1("f1",funcLin,0.,gkADCMax,2);
-    TF1 *f2 = new TF1("f2",funcParabolic,0.,gkADCMax,1);
-
-    char graphName[256];
-
-    // iterates over the first pedestal run
-    TIter next(map[0]->CreateIterator());
-    AliMUONVCalibParam* p;
-
-    Int_t    nmanu         = 0;
-    Int_t    nBadChannel   = 0;
-    Double_t sumProbChi2   = 0.;
-    Double_t sumA1         = 0.;
-    Double_t sumProbChi2P2 = 0.;
-    Double_t sumA2         = 0.;
-
-    Double_t x[11], xErr[11], y[11], yErr[11];
-
-    while ( ( p = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
-    {
-      ped[0]  = p;
-
-//       Int_t busPatchId = p->ID0();
-//       Int_t manuId     = p->ID1();
-      busPatchId = p->ID0();
-      manuId     = p->ID1();
-
-      // read back pedestal from the other runs for the given (bupatch, manu)
-      for (Int_t i = 1; i < nEntries; ++i) {
-       ped[i] = static_cast<AliMUONVCalibParam*>(map[i]->FindObject(busPatchId, manuId));
-      }
-
-      // compute for each channel the gain parameters
-//       for ( Int_t channelId = 0; channelId < ped[0]->Size() ; ++channelId ) {
-      for ( channelId = 0; channelId < ped[0]->Size() ; ++channelId ) {
-
-       Int_t n = 0;
-       for (Int_t i = 0; i < nEntries; ++i) {
-
-         if (!ped[i]) continue; //shouldn't happen.
-         pedMean[i]      = ped[i]->ValueAsDouble(channelId, 0);
-         pedSigma[i]     = ped[i]->ValueAsDouble(channelId, 1);
-         injCharge[i]    = (Double_t)run[i]->GetSecond();
-         injChargeErr[i] = 0.01*injCharge[i];
-         if(injChargeErr[i] <= 1.) injChargeErr[i]=1.;
-
-//       if(n<2)cout << nEntries << " " << i << " " << injCharge[i] << endl;
-
-//       cout << busPatchId << "\t" << manuId <<"\t"<< channelId << "\t" << n << " " << pedMean[i] << " " << pedSigma[i] << " " << injCharge[i] << " " << injChargeErr[i] << endl;
-
-         if (pedMean[i] < 0) continue; // not connected
-
-         if (pedSigma[i] <= 0) pedSigma[i] = 1.; // should not happen.
-         n++;
-       }
-
-       // makegain (JLC)
-
-
-       // Fit Method:  Linear fit over 6 points + fit parabolic function  over 3  points) 
-
-       // 1. - linear fit over 6 points
-
-       Double_t par[4] = {0.,0.,0.,gkADCMax};
-
-       Int_t nInit = 1;
-       Int_t nbs   = nEntries - nInit;
-       Int_t nbpf1 = 6; // linear fit over nbf1 points
-
-       for (Int_t j = 0; j < nbs; ++j)
-       {
-         Int_t k = j + nInit;
-         x[j]    = pedMean[k];
-         xErr[j] = pedSigma[k];
-         y[j]    = injCharge[k];
-         yErr[j] = injChargeErr[k];
-
-       }
-
-       TGraph *graphErr = new TGraphErrors(nbpf1, x, y, xErr, yErr);
-
-       f1->SetParameters(0,0);
-
-       graphErr->Fit("f1","RQ");
-
-       chi2 = f1->GetChisquare();
-       f1->GetParameters(par);
-
-       prChi2 = TMath::Prob(chi2, nbpf1 - 2);
-
-       Double_t xLim = pedMean[nInit + nbpf1 - 1];
-       Double_t yLim = par[0]+par[1] * xLim;
-
-       a0 = par[0];
-       a1 = par[1];
-
-       delete graphErr;
-
-
-       // 2. - Translation : new origin (xLim, yLim) + parabolic fit over nbf2 points
-
-       Int_t nbpf2 = nEntries - (nInit + nbpf1) + 1;
-
-       if(nbpf2 > 1)
-       {
-         for (Int_t j = 0; j < nbpf2; ++j)
-         {
-           Int_t k  = j + (nInit + nbpf1) - 1;
-           x[j]    = pedMean[k] - xLim;
-           xErr[j] = pedSigma[k];
-
-           y[j]    = injCharge[k] - yLim - par[1]*x[j];
-           yErr[j] = injChargeErr[k];
-
-         }
-
-         TGraph *graphErr = new TGraphErrors(nbpf2, x, y, xErr, yErr);
-
-         graphErr->Fit(f2,"RQ");
-         chi2P2 = f2->GetChisquare();
-         f2->GetParameters(par);
-
-         prChi2P2 = TMath::Prob(chi2P2, nbpf2-1);
-
-         a2 = par[0];
-
-         par[0] = a0;
-         par[1] = a1;
-         par[2] = a2;
-         par[3] = xLim;
-
-         delete graphErr;
-
-       }
-
-       // Prints
-
-       Int_t p1 = TMath::Nint(ceil(prChi2*15));
-       Int_t p2 = TMath::Nint(ceil(prChi2P2*15));
-       Q  = p1*16 + p2;
-
-       Double_t x0 = -par[0]/par[1]; // value of x corresponding to à 0 fC 
-       threshold = TMath::Nint(ceil(par[3]-x0)); // linear if x < threshold
-
-       if(gPrintLevel==2)
-       {
-         fprintf(pfilen,"%4i %4i %2i",busPatchId,manuId,channelId);
-         fprintf(pfilen," %6.2f %6.4f %10.3e %4.2f  %5.3f   %5.3f    %x\n",
-                 par[0], par[1], par[2], par[3], prChi2, prChi2P2, Q);
-       }
-
-       // some tests
-       if(par[1]< goodA1Min ||  par[1]> goodA1Max )
-       { 
-         if (gPrintLevel) 
-         {
-           cout << " !!!!!!!!!!!!! Bad Calib.: BP= " << busPatchId << " Manu_Id= " << manuId << 
-               " Ch.= " << channelId << ":";
-           cout << "  a1 = " << par[1] << "    out of limit : [" <<  goodA1Min << "," << goodA1Max << 
-               "]" << endl;
-         }
-         Q=0;
-         nBadChannel++;
-       }
-       else if(par[2]< goodA2Min ||  par[2]> goodA2Max )
-       { 
-         if (gPrintLevel) 
-         {
-           cout << " !!!!!!!!!!!!! Bad Calib.: BP= " << busPatchId << " Manu_Id= " << manuId 
-                << " Ch.= " << channelId << ":";
-           cout << "  a2 = " << par[2] << "    out of limit : [" <<  goodA2Min << "," << goodA2Max 
-                << "]" << endl;
-         }
-         Q=0;
-         nBadChannel++;
-       }
-       else 
-       {
-         sumProbChi2   += prChi2;
-         sumA1         += par[1];
-         sumProbChi2P2 += prChi2P2;
-         sumA2         += par[2];
-
-         if (gPrintLevel) 
-         {
-           if(!p1)
-           { 
-             cout << " ** Warning ** Bad Fit   : BP= " << busPatchId << " Manu_Id= " << manuId 
-                  << "Ch.= " << channelId << ":";
-             cout << "  a1 = " << par[1] << "  P(chi2)_lin = " << prChi2  << endl ;
-           }
-           if(!p2)
-           { 
-             cout << " ** Warning ** Bad Fit   : BP= " << busPatchId << " Manu_Id= " << manuId 
-                  << " Ch.= " << channelId << ":";
-           cout << "  a2 = " << par[2] << "  P_(chi2)_parab = " <<  prChi2P2  << endl;
-           }
-         }
-       }
-
-       tg->Fill();
-
-       if (!flatOutputFile.IsNull()) 
-         {
-           fprintf(pfilew,"%4i %5i %2i %7.4f %10.3e %4i %2x\n",busPatchId,manuId,channelId,par[1],par[2],threshold,Q);
-         }
-
-       // Plots
-
-       if(gPlotLevel){
-         TF1 *f2Calib = new TF1("f2Calib",funcCalib,0.,gkADCMax,NFITPARAMS);
-
-         graphErr = new TGraphErrors(nEntries,pedMean,injCharge,pedSigma,injChargeErr);
-
-         sprintf(graphName,"BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
-
-         graphErr->SetTitle(graphName);
-         graphErr->SetMarkerColor(3);
-         graphErr->SetMarkerStyle(12);
-         graphErr->Write(graphName);
-
-         sprintf(graphName,"f2_BusPatch_%d_Manu_%d_Ch_%d",busPatchId, manuId,channelId);
-         f2Calib->SetTitle(graphName);
-         f2Calib->SetLineColor(4);
-         f2Calib->SetParameters(par);
-         f2Calib->Write(graphName);
-
-         delete graphErr;
-         delete f2Calib;//LA
-       }
-      }
-      nmanu++;
-    }
-
-    // file outputs for gain
-    if (!flatOutputFile.IsNull()) 
-      fileout.close();
-
-    tg->Write();
-    histoFile->Close();
-
-    delete f1;
-    delete f2;
-
-    //OutPut
-    if (gPrintLevel) 
-    {
-      cout << "\n Nb of Manu in raw data       = " << nmanu << " (" << nmanu*64 << " channels)" <<  endl;
-      cout << "\n Nb of   calibrated channels  = " << nmanu*64 - nBadChannel << " (" << goodA1Min << "<a1<" << goodA1Max 
-          << " and " << goodA2Min << "<a2<" << goodA2Max << ") " << endl;
-      cout << "\n Nb of UNcalibrated channels  = " << nBadChannel << " (a1 or a2 out of range)\n" << endl;
-
-      Double_t meanA1         = sumA1/(nmanu*64 - nBadChannel);
-      Double_t meanProbChi2   = sumProbChi2/(nmanu*64 - nBadChannel);
-      Double_t meanA2         = sumA2/(nmanu*64 - nBadChannel);
-      Double_t meanProbChi2P2 = sumProbChi2P2/(nmanu*64 - nBadChannel);
-
-      Double_t capaManu = 0.2; // pF
-      cout << "\n linear fit   : <a1> = " << meanA1 << "\t  <gain>  = " <<  1./(meanA1*capaManu) 
-          << " mV/fC (capa= " << capaManu << " pF)" << endl;
-      cout <<   "        Prob(chi2)>  = " <<  meanProbChi2 << endl;
-      cout << "\n parabolic fit: <a2> = " << meanA2  << endl;
-      cout <<   "        Prob(chi2)>  = " <<  meanProbChi2P2 << "\n" << endl;
-    }
-}
-
-
-AliHLTMUONTrackerCalibratorComponent::AliHLTMUONTrackerCalibratorComponent() :
-       AliHLTCalibrationProcessor(),
-       fFitter(NULL),
-       fSkipEvents(0),
-       fMaxEvents(1000000),
-       fFlatOutputFile(),
-       fCrocusOutputFile(),
-       fCrocusConfigFile(),
-       fInjCharge(0),
-       fNoSigma(3),
-       fThreshold(-1)
-{
-       /// Default contructor.
-}
-
-
-AliHLTMUONTrackerCalibratorComponent::~AliHLTMUONTrackerCalibratorComponent()
-{
-       /// Default destructor.
-       
-       assert( fFitter == NULL );
-}
-
-
-const char* AliHLTMUONTrackerCalibratorComponent::GetComponentID()
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns the component ID string for this component type.
-       
-       return AliHLTMUONConstants::TrackerCalibratorId();
-}
-
-void AliHLTMUONTrackerCalibratorComponent::GetInputDataTypes(
-               vector<AliHLTComponentDataType>& list
-       )
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns the list of input block types expected by this component.
-       
-       list.clear();
-       list.push_back( AliHLTMUONConstants::DDLRawDataType() );
-}
-
-AliHLTComponentDataType AliHLTMUONTrackerCalibratorComponent::GetOutputDataType()
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns the type of output block generated by this component.
-
-       //TODO: fix.
-       return AliHLTMUONConstants::DDLRawDataType();
-}
-
-void AliHLTMUONTrackerCalibratorComponent::GetOutputDataSize(
-               unsigned long& constBase, double& inputMultiplier
-       )
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns an estimate of the expected output data size.
-
-       constBase = 0;
-       inputMultiplier = 2.;  //TODO: is this the correct estimate.
-}
-
-AliHLTComponent* AliHLTMUONTrackerCalibratorComponent::Spawn()
-{
-       /// Inherited from AliHLTComponent.
-       /// Creates a new instance of AliHLTMUONTrackerCalibratorComponent.
-
-       return new AliHLTMUONTrackerCalibratorComponent();
-}
-
-
-Int_t AliHLTMUONTrackerCalibratorComponent::ScanArgument(int argc, const char** argv)
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Parses the command line parameters.
-       
-       TString arg = argv[0];
-       
-       if (arg.CompareTo("-h") == 0)
-       {
-               HLTInfo("******************* usage **********************");
-               HLTInfo("The available options are :");
-               HLTInfo("-h help                   (this screen)");
-               HLTInfo("");
-               HLTInfo(" Input");
-               HLTInfo("-c <Crocus config. file>  (default = %s)", fCrocusConfigFile.Data());
-               HLTInfo("");
-               HLTInfo(" Output");
-               HLTInfo("-a <Flat ASCII file>      (default = %s)", fFlatOutputFile.Data());
-               HLTInfo("-o <CROUCUS cmd file>     (default = %s)", fCrocusOutputFile.Data());
-               HLTInfo("");
-               HLTInfo(" Options");
-               HLTInfo("-d <print level>          (default = %d)", gPrintLevel);
-               HLTInfo("-g <plot level>           (default = %d)", gPlotLevel);
-               HLTInfo("-l <DAC level>            (default = %d)", fInjCharge);
-               HLTInfo("-s <skip events>          (default = %d)", fSkipEvents);
-               HLTInfo("-n <max events>           (default = %d)", fMaxEvents);
-               HLTInfo("-p <n sigmas>             (default = %f)", fNoSigma);
-               HLTInfo("-r root file data for gain(default = %s)", gHistoFileName_gain.Data());
-               HLTInfo("-t <threshold (-1 = no)>  (default = %d)", fThreshold);
-               HLTInfo("-e <execute ped/gain>     (default = %s)", gCommand.Data());
-               HLTInfo("-e <gain create>           make gain & create a new root file");
-               HLTInfo("-e <gain>                  make gain & update root file");
-               HLTInfo("-e <gain compute>          make gain & compute gains");
-               return 0;  // Zero parameters parsed.
-       }
-       
-       if (arg.CompareTo("-a") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               fFlatOutputFile = argv[1];
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-o") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               fCrocusOutputFile = argv[1];
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-c") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               fCrocusConfigFile = argv[1];
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-e") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gCommand = argv[1];
-               gCommand.ToLower();  // set command to lower case
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-d") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gPrintLevel = atoi(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-g") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gPlotLevel = atoi(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-s") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               fSkipEvents = atoi(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-l") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               fInjCharge = atoi(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-n") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               sscanf(argv[1],"%d",&fMaxEvents);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-p") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               sscanf(argv[1],"%lf",&fNoSigma);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-r") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gHistoFileName_gain = argv[1];
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-t") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               sscanf(argv[1],"%d",&fThreshold);
-               return 1;  // 1 parameter parsed.
-       }
-       
-       // Do not know what this argument is so return an error code.
-       HLTError("Bad argument %s (please check with -h)", arg.Data());
-       return -EINVAL;
-}
-
-
-Int_t AliHLTMUONTrackerCalibratorComponent::InitCalibration()
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Initialise the calibration component.
-       
-       TFitter* fFitter = new TFitter(NFITPARAMS);
-       TVirtualFitter::SetFitter(fFitter);
-       
-       Int_t status;
-       
-       gPedestalStore = new AliMUON2DMap(kFALSE);
-       
-       gPedMeanHisto = 0x0;
-       gPedSigmaHisto = 0x0;
-       
-       // once we have a configuration file in db
-       // copy locally a file from daq detector config db 
-       // The current detector is identified by detector code in variable
-       // DATE_DETECTOR_CODE. It must be defined.
-       // If environment variable DAQDA_TEST_DIR is defined, files are copied from DAQDA_TEST_DIR
-       // instead of the database. The usual environment variables are not needed.
-       if (!fCrocusConfigFile.IsNull()) {
-               //status = daqDA_DB_getFile("myconfig", fCrocusConfigFile.Data());
-               status = 0;
-               if (status) {
-                       printf("Failed to get config file : %d\n",status);
-                       return -1;
-               }
-       }
-       
-       return 0;
-}
-
-
-Int_t AliHLTMUONTrackerCalibratorComponent::DeinitCalibration()
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Cleanup the calibration component releasing allocated memory.
-       
-       delete gPedestalStore;
-       gPedestalStore = NULL;
-       
-       delete fFitter;
-       fFitter = NULL;
-       TVirtualFitter::SetFitter(0);
-       
-       return 0;
-}
-
-
-Int_t AliHLTMUONTrackerCalibratorComponent::ProcessCalibration(
-               const AliHLTComponentEventData& /*evtData*/,
-               AliHLTComponentTriggerData& /*trigData*/
-       )
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Perform a calibration procedure on the new event.
-       
-       // Skip Events if needed
-       if (fSkipEvents > 0)
-       {
-               fSkipEvents--;
-               return 0;
-       }
-       
-       // Do not process more than fMaxEvents.
-       if (gNEvents >= fMaxEvents) return 0;
-       if (gNEvents && gNEvents % 100 == 0)
-               HLTInfo("Cumulated events %d", gNEvents);
-       
-       gNEvents++;
-       
-       gRunNumber = GetRunNo();
-       
-       /*
-       Int_t eventType = GetRunType();
-       if (eventType != 7)  // PHYSICS_EVENT - from event.h (DATE software)
-       {
-               HLTWarning("This event is not a physics event");
-               return 0;
-       }
-       */
-       
-       Int_t status;
-       Int_t busPatchId;
-       UShort_t manuId;
-       UChar_t channelId;
-       UShort_t charge;
-       
-       const AliHLTComponentBlockData* iter = NULL;
-       
-       // Loop over all DDL raw data input blocks and decode the event.
-       iter = GetFirstInputBlock( AliHLTMUONConstants::DDLRawDataType() );
-       while (iter != NULL)
-       {
-               // Make sure we have the correct muon tracker DDL type.
-               if (not AliHLTMUONUtils::IsTrackerDDL(iter->fSpecification))
-               {
-                       iter = GetNextInputBlock();
-                       continue;
-               }
-
-               // decoding rawdata headers
-               AliRawReaderMemory* rawReader = new AliRawReaderMemory(
-                               reinterpret_cast<UChar_t*>(iter->fPtr), iter->fSize
-                       );
-               rawReader->SetEquipmentID(AliHLTMUONUtils::SpecToEquipId(iter->fSpecification));
-               
-               // decoding MUON payload
-               AliMUONRawStreamTracker* rawStream  = new AliMUONRawStreamTracker(rawReader);
-               
-               // loops over DDL 
-               rawStream->First();
-               while( (status = rawStream->Next(busPatchId, manuId, channelId, charge)) )
-               {
-                       if (gNEvents == 1)
-                               gNChannel++;
-                       
-                       //       if (gPrintLevel) printf("manuId: %d, channelId: %d charge: %d\n", manuId, 
-                       //                           channelId, charge);
-                       
-                       MakePed(busPatchId, (Int_t)manuId, (Int_t)channelId, (Int_t)charge);
-               } // Next digit
-               
-               delete rawReader;
-               delete rawStream;
-       }
-       
-       if (gCommand.CompareTo("ped") == 0)
-       {
-               Char_t flatFile[256];
-               sprintf(flatFile,"MuonTrkDA_%d_ped.ped",gRunNumber);
-               if(fFlatOutputFile.IsNull())fFlatOutputFile=flatFile;
-               MakePedStore(fFlatOutputFile);
-       }
-       else
-       {
-               if(fFlatOutputFile.IsNull())fFlatOutputFile="MuonTrkDA_gain.par";
-       }
-       
-       // option gain -> update root file with pedestal results
-       // gain + create -> recreate root file
-       // gain + comp -> update root file and compute gain parameters
-       
-       if (gCommand.Contains("gain"))
-               MakePedStoreForGain(fInjCharge);
-       
-       if (gCommand.Contains("comp"))
-               MakeGainStore(fFlatOutputFile);
-       
-       if (gCommand.CompareTo("comp") != 0)
-       {
-               HLTInfo("MUONTRKda : Nb of events used     = %d", gNEvents);
-       }
-       if (gCommand.CompareTo("ped") == 0)
-       {
-               if (!(fCrocusConfigFile.IsNull()))
-                       HLTInfo("MUONTRKda : CROCUS command file generated : %s", fCrocusOutputFile.Data());
-               else
-                       HLTInfo("MUONTRKda : WARNING no CROCUS command file generated");
-               HLTInfo("MUONTRKda : Histo file generated for pedestal : %s", gHistoFileName);
-       }
-       else
-       {
-               HLTInfo("MUONTRKda : Histo file generated for gain     : %s", gHistoFileName_gain.Data());
-               HLTInfo("MUONTRKda : Root file generated               : %s", gRootFileName.Data());
-       }
-       
-       HLTInfo("MUONTRKda : Flat ASCII file generated         : %s", fFlatOutputFile.Data());
-       
-       //TODO:
-       // PushBack data to shared memory ...
-       //PushBack(.....);
-
-       return 0;
-}
-
-
-Int_t AliHLTMUONTrackerCalibratorComponent::ShipDataToFXS(
-               const AliHLTComponentEventData& /*evtData*/,
-               AliHLTComponentTriggerData& /*trigData*/
-       )
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Push the data to the FXS to ship off to the offline CDB.
-       
-       //TODO:
-       // PushBack data to FXS ...
-       //PushToFXS( ..... ) ;
-       
-       return 0;
-}
diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONTrackerCalibratorComponent.h b/HLT/MUON/OnlineAnalysis/AliHLTMUONTrackerCalibratorComponent.h
deleted file mode 100644 (file)
index d269e67..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef ALIHLTMUONTRACKERCALIBRATIONCOMPONENT_H
-#define ALIHLTMUONTRACKERCALIBRATIONCOMPONENT_H
-/* This file is property of and copyright by the ALICE HLT Project        *
- * ALICE Experiment at CERN, All rights reserved.                         *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-///
-/// @file   AliHLTMUONTrackerCalibratorComponent.h
-/// @author Artur Szostak <artursz@iafrica.com>
-/// @date   
-/// @brief  The calibration component for the muon tracking stations.
-///
-
-#include "AliHLTCalibrationProcessor.h"
-
-class TFitter;
-
-/**
- * @class AliHLTMUONTrackerCalibratorComponent
- *
- * This class addapts the code found in MUON/MUONTRKda.cxx
- */
-class AliHLTMUONTrackerCalibratorComponent : public AliHLTCalibrationProcessor
-{
-public:
-
-       AliHLTMUONTrackerCalibratorComponent();
-       virtual ~AliHLTMUONTrackerCalibratorComponent();
-       
-       // Public functions to implement AliHLTComponent's interface.
-       // These functions are required for the registration process
-       
-       virtual const char* GetComponentID();
-       virtual void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
-       virtual AliHLTComponentDataType GetOutputDataType();
-       virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-       virtual AliHLTComponent* Spawn();
-       
-protected:
-       
-       using AliHLTCalibrationProcessor::ProcessCalibration;
-       using AliHLTCalibrationProcessor::ShipDataToFXS;
-       
-       // Protected functions to implement AliHLTCalibrationProcessor's interface.
-       // These functions provide initialization as well as the actual processing
-       // capabilities of the component.
-       
-       virtual Int_t InitCalibration();
-       virtual Int_t DeinitCalibration();
-       virtual Int_t ScanArgument(int argc, const char** argv);
-       virtual Int_t ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
-       virtual Int_t ShipDataToFXS(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
-       
-private:
-
-       // Do not allow copying of this class.
-       AliHLTMUONTrackerCalibratorComponent(const AliHLTMUONTrackerCalibratorComponent& /*obj*/);
-       AliHLTMUONTrackerCalibratorComponent& operator = (const AliHLTMUONTrackerCalibratorComponent& /*obj*/);
-       
-       TFitter* fFitter;  //! Fitter used for gain calibration.
-       Int_t fSkipEvents;  //! Number of events to skip initially.
-       Int_t fMaxEvents;   //! Maximum number of events to process.
-       
-       TString fFlatOutputFile;   //! Flat file name.
-       TString fCrocusOutputFile; //! Crocus command file name.
-       TString fCrocusConfigFile; //! Crocus config file name.
-       
-       Int_t fInjCharge;  //! Injection charge.
-       Double_t fNoSigma; //! Number of sigmas.
-       Int_t fThreshold;  //! Threshold.
-       
-       ClassDef(AliHLTMUONTrackerCalibratorComponent, 0); // The online calibration processing component for the muon trigger.
-
-};
-
-#endif // ALIHLTMUONTRACKERCALIBRATIONCOMPONENT_H
diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerCalibratorComponent.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerCalibratorComponent.cxx
deleted file mode 100644 (file)
index 43000f5..0000000
+++ /dev/null
@@ -1,940 +0,0 @@
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
- * All rights reserved.                                                   *
- *                                                                        *
- * Primary Authors:                                                       *
- *   Artur Szostak <artursz@iafrica.com>                                  *
- *                                                                        *
- * 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$ */
-
-///
-///  @file   AliHLTMUONTriggerCalibratorComponent.cxx
-///  @author Artur Szostak <artursz@iafrica.com>
-///  @date   
-///  @brief  Implementation of the AliHLTMUONTriggerCalibratorComponent class.
-///
-
-#include "AliHLTMUONTriggerCalibratorComponent.h"
-#include "AliHLTMUONConstants.h"
-#include "AliHLTMUONUtils.h"
-
-ClassImp(AliHLTMUONTriggerCalibratorComponent);
-
-///////////////////////////////////////////////////////////////////////////////
-// The code from here on was copied from MUONTRGda.cxx and addapted to the
-// HLT framework.
-//TODO: test that any of this actually works and clean up the code.
-///////////////////////////////////////////////////////////////////////////////
-
-#include <iostream>
-#include <fstream>
-using namespace std;
-
-#include <cstdio>
-#include <cstdlib>
-
-//AliRoot
-#include "AliRawDataHeader.h"
-#include "AliRawReaderMemory.h"
-#include "AliMpConstants.h"
-#include "AliMUONRawStreamTrigger.h"
-#include "AliMUONDarcHeader.h"
-#include "AliMUONRegHeader.h"
-#include "AliMUONLocalStruct.h"
-#include "AliMUONDDLTrigger.h"
-#include "AliMUONVCalibParam.h"
-#include "AliMUONVStore.h"
-#include "AliMUONCalibParamND.h"
-#include "AliMUONCalibParamNI.h"
-#include "AliMUON1DArray.h"
-#include "AliMUONTriggerIO.h"
-
-//ROOT
-#include "TString.h"
-#include "TSystem.h"
-#include "TStopwatch.h"
-#include "TMath.h"
-#include "TTimeStamp.h"
-#include "TROOT.h"
-#include "TPluginManager.h"
-#include "TFile.h"
-#include "TH1F.h"
-#include "TArrayI.h"
-#include "TArrayS.h"
-
-namespace
-{
-
-// global variables
-const Int_t gkNLocalBoard = AliMpConstants::NofLocalBoards();
-
-TString gCommand("ped");
-
-TString gCurrentFileName("MtgCurrent.dat");
-TString gLastCurrentFileName("MtgLastCurrent.dat");
-
-TString gSodName;
-Int_t   gSodFlag = 0;
-
-TString gDAName;
-Int_t   gDAFlag = 0;
-
-TString gGlobalFileName;
-TString gRegionalFileName;
-TString gLocalMaskFileName;
-TString gLocalLutFileName;
-TString gSignatureFileName;
-
-Int_t gGlobalFileVersion;
-Int_t gRegionalFileVersion;
-Int_t gLocalMaskFileVersion;
-Int_t gLocalLutFileVersion;
-Int_t gSignatureFileVersion;
-
-Int_t gGlobalFileLastVersion;
-Int_t gRegionalFileLastVersion;
-Int_t gLocalMaskFileLastVersion;
-Int_t gLocalLutFileLastVersion;
-
-UInt_t gRunNumber = 0;
-Int_t  gNEvents = 0;
-
-Int_t gPrintLevel = 0;
-
-AliMUONVStore* gLocalMasks    = NULL;
-AliMUONVStore* gRegionalMasks = NULL;
-AliMUONVCalibParam* gGlobalMasks = NULL;
-
-AliMUONTriggerIO gTriggerIO;
-
-AliMUONVStore* gPatternStore = NULL;
-
-TString gHistoFileName = "";
-
-Float_t gkThreshold = 0.2;
-
-}; // end of namespace
-
-//__________________________________________________________________
-void UpdateLocalMask(Int_t localBoardId, Int_t connector, Int_t strip)
-{
-
-    // update local mask
-    AliMUONVCalibParam* localMask = 
-       static_cast<AliMUONVCalibParam*>(gLocalMasks->FindObject(localBoardId));
-
-    UShort_t mask = localMask->ValueAsInt(connector,0); 
-
-    mask ^= (0x1 << strip); // set strip mask to zero
-
-    localMask->SetValueAsInt(connector,0, mask);  
-}
-
-//__________________________________________________________________
-void WriteLastCurrentFile(TString currentFile = gLastCurrentFileName)
-{
-       if (gSodName.IsNull()) gSodName = "SOD";
-       if (gDAName.IsNull()) gDAName = "MTG";
-       if (gGlobalFileName.IsNull()) gGlobalFileName = "global.dat";
-       if (gRegionalFileName.IsNull()) gRegionalFileName = "regional.dat";
-       if (gLocalMaskFileName.IsNull()) gLocalMaskFileName = "localMask.dat";
-       if (gLocalLutFileName.IsNull()) gLocalLutFileName = "localLut.dat";
-       if (gSignatureFileName.IsNull()) gSignatureFileName = "signature.dat";
-
-    // write last current file
-    ofstream out;
-    TString file;
-    file = currentFile;
-    out.open(file.Data());
-    out << gSodName << " " << gSodFlag << endl;
-    out << gDAName  << " " << gDAFlag  << endl;
-
-    out << gGlobalFileName    << " " << gGlobalFileVersion    << endl;
-    out << gRegionalFileName  << " " << gRegionalFileVersion  << endl;
-    out << gLocalMaskFileName << " " << gLocalMaskFileVersion << endl;
-    out << gLocalLutFileName  << " " << gLocalLutFileVersion  << endl;
-    out << gSignatureFileName << " " << gSignatureFileVersion << endl;
-
-    out.close();
-}
-
-//___________________________________________________________________________________________
-Bool_t ReadCurrentFile(TString currentFile = gCurrentFileName, Bool_t lastCurrentFlag = false)
-{
-
-    // read last current file name and version
-    char line[80];
-    char name[80];
-
-    TString file;
-    file = currentFile;
-    std::ifstream in(gSystem->ExpandPathName(file.Data()));
-    if (!in.good()) {
-      printf("Cannot open last current file %s\n",currentFile.Data());
-      return false;
-    }
-    
-
-    // read SOD 
-    in.getline(line,80);  
-    sscanf(line, "%s %d", name, &gSodFlag);
-    gSodName = name;
-    if (gPrintLevel) printf("Sod Flag %d\n", gSodFlag);
-
-    //read DA
-    in.getline(line,80);    
-    sscanf(line, "%s %d", name, &gDAFlag);
-    gDAName = name;
-    if (gPrintLevel) printf("DA Flag: %d\n", gDAFlag);
-
-
-    // read global
-    in.getline(line,80);    
-    TString tmp(line);
-    Int_t pos =  tmp.First(" ");
-    gGlobalFileName = tmp(0, pos);
-    
-    if (!lastCurrentFlag) {
-       gGlobalFileVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-       if (gPrintLevel) printf("Global File Name: %s version: %d\n", 
-                           gGlobalFileName.Data(), gGlobalFileVersion);
-    } else {
-       gGlobalFileLastVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-       if (gPrintLevel) printf("Global File Name: %s last version: %d\n", 
-                               gGlobalFileName.Data(), gGlobalFileLastVersion);
-    }
-
-    // read regional
-    in.getline(line,80);
-    tmp = line;
-    pos = tmp.First(" ");
-    gRegionalFileName = tmp(0, pos);
-
-    if (!lastCurrentFlag) {
-       gRegionalFileVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-       if (gPrintLevel) printf("Regional File Name: %s version: %d\n", 
-                               gRegionalFileName.Data(), gRegionalFileVersion);
-
-    } else {
-       gRegionalFileLastVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-       if (gPrintLevel) printf("Regional File Name: %s last version: %d\n", 
-                               gRegionalFileName.Data(), gRegionalFileLastVersion);
-    }
-
-    // read mask
-    in.getline(line,80);    
-    tmp = line;
-    pos = tmp.First(" ");
-    gLocalMaskFileName = tmp(0, pos);
-
-    if (!lastCurrentFlag) {
-      gLocalMaskFileVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-      if (gPrintLevel) printf("Mask File Name: %s version: %d\n", 
-                           gLocalMaskFileName.Data(), gLocalMaskFileVersion);
-    } else {
-      gLocalMaskFileLastVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-      if (gPrintLevel) printf("Mask File Name: %s last version: %d\n", 
-                           gLocalMaskFileName.Data(), gLocalMaskFileLastVersion);
-    }
-    // read Lut
-    in.getline(line,80);    
-    tmp = line;
-    pos = tmp.First(" ");
-    gLocalLutFileName = tmp(0, pos);
-
-    if (!lastCurrentFlag) {
-       gLocalLutFileVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-       if (gPrintLevel) printf("Lut File Name: %s version: %d\n", 
-                               gLocalLutFileName.Data(), gLocalLutFileVersion);
-    } else {
-       gLocalLutFileLastVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-       if (gPrintLevel) printf("Lut File Name: %s last version: %d\n", 
-                               gLocalLutFileName.Data(), gLocalLutFileLastVersion);
-    }
-
-    in.getline(line,80);    
-    tmp = line;
-    pos = tmp.First(" ");
-    gSignatureFileName = tmp(0, pos);
-    gSignatureFileVersion = atoi(tmp(pos+1, tmp.Length()-pos).Data());
-    if (gPrintLevel) printf("Lut File Name: %s version: %d\n", 
-                           gSignatureFileName.Data(), gSignatureFileVersion);
-
-    return true;
-}
-
-//_____________
-void ReadFileNames()
-{
-    // if last current file does not exist than read current file
-    if (!ReadCurrentFile(gLastCurrentFileName, true)) 
-    {
-      ReadCurrentFile(gCurrentFileName, true);
-      WriteLastCurrentFile();
-    } 
-
-    // any case read current file
-    ReadCurrentFile();
-
-}
-
-//__________________
-Bool_t ExportFiles()
-{
-
-    // Export files to FES
-    // Export files to DB not yet done, waiting for a version > 1.2 of daqDAlib
-    // env variables have to be set (suppose by ECS ?)
-    // setenv DATE_FES_PATH
-    // setenv DATE_RUN_NUMBER
-    // setenv DATE_ROLE_NAME
-    // setenv DATE_DETECTOR_CODE
-
-    // to be sure that env variable is set
-    gSystem->Setenv("DAQDALIB_PATH", "$DATE_SITE/infoLogger");
-
-    // update files
-    Int_t status = 0;
-
-    Bool_t modified = false;
-
-    ofstream out;
-    TString fileExp("ExportedFiles.dat");
-    TString file;
-
-    out.open(fileExp.Data());
-    if (!out.good()) {
-       printf("Failed to create file: %s\n",file.Data());
-       return false;
-    }
-
-    if (gGlobalFileLastVersion != gGlobalFileVersion) {
-      file = gGlobalFileName.Data();
-//      status = daqDA_FES_storeFile(file.Data(), file.Data());
-      status = 0;
-      if (status) {
-       printf("Failed to export file: %s\n",gGlobalFileName.Data());
-       return false;
-      }
-      out << gGlobalFileName.Data() << endl;
-      if(gPrintLevel) printf("Export file: %s\n",gGlobalFileName.Data());
-    }
-
-    if (gLocalMaskFileLastVersion != gLocalMaskFileVersion) {
-      modified = true;
-      file = gLocalMaskFileName;
-//      status = daqDA_FES_storeFile(file.Data(), file.Data());
-      status = 0;
-      if (status) {
-       printf("Failed to export file: %s\n",gLocalMaskFileName.Data());
-       return false;
-      }
-      if(gPrintLevel) printf("Export file: %s\n",gLocalMaskFileName.Data());
-      out << gLocalMaskFileName.Data() << endl;
-    }
-
-    if (gLocalLutFileLastVersion != gLocalLutFileVersion) {
-      file = gLocalLutFileName;
-      modified = true;
-//      status = daqDA_FES_storeFile(file.Data(), file.Data());
-      status = 0;
-      if (status) {
-       printf("Failed to export file: %s\n",gLocalLutFileName.Data());
-       return false;
-      }
-      if(gPrintLevel) printf("Export file: %s\n",gLocalLutFileName.Data());
-      out << gLocalLutFileName.Data() << endl;
-
-    }
-
-    // exported regional file whenever mask or/and Lut are modified
-    if ( (gRegionalFileLastVersion != gRegionalFileVersion) || modified) {
-      file = gRegionalFileName;
-//      status = daqDA_FES_storeFile(file.Data(), file.Data());
-      status = 0;
-      if (status) {
-       printf("Failed to export file: %s\n",gRegionalFileName.Data());
-       return false;
-      }
-      if(gPrintLevel) printf("Export file: %s\n",gRegionalFileName.Data());
-      out << gRegionalFileName.Data() << endl;
-    }
-
-    out.close();
-
-    // export Exported file to FES anyway
-//    status = daqDA_FES_storeFile(fileExp.Data(), fileExp.Data());
-    status = 0;
-    if (status) {
-      printf("Failed to export file: %s\n", fileExp.Data());
-      return false;
-    }
-    if(gPrintLevel) printf("Export file: %s\n",fileExp.Data());
-
-    return true;
-}
-
-//__________________
-Bool_t ImportFiles()
-{
-    // copy locally a file from daq detector config db 
-    // The current detector is identified by detector code in variable
-    // DATE_DETECTOR_CODE. It must be defined.
-    // If environment variable DAQDA_TEST_DIR is defined, files are copied from DAQDA_TEST_DIR
-    // instead of the database. The usual environment variables are not needed.
-
-    // to be sure that env variable is set
-    gSystem->Setenv("DAQDALIB_PATH", "$DATE_SITE/db");
-
-    Int_t status = 0;
-
-//    status = daqDA_DB_getFile(gCurrentFileName.Data(), gCurrentFileName.Data());
-    status = 0;
-    if (status) {
-      printf("Failed to get current config file from DB: %s\n",gCurrentFileName.Data());
-      return false;
-    }
-    ReadFileNames();
-
-//    status = daqDA_DB_getFile(gGlobalFileName.Data(), gGlobalFileName.Data());
-    status = 0;
-    if (status) {
-      printf("Failed to get current config file from DB: %s\n", gGlobalFileName.Data());
-      return false;
-    }
-
-//    status = daqDA_DB_getFile(gRegionalFileName.Data(), gRegionalFileName.Data());
-    status = 0;
-    if (status) {
-      printf("Failed to get current config file from DB: %s\n",gRegionalFileName.Data());
-      return false;
-    }
-
-//    status = daqDA_DB_getFile(gLocalMaskFileName.Data(), gLocalMaskFileName.Data());
-    status = 0;
-    if (status) {
-      printf("Failed to get current config file from DB: %s\n",gLocalMaskFileName.Data());
-      return false;
-    }
-
-//    status = daqDA_DB_getFile(gLocalLutFileName.Data(), gLocalLutFileName.Data());
-    status = 0;
-    if (status) {
-      printf("Failed to get current config file from DB: %s\n",gLocalLutFileName.Data());
-      return false;
-    }
-    return true;
-}
-
-//__________
-void MakePattern(Int_t localBoardId, TArrayS& xPattern,  TArrayS& yPattern)
-{
-
-    // calculate the hit map for each strip in x and y direction
-    AliMUONVCalibParam* pat = 
-       static_cast<AliMUONVCalibParam*>(gPatternStore->FindObject(localBoardId));
-
-    if (!pat) {
-      pat = new AliMUONCalibParamND(2, 64, localBoardId, 0,0.); // put default wise 0.
-      gPatternStore->Add(pat); 
-    }
-
-    for (Int_t i = 0; i < 4; ++i) {
-      for (Int_t j = 0; j < 16; ++j) {
-       
-       Int_t xMask = xPattern[i];
-       Int_t yMask = yPattern[i];
-
-       Int_t index = 16*i + j;
-       Double_t patOcc = 0.;
-
-       if ( (xMask >> j ) & 0x1 ) {
-           patOcc  = pat->ValueAsDouble(index, 0) + 1.;
-           pat->SetValueAsDouble(index, 0, patOcc);
-       }
-       if ( (yMask >> j ) & 0x1 ) {
-           patOcc  = pat->ValueAsDouble(index, 0) + 1.;
-           pat->SetValueAsDouble(index, 0, patOcc);
-       }
-      }
-    }
-
-}
-
-//__________
-void MakePatternStore(Bool_t pedestal = true)
-{
-
-    // calculates the occupancy (option: store in a root file)
-    // check noisy strip (pedestal true, software trigger)
-    // check dead channel (pesdetal false, FET trigger)
-
-    Int_t localBoardId = 0;
-    Bool_t updated = false;
-
-    // histo
-
-    Char_t name[255];
-    Char_t title[255];
-
-    TH1F*  xOccHisto[243];
-    TH1F*  yOccHisto[243];
-    TH1F*  xPatOccHisto = 0x0;
-    TH1F*  yPatOccHisto = 0x0;
-
-    TFile*  histoFile = 0x0;
-
-    if (gHistoFileName[0] != 0) {
-      histoFile = new TFile(gHistoFileName,"RECREATE","MUON Tracking pedestals");
-
-      sprintf(name,"pat_x");
-      sprintf(title,"Occupancy for x strip");
-      Int_t nx = 200;
-      Float_t xmin = -0.2;
-      Float_t xmax = 1.2; 
-      xPatOccHisto = new TH1F(name,title,nx,xmin,xmax);
-      xPatOccHisto ->SetDirectory(histoFile);
-
-      sprintf(name,"pat_y");
-      sprintf(title,"Occupancy for y strip");
-      yPatOccHisto = new TH1F(name,title,nx,xmin,xmax);
-      yPatOccHisto->SetDirectory(histoFile);
-    
-    }
-
-    // iterator over pedestal
-    TIter next(gPatternStore->CreateIterator());
-    AliMUONVCalibParam* pat;
-  
-    while ( ( pat = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
-    {
-      localBoardId  = pat->ID0();
-
-      if (gHistoFileName[0] != 0) {
-
-       Int_t nx = 64;
-       Float_t xmin = 0;
-       Float_t xmax = 64;
-
-       sprintf(name,"pat_x_%d",localBoardId);
-       sprintf(title,"Occupancy for x strip, board %d",localBoardId);
-       xOccHisto[localBoardId] = new TH1F(name,title,nx,xmin,xmax);
-
-       sprintf(name,"pat_y_%d",localBoardId);
-       sprintf(title,"Occupancy for y strip, board %d",localBoardId);
-       yOccHisto[localBoardId] = new TH1F(name,title,nx,xmin,xmax);
-
-      }
-
-      for (Int_t index = 0; index < pat->Size() ; ++index) {// 64 bits for X and 64 bits for Y strips
-
-       Double_t patXOcc  = pat->ValueAsDouble(index, 0)/(Double_t)gNEvents;
-       Double_t patYOcc  = pat->ValueAsDouble(index, 1)/(Double_t)gNEvents;
-
-       pat->SetValueAsDouble(index, 0, patXOcc);
-       pat->SetValueAsDouble(index, 1, patYOcc);
-
-
-       // check for x strip
-       if ( (patXOcc > gkThreshold && pedestal) || (patXOcc < 1.- gkThreshold && !pedestal) ) {
-         UShort_t strip  = index % 16;
-         Int_t connector = index/16;
-         UpdateLocalMask(localBoardId, connector, strip); 
-         updated = true;
-       }
-
-       // check for y strip
-       if ( (patYOcc > gkThreshold && pedestal) || (patYOcc < 1.- gkThreshold && !pedestal) ) {
-         UShort_t strip  = index % 16;
-         Int_t connector = index/16 + 4;
-         UpdateLocalMask(localBoardId, connector, strip);
-         updated = true;
-
-       }
-
-       if (gHistoFileName[0] != 0)  {
-         xPatOccHisto->Fill(patXOcc);
-         yPatOccHisto->Fill(patYOcc);
-         xOccHisto[localBoardId]->Fill(index, patXOcc);
-         yOccHisto[localBoardId]->Fill(index, patYOcc);
-
-       }       
-      }
-    }
-
-    if (gHistoFileName[0] != 0) {
-      histoFile->Write();
-      histoFile->Close();
-    }
-
-    if (updated) {
-
-      // update version
-      gLocalMaskFileVersion++;
-
-      TString tmp(gLocalMaskFileName);
-      Int_t pos = tmp.First("-");
-      gLocalMaskFileName = tmp(0,pos+1) + Form("%d",gLocalMaskFileVersion) + ".dat"; 
-
-      // write last current file
-      WriteLastCurrentFile();
-
-      gTriggerIO.WriteMasks(gLocalMaskFileName, gRegionalFileName, gGlobalFileName, gLocalMasks, gRegionalMasks, gGlobalMasks);
-    }
-}
-
-
-AliHLTMUONTriggerCalibratorComponent::AliHLTMUONTriggerCalibratorComponent() :
-       AliHLTCalibrationProcessor(),
-       fSkipEvents(0),
-       fMaxEvents(1000000)
-{
-       /// Default contructor.
-}
-
-
-AliHLTMUONTriggerCalibratorComponent::~AliHLTMUONTriggerCalibratorComponent()
-{
-       /// Default destructor.
-}
-
-
-const char* AliHLTMUONTriggerCalibratorComponent::GetComponentID()
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns the component ID string for this component type.
-       
-       return AliHLTMUONConstants::TriggerCalibratorId();
-}
-
-
-void AliHLTMUONTriggerCalibratorComponent::GetInputDataTypes(
-               vector<AliHLTComponentDataType>& list
-       )
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns the list of input block types expected by this component.
-
-       list.clear();
-       list.push_back( AliHLTMUONConstants::DDLRawDataType() );
-}
-
-
-AliHLTComponentDataType AliHLTMUONTriggerCalibratorComponent::GetOutputDataType()
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns the type of output block generated by this component.
-
-       //TODO: fix.
-       return AliHLTMUONConstants::DDLRawDataType();
-}
-
-
-void AliHLTMUONTriggerCalibratorComponent::GetOutputDataSize(
-               unsigned long& constBase, double& inputMultiplier
-       )
-{
-       /// Inherited from AliHLTComponent.
-       /// Returns an estimate of the expected output data size.
-
-       constBase = 0;
-       inputMultiplier = 2.;  //TODO: is this the correct estimate.
-}
-
-
-AliHLTComponent* AliHLTMUONTriggerCalibratorComponent::Spawn()
-{
-       /// Inherited from AliHLTComponent.
-       /// Creates a new instance of AliHLTMUONTriggerCalibratorComponent.
-
-       return new AliHLTMUONTriggerCalibratorComponent();
-}
-
-
-Int_t AliHLTMUONTriggerCalibratorComponent::ScanArgument(int argc, const char** argv)
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Parses the command line parameters.
-       
-       TString arg = argv[0];
-       
-       if (arg.CompareTo("-h") == 0)
-       {
-               HLTInfo("******************* usage **********************");
-               HLTInfo("The available options are :");
-               HLTInfo("-h help                   (this screen)");
-               HLTInfo("");
-               HLTInfo(" Output");
-               HLTInfo("-r <root file>            (default = %s)", gHistoFileName.Data());
-               HLTInfo("");
-               HLTInfo(" Options");
-               HLTInfo("-t <threshold values>     (default = %3.1f)", gkThreshold);
-               HLTInfo("-d <print level>          (default = %d)", gPrintLevel);
-               HLTInfo("-s <skip events>          (default = %d)", fSkipEvents);
-               HLTInfo("-n <max events>           (default = %d)", fMaxEvents);
-               HLTInfo("-e <execute ped/calib>    (default = %s)", gCommand.Data());
-               return 0;  // Zero parameters parsed.
-       }
-       
-       if (arg.CompareTo("-t") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gkThreshold = atof(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-e") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gCommand = argv[1];
-               gCommand.ToLower();  // set command to lower case
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-d") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gPrintLevel = atoi(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-s") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               fSkipEvents = atoi(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-n") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               fMaxEvents = atoi(argv[1]);
-               return 1;  // 1 parameter parsed.
-       }
-       if (arg.CompareTo("-r") == 0)
-       {
-               if (argc < 2) return -EPROTO;
-               gHistoFileName = argv[1];
-               return 1;  // 1 parameter parsed.
-       }
-       
-       // Do not know what this argument is so return an error code.
-       HLTError("Bad argument %s (please check with -h)", arg.Data());
-       return -EINVAL;
-}
-
-
-Int_t AliHLTMUONTriggerCalibratorComponent::InitCalibration()
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Initialise the calibration component.
-       
-       // comment out, since we do not retrieve files from database
-       if (!ImportFiles())
-       {
-               HLTError("Import from DB failed");
-               HLTError("For local test set DAQDA_TEST_DIR to the local directory where the Mtg files are located.");
-               return -1;
-       }
-       /*
-       if (!gDAFlag)
-       {
-               if(!ExportFiles()) return -1;
-               return 0;
-       }
-       */
-
-       // read mask files
-       gLocalMasks    = new AliMUON1DArray(gkNLocalBoard+9);
-       gRegionalMasks = new AliMUON1DArray(16);
-       gGlobalMasks   = new AliMUONCalibParamNI(1,2,1,0,0);
-       gPatternStore  = new AliMUON1DArray(gkNLocalBoard+9);
-       
-       TString localFile    = gLocalMaskFileName;
-       TString regionalFile = gRegionalFileName;
-       TString globalFile   = gGlobalFileName;
-       
-       gTriggerIO.ReadMasks(localFile.Data(), regionalFile.Data(), globalFile.Data(),
-                               gLocalMasks, gRegionalMasks, gGlobalMasks, false);
-
-       return 0;
-}
-
-
-Int_t AliHLTMUONTriggerCalibratorComponent::DeinitCalibration()
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Cleanup the calibration component releasing allocated memory.
-       
-       delete gLocalMasks;
-       delete gRegionalMasks;
-       delete gGlobalMasks; // in case
-       delete gPatternStore;
-       gLocalMasks = NULL;
-       gRegionalMasks = NULL;
-       gGlobalMasks = NULL;
-       gPatternStore = NULL;
-       
-       return 0;
-}
-
-
-Int_t AliHLTMUONTriggerCalibratorComponent::ProcessCalibration(
-               const AliHLTComponentEventData& /*evtData*/,
-               AliHLTComponentTriggerData& /*trigData*/
-       )
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Perform a calibration procedure on the new event.
-       
-       // Skip Events if needed
-       if (fSkipEvents > 0)
-       {
-               fSkipEvents--;
-               return 0;
-       }
-       
-       // Do not process more than fMaxEvents.
-       if (gNEvents >= fMaxEvents) return 0;
-       if (gNEvents && gNEvents % 100 == 0)
-               HLTInfo("Cumulated events %d", gNEvents);
-       
-       gNEvents++;
-       
-       gRunNumber = GetRunNo();
-       
-       /*
-       Int_t eventType = GetRunType();
-       if (eventType != 7)  // PHYSICS_EVENT - from event.h (DATE software)
-       {
-               HLTWarning("This event is not a physics event");
-               return 0;
-       }
-       */
-       
-       Int_t status;
-       
-       // containers
-       AliMUONDDLTrigger*       ddlTrigger  = 0x0;
-       AliMUONDarcHeader*       darcHeader  = 0x0;
-       AliMUONRegHeader*        regHeader   = 0x0;
-       AliMUONLocalStruct*      localStruct = 0x0;
-
-       const AliHLTComponentBlockData* iter = NULL;
-       
-       // Loop over all DDL raw data input blocks and decode the event.
-       iter = GetFirstInputBlock( AliHLTMUONConstants::DDLRawDataType() );
-       while (iter != NULL)
-       {
-               // Make sure we have the correct muon trigger DDL type.
-               if (not AliHLTMUONUtils::IsTriggerDDL(iter->fSpecification))
-               {
-                       iter = GetNextInputBlock();
-                       continue;
-               }
-               
-               // decoding rawdata headers
-               AliRawReaderMemory* rawReader = new AliRawReaderMemory(
-                               reinterpret_cast<UChar_t*>(iter->fPtr), iter->fSize
-                       );
-               rawReader->SetEquipmentID(AliHLTMUONUtils::SpecToEquipId(iter->fSpecification));
-               
-               // decoding MUON payload
-               AliMUONRawStreamTrigger* rawStream  = new AliMUONRawStreamTrigger(rawReader);
-               //rawStream->SetMaxReg(1);
-               
-               Int_t index = 0;
-               // loops over DDL 
-               while((status = rawStream->NextDDL()))
-               {
-                       if (gPrintLevel) HLTInfo("iDDL %d", rawStream->GetDDL());
-               
-                       ddlTrigger = rawStream->GetDDLTrigger();
-                       darcHeader = ddlTrigger->GetDarcHeader();
-               
-                       if (gPrintLevel) HLTInfo("Global output %x", (Int_t)darcHeader->GetGlobalOutput());
-               
-                       // loop over regional structures
-                       Int_t nReg = darcHeader->GetRegHeaderEntries();
-                       for(Int_t iReg = 0; iReg < nReg; ++iReg)
-                       {   //REG loop
-                               if (gPrintLevel) HLTInfo("RegionalId %d", iReg);
-                       
-                               regHeader =  darcHeader->GetRegHeaderEntry(iReg);
-                       
-                               // loop over local structures
-                               Int_t nLocal = regHeader->GetLocalEntries();
-                               for(Int_t iLocal = 0; iLocal < nLocal; ++iLocal)
-                               {
-                                       localStruct = regHeader->GetLocalEntry(iLocal);
-                               
-                                       Int_t localBoardId = gTriggerIO.LocalBoardId(index++);
-                                       if (gPrintLevel) HLTInfo("local %d",  localBoardId );
-                               
-                                       TArrayS xPattern(4);
-                                       TArrayS yPattern(4);
-                                       localStruct->GetXPattern(xPattern);
-                                       localStruct->GetYPattern(yPattern);
-                                       MakePattern(localBoardId, xPattern, yPattern);
-                               
-                                       if (gPrintLevel)
-                                       {
-                                               HLTInfo("X pattern %x %x %x %x, Y pattern %x %x %x %x",
-                                                       localStruct->GetX1(), localStruct->GetX2(),localStruct->GetX3(),localStruct->GetX4(),
-                                                       localStruct->GetY1(), localStruct->GetY2(),localStruct->GetY3(),localStruct->GetY4()
-                                               );
-                                       }
-                               } // iLocal
-                       } // iReg
-               } // NextDDL
-               
-               delete rawReader;
-               delete rawStream;
-       
-               // Get next DDL raw data input block, with the same specification as defined in GetFirstInputBlock().
-               iter = GetNextInputBlock();
-       }
-       
-       if (gCommand.Contains("ped")) 
-               MakePatternStore();
-       
-       if (gCommand.Contains("cal"))
-               HLTWarning("Options %s disabled", gCommand.Data());
-       //      MakePatternStore(false);
-       
-       if (!ExportFiles())
-               return -1;
-       
-       HLTInfo("MUONTRKda : Run number                    : %d", gRunNumber);
-       HLTInfo("MUONTRKda : Histo file generated          : %s", gHistoFileName.Data());
-       HLTInfo("MUONTRKda : Nb of events used     = %d", gNEvents);
-       
-       //TODO:
-       // PushBack data to shared memory ...
-       //PushBack(.....);
-
-       return 0;
-}
-
-
-Int_t AliHLTMUONTriggerCalibratorComponent::ShipDataToFXS(
-               const AliHLTComponentEventData& /*evtData*/,
-               AliHLTComponentTriggerData& /*trigData*/
-       )
-{
-       /// Inherited from AliHLTCalibrationProcessor.
-       /// Push the data to the FXS to ship off to the offline CDB.
-       
-       //TODO:
-       // PushBack data to FXS ...
-       //PushToFXS( ..... ) ;
-       
-       return 0;
-}
diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerCalibratorComponent.h b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerCalibratorComponent.h
deleted file mode 100644 (file)
index 9128135..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef ALIHLTMUONTRIGGERCALIBRATIONCOMPONENT_H
-#define ALIHLTMUONTRIGGERCALIBRATIONCOMPONENT_H
-/* This file is property of and copyright by the ALICE HLT Project        *
- * ALICE Experiment at CERN, All rights reserved.                         *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-///
-/// @file   AliHLTMUONTriggerCalibratorComponent.h
-/// @author Artur Szostak <artursz@iafrica.com>
-/// @date   
-/// @brief  The calibration component for the muon trigger.
-///
-
-#include "AliHLTCalibrationProcessor.h"
-
-/**
- * @class AliHLTMUONTriggerCalibratorComponent
- *
- * This class addapts the code found in MUON/MUONTRGda.cxx
- */
-class AliHLTMUONTriggerCalibratorComponent : public AliHLTCalibrationProcessor
-{
-public:
-
-       AliHLTMUONTriggerCalibratorComponent();
-       virtual ~AliHLTMUONTriggerCalibratorComponent();
-       
-       // Public functions to implement AliHLTComponent's interface.
-       // These functions are required for the registration process
-       
-       virtual const char* GetComponentID();
-       virtual void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
-       virtual AliHLTComponentDataType GetOutputDataType();
-       virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-       virtual AliHLTComponent* Spawn();
-       
-protected:
-       
-       using AliHLTCalibrationProcessor::ProcessCalibration;
-       using AliHLTCalibrationProcessor::ShipDataToFXS;
-       
-       // Protected functions to implement AliHLTCalibrationProcessor's interface.
-       // These functions provide initialization as well as the actual processing
-       // capabilities of the component.
-       
-       virtual Int_t InitCalibration();
-       virtual Int_t DeinitCalibration();
-       virtual Int_t ScanArgument(int argc, const char** argv);
-       virtual Int_t ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
-       virtual Int_t ShipDataToFXS(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
-       
-private:
-
-       // Do not allow copying of this class.
-       AliHLTMUONTriggerCalibratorComponent(const AliHLTMUONTriggerCalibratorComponent& /*obj*/);
-       AliHLTMUONTriggerCalibratorComponent& operator = (const AliHLTMUONTriggerCalibratorComponent& /*obj*/);
-       
-       Int_t fSkipEvents;  //! Number of events to skip initially.
-       Int_t fMaxEvents;   //! Maximum number of events to process.
-       
-       ClassDef(AliHLTMUONTriggerCalibratorComponent, 0); // The online calibration processing component for the muon trigger.
-
-};
-
-#endif // ALIHLTMUONTRIGGERCALIBRATIONCOMPONENT_H
index ecd3b37..34e4882 100644 (file)
@@ -10,8 +10,6 @@ CLASS_HDRS :=         OfflineInterface/AliHLTMUONAgent.h \
                OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.h \
                OnlineAnalysis/AliHLTMUONHitReconstructorComponent.h \
                OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.h \
-               OnlineAnalysis/AliHLTMUONTriggerCalibratorComponent.h \
-               OnlineAnalysis/AliHLTMUONTrackerCalibratorComponent.h \
                utils/AliHLTMUONEmptyEventFilterComponent.h \
                AliHLTMUONRecHit.h \
                AliHLTMUONTriggerRecord.h \