ROOT logo
// $Id$

AliAnalysisTaskEMCALClusterize* ConfigEMCALClusterize()
{
    
  AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize("EMCALClusterize");
  clusterize->SelectCollisionCandidates();
  clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB");
  clusterize->FillAODFile(kTRUE); // fill aod.root with clusters?, not really needed for analysis.
  clusterize->JustUnfold(kFALSE); // if TRUE, do just unfolding, do not recluster cells
  AliEMCALRecParam * params = clusterize->GetRecParam();
  params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerNxN);
  params->SetClusteringThreshold(0.1); // 100 MeV                                             
  params->SetMinECut(0.01);  //10 MeV    
  params->SetUnfold(kFALSE);
  params->SetW0(4.5);
  params->SetTimeCut(1e6);//Open this cut for AODs
  params->SetTimeMin(-1); //Open this cut for AODs
  params->SetTimeMax(1e6);//Open this cut for AODs    
  
  //Allignment matrices  
  clusterize->SwitchOnLoadOwnGeometryMatrices();
  TGeoHMatrix *matrix[4];
  double rotationMatrix[4][9] = {
    -0.014587, -0.999892, -0.002031, 0.999892, -0.014591,  0.001979, -0.002009, -0.002002,  0.999996,
    -0.014587,  0.999892,  0.002031, 0.999892,  0.014591, -0.001979, -0.002009,  0.002002, -0.999996,
    -0.345864, -0.938278, -0.003412, 0.938276, -0.345874,  0.003010, -0.004004, -0.002161,  0.999990,
    -0.345864,  0.938278,  0.003412, 0.938276,  0.345874, -0.003010, -0.004004,  0.002161, -0.999990
  };
  
  double translationMatrix[4][3] = {
    0.351659, 447.576446,  176.269742,
    1.062577, 446.893974, -173.728870,
    -154.213287, 419.306156,  176.753692,
    -153.018950, 418.623681, -173.243605};
  
  for(int j=0; j<4; j++){
    matrix[j] = new TGeoHMatrix();
    matrix[j]->SetRotation(rotationMatrix[j]);
    matrix[j]->SetTranslation(translationMatrix[j]);
    //matrix[j]->Print();
    clusterize->SetGeometryMatrixInSM(matrix[j],j);
  }
  
  
//  AliEMCALRecoUtils * reco = clusterize->GetRecoUtils();

  //Recalibration factors
//  reco->SwitchOnRecalibration();
//  TFile * f = new TFile("RecalibrationFactors.root","read");
//  TH2F * h0 = (TH2F*)f->Get("EMCALRecalFactors_SM0");
//  TH2F * h1 = (TH2F*)f->Get("EMCALRecalFactors_SM1");
//  TH2F * h2 = (TH2F*)f->Get("EMCALRecalFactors_SM2");
//  TH2F * h3 = (TH2F*)f->Get("EMCALRecalFactors_SM3");
//  reco->SetEMCALChannelRecalibrationFactors(0,h0);
//  reco->SetEMCALChannelRecalibrationFactors(1,h1);
//  reco->SetEMCALChannelRecalibrationFactors(2,h2);
//  reco->SetEMCALChannelRecalibrationFactors(3,h3);
//  
//  reco->SwitchOnTimeDepCorrection();
//  //char cmd[200] ; 
//  //sprintf(cmd, ".!tar xvfz CorrectionFiles.tgz") ; 
//  //gROOT->ProcessLine(cmd) ; 
//  
//  // Remove EMCAL hottest channels for first LHC10 periods      
//  reco->SwitchOnBadChannelsRemoval();
//  reco->SwitchOnDistToBadChannelRecalculation();
//  TFile * fbad = new TFile("BadChannels.root","read");
//  TH2I * hbad0 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod0");
//  TH2I * hbad1 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod1");
//  TH2I * hbad2 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod2");
//  TH2I * hbad3 = (TH2I*)fbad->Get("EMCALBadChannelMap_Mod3");
//  reco->SetEMCALChannelStatusMap(0,hbad0);
//  reco->SetEMCALChannelStatusMap(1,hbad1);
//  reco->SetEMCALChannelStatusMap(2,hbad2);
//  reco->SetEMCALChannelStatusMap(3,hbad3);
    
  return clusterize;
  
}
 ConfigEMCALClusterize.C:1
 ConfigEMCALClusterize.C:2
 ConfigEMCALClusterize.C:3
 ConfigEMCALClusterize.C:4
 ConfigEMCALClusterize.C:5
 ConfigEMCALClusterize.C:6
 ConfigEMCALClusterize.C:7
 ConfigEMCALClusterize.C:8
 ConfigEMCALClusterize.C:9
 ConfigEMCALClusterize.C:10
 ConfigEMCALClusterize.C:11
 ConfigEMCALClusterize.C:12
 ConfigEMCALClusterize.C:13
 ConfigEMCALClusterize.C:14
 ConfigEMCALClusterize.C:15
 ConfigEMCALClusterize.C:16
 ConfigEMCALClusterize.C:17
 ConfigEMCALClusterize.C:18
 ConfigEMCALClusterize.C:19
 ConfigEMCALClusterize.C:20
 ConfigEMCALClusterize.C:21
 ConfigEMCALClusterize.C:22
 ConfigEMCALClusterize.C:23
 ConfigEMCALClusterize.C:24
 ConfigEMCALClusterize.C:25
 ConfigEMCALClusterize.C:26
 ConfigEMCALClusterize.C:27
 ConfigEMCALClusterize.C:28
 ConfigEMCALClusterize.C:29
 ConfigEMCALClusterize.C:30
 ConfigEMCALClusterize.C:31
 ConfigEMCALClusterize.C:32
 ConfigEMCALClusterize.C:33
 ConfigEMCALClusterize.C:34
 ConfigEMCALClusterize.C:35
 ConfigEMCALClusterize.C:36
 ConfigEMCALClusterize.C:37
 ConfigEMCALClusterize.C:38
 ConfigEMCALClusterize.C:39
 ConfigEMCALClusterize.C:40
 ConfigEMCALClusterize.C:41
 ConfigEMCALClusterize.C:42
 ConfigEMCALClusterize.C:43
 ConfigEMCALClusterize.C:44
 ConfigEMCALClusterize.C:45
 ConfigEMCALClusterize.C:46
 ConfigEMCALClusterize.C:47
 ConfigEMCALClusterize.C:48
 ConfigEMCALClusterize.C:49
 ConfigEMCALClusterize.C:50
 ConfigEMCALClusterize.C:51
 ConfigEMCALClusterize.C:52
 ConfigEMCALClusterize.C:53
 ConfigEMCALClusterize.C:54
 ConfigEMCALClusterize.C:55
 ConfigEMCALClusterize.C:56
 ConfigEMCALClusterize.C:57
 ConfigEMCALClusterize.C:58
 ConfigEMCALClusterize.C:59
 ConfigEMCALClusterize.C:60
 ConfigEMCALClusterize.C:61
 ConfigEMCALClusterize.C:62
 ConfigEMCALClusterize.C:63
 ConfigEMCALClusterize.C:64
 ConfigEMCALClusterize.C:65
 ConfigEMCALClusterize.C:66
 ConfigEMCALClusterize.C:67
 ConfigEMCALClusterize.C:68
 ConfigEMCALClusterize.C:69
 ConfigEMCALClusterize.C:70
 ConfigEMCALClusterize.C:71
 ConfigEMCALClusterize.C:72
 ConfigEMCALClusterize.C:73
 ConfigEMCALClusterize.C:74
 ConfigEMCALClusterize.C:75
 ConfigEMCALClusterize.C:76
 ConfigEMCALClusterize.C:77
 ConfigEMCALClusterize.C:78
 ConfigEMCALClusterize.C:79
 ConfigEMCALClusterize.C:80
 ConfigEMCALClusterize.C:81