ROOT logo

//**************************************************************************
//* This file is property of and copyright by the ALICE HLT Project        * 
//* ALICE Experiment at CERN, All rights reserved.                         *
//*                                                                        *
//* Primary Authors Kenneth Aamodt <kenneth.aamodt@cern.ch>                *
//*                  for The ALICE HLT 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   histogramHandlerTest.C
 * @author Kenneth.Aamodt@cern.ch
 * @date   
 * @brief  Test macro for histogram handler
 *
 * To test the histogram handler the AliHLTTPCClusterHistoComponent is used as input to the 
 * histogram handler. There are two clusterfinders running, each of these sends its output to 
 * one clusterhisto component each, which again sends its data to 2 histogram handlers.
 * One of the Histogram handlers get data from one of the cluster histo components, while the
 * other get the output from both.
 * The content of the two rootfiles can now be compared to eachother.
 * The histograms in histogramHandlerFile2... should now have double the amount of entries, and the
 * height in the y-axis should be 2 times that of the histogramHandlerFile1...
 */

void histogramHandlerTest(const char* input="./"){
  
  if (!input) {
    cerr << "please specify input or run without arguments" << endl;
    return;
  }
  
  
  /////////////////////////////////////////////////////////////////////////////////////////////////
  // 
  // init the HLT system in order to define the analysis chain below
  //
  AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();

  ///////////////////////////////////////////////////////////////////////////////////////////////////
  //
  // define the analysis chain to be run
  //
    
  int iMinSlice=0; 
  int iMaxSlice=35;
  int iMinPart=0;
  int iMaxPart=5;

  TString histogramHandlerInput1;
  TString histogramHandlerInput2;
  TString histogramHandlerOutput1;
  TString histogramHandlerOutput2;
  TString rootFileWriterInput1;
  TString rootFileWriterInput2;

  for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
    for (int part=iMinPart; part<=iMaxPart; part++) {
      TString clusterFinderOutput1;
      TString clusterFinderOutput2;
      TString clusterHistoInput1;
      TString clusterHistoInput2;
      TString clusterHistoOutput1;
      TString clusterHistoOutput2;
      TString arg, publisher;
      // digit publisher components
      int ddlno=768;
      if (part>1) ddlno+=72+4*slice+(part-2);
      else ddlno+=2*slice+part;
      arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x", ddlno, slice, slice, part, part);

      publisher.Form("DP_%02d_%d", slice, part);
      AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());

      // first clusterfinder
      clusterFinderOutput1.Form("CF1_%02d_%d", slice, part);
      AliHLTConfiguration cfconf(clusterFinderOutput1.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 446");//-timebins set to simulated data
      if (clusterHistoInput1.Length()>0) clusterHistoInput1+=" ";
      clusterHistoInput1+=clusterFinderOutput1;

      // second clusterfinder
      clusterFinderOutput2.Form("CF2_%02d_%d", slice, part);
      AliHLTConfiguration cfconf(clusterFinderOutput2.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 446");//-timebins set to simulated data
      if (clusterHistoInput2.Length()>0) clusterHistoInput2+=" ";
      clusterHistoInput2+=clusterFinderOutput2;
    

      // first cluster histo component
      clusterHistoOutput1.Form("CH1_%02d_%d", slice, part);
      AliHLTConfiguration cfconf(clusterHistoOutput1.Data(), "TPCClusterHisto", clusterHistoInput1.Data(), "");
      if (histogramHandlerInput1.Length()>0) histogramHandlerInput1+=" ";
      histogramHandlerInput1+=clusterHistoOutput1;

      //second cluster histo component
      clusterHistoOutput2.Form("CH2_%02d_%d", slice, part);
      AliHLTConfiguration cfconf(clusterHistoOutput2.Data(), "TPCClusterHisto", clusterHistoInput2.Data(), "");
      if (histogramHandlerInput1.Length()>0) histogramHandlerInput1+=" ";
      histogramHandlerInput1+=clusterHistoOutput2;
      if (histogramHandlerInput2.Length()>0) histogramHandlerInput2+=" ";
      histogramHandlerInput2+=clusterHistoOutput2;

    }
  }
  
  // first histogram handler component
  histogramHandlerOutput1.Form("HH1_%02d_%d", slice, part);
  AliHLTConfiguration cfconf(histogramHandlerOutput1.Data(), "TPCHistogramHandler", histogramHandlerInput1.Data(), "-use-general");
  if (rootFileWriterInput1.Length()>0) rootFileWriterInput1+=" ";
  rootFileWriterInput1+=histogramHandlerOutput1;
  
  // second histogram handler component
  histogramHandlerOutput2.Form("HH2_%02d_%d", slice, part);
  AliHLTConfiguration cfconf(histogramHandlerOutput2.Data(), "TPCHistogramHandler", histogramHandlerInput2.Data(), "-use-general");
  if (rootFileWriterInput2.Length()>0) rootFileWriterInput2+=" ";
  rootFileWriterInput2+=histogramHandlerOutput2;
  
  AliHLTConfiguration rootFileWriter1("RootFileWriter1", "ROOTFileWriter", rootFileWriterInput1.Data() , "-datafile histogramHandlerFile1");

  AliHLTConfiguration rootFileWriter2("RootFileWriter2", "ROOTFileWriter", rootFileWriterInput2.Data() , "-datafile histogramHandlerFile2");


  ///////////////////////////////////////////////////////////////////////////////////////////////////
  //
  // Init and run the reconstruction
  // All but HLT reconstruction is switched off
  //
  AliReconstruction rec;
  rec.SetInput(input);
  rec.SetRunVertexFinder(kFALSE);
  rec.SetRunLocalReconstruction("HLT");
  rec.SetRunTracking("");
  rec.SetLoadAlignFromCDB(0);
  rec.SetRunQA(":");
  //rec.SetFillESD("HLT");
  rec.SetFillESD("");
  rec.SetFillTriggerESD(false);
  rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=RootFileWriter1,RootFileWriter2");
  rec.Run();
}
 histogramHandlerTest.C:1
 histogramHandlerTest.C:2
 histogramHandlerTest.C:3
 histogramHandlerTest.C:4
 histogramHandlerTest.C:5
 histogramHandlerTest.C:6
 histogramHandlerTest.C:7
 histogramHandlerTest.C:8
 histogramHandlerTest.C:9
 histogramHandlerTest.C:10
 histogramHandlerTest.C:11
 histogramHandlerTest.C:12
 histogramHandlerTest.C:13
 histogramHandlerTest.C:14
 histogramHandlerTest.C:15
 histogramHandlerTest.C:16
 histogramHandlerTest.C:17
 histogramHandlerTest.C:18
 histogramHandlerTest.C:19
 histogramHandlerTest.C:20
 histogramHandlerTest.C:21
 histogramHandlerTest.C:22
 histogramHandlerTest.C:23
 histogramHandlerTest.C:24
 histogramHandlerTest.C:25
 histogramHandlerTest.C:26
 histogramHandlerTest.C:27
 histogramHandlerTest.C:28
 histogramHandlerTest.C:29
 histogramHandlerTest.C:30
 histogramHandlerTest.C:31
 histogramHandlerTest.C:32
 histogramHandlerTest.C:33
 histogramHandlerTest.C:34
 histogramHandlerTest.C:35
 histogramHandlerTest.C:36
 histogramHandlerTest.C:37
 histogramHandlerTest.C:38
 histogramHandlerTest.C:39
 histogramHandlerTest.C:40
 histogramHandlerTest.C:41
 histogramHandlerTest.C:42
 histogramHandlerTest.C:43
 histogramHandlerTest.C:44
 histogramHandlerTest.C:45
 histogramHandlerTest.C:46
 histogramHandlerTest.C:47
 histogramHandlerTest.C:48
 histogramHandlerTest.C:49
 histogramHandlerTest.C:50
 histogramHandlerTest.C:51
 histogramHandlerTest.C:52
 histogramHandlerTest.C:53
 histogramHandlerTest.C:54
 histogramHandlerTest.C:55
 histogramHandlerTest.C:56
 histogramHandlerTest.C:57
 histogramHandlerTest.C:58
 histogramHandlerTest.C:59
 histogramHandlerTest.C:60
 histogramHandlerTest.C:61
 histogramHandlerTest.C:62
 histogramHandlerTest.C:63
 histogramHandlerTest.C:64
 histogramHandlerTest.C:65
 histogramHandlerTest.C:66
 histogramHandlerTest.C:67
 histogramHandlerTest.C:68
 histogramHandlerTest.C:69
 histogramHandlerTest.C:70
 histogramHandlerTest.C:71
 histogramHandlerTest.C:72
 histogramHandlerTest.C:73
 histogramHandlerTest.C:74
 histogramHandlerTest.C:75
 histogramHandlerTest.C:76
 histogramHandlerTest.C:77
 histogramHandlerTest.C:78
 histogramHandlerTest.C:79
 histogramHandlerTest.C:80
 histogramHandlerTest.C:81
 histogramHandlerTest.C:82
 histogramHandlerTest.C:83
 histogramHandlerTest.C:84
 histogramHandlerTest.C:85
 histogramHandlerTest.C:86
 histogramHandlerTest.C:87
 histogramHandlerTest.C:88
 histogramHandlerTest.C:89
 histogramHandlerTest.C:90
 histogramHandlerTest.C:91
 histogramHandlerTest.C:92
 histogramHandlerTest.C:93
 histogramHandlerTest.C:94
 histogramHandlerTest.C:95
 histogramHandlerTest.C:96
 histogramHandlerTest.C:97
 histogramHandlerTest.C:98
 histogramHandlerTest.C:99
 histogramHandlerTest.C:100
 histogramHandlerTest.C:101
 histogramHandlerTest.C:102
 histogramHandlerTest.C:103
 histogramHandlerTest.C:104
 histogramHandlerTest.C:105
 histogramHandlerTest.C:106
 histogramHandlerTest.C:107
 histogramHandlerTest.C:108
 histogramHandlerTest.C:109
 histogramHandlerTest.C:110
 histogramHandlerTest.C:111
 histogramHandlerTest.C:112
 histogramHandlerTest.C:113
 histogramHandlerTest.C:114
 histogramHandlerTest.C:115
 histogramHandlerTest.C:116
 histogramHandlerTest.C:117
 histogramHandlerTest.C:118
 histogramHandlerTest.C:119
 histogramHandlerTest.C:120
 histogramHandlerTest.C:121
 histogramHandlerTest.C:122
 histogramHandlerTest.C:123
 histogramHandlerTest.C:124
 histogramHandlerTest.C:125
 histogramHandlerTest.C:126
 histogramHandlerTest.C:127
 histogramHandlerTest.C:128
 histogramHandlerTest.C:129
 histogramHandlerTest.C:130
 histogramHandlerTest.C:131
 histogramHandlerTest.C:132
 histogramHandlerTest.C:133
 histogramHandlerTest.C:134
 histogramHandlerTest.C:135
 histogramHandlerTest.C:136
 histogramHandlerTest.C:137
 histogramHandlerTest.C:138
 histogramHandlerTest.C:139
 histogramHandlerTest.C:140
 histogramHandlerTest.C:141
 histogramHandlerTest.C:142
 histogramHandlerTest.C:143
 histogramHandlerTest.C:144
 histogramHandlerTest.C:145
 histogramHandlerTest.C:146
 histogramHandlerTest.C:147
 histogramHandlerTest.C:148