ROOT logo
//

Int_t FindKrClusterCheck(const char *fileName="data.root");


Int_t FindKrClustersRaw(const char *fileName="data.root"){

  

  //
  // remove Altro warnings
  //
  AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
  AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
  AliLog::SetModuleDebugLevel("RAW",-5);
  //
  // Get calibration
  //
  char *ocdbpath = gSystem->Getenv("OCDB_PATH");
  //char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";
  if (ocdbpath==0){
    ocdbpath="alien://folder=/alice/data/2007/LHC07w/OCDB/";
  }
  printf("OCDB PATH = %s\n",ocdbpath); 
  AliCDBManager * man = AliCDBManager::Instance();
  man->SetDefaultStorage(ocdbpath);
  man->SetRun(100000000);

  AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
  AliTPCAltroMapping** mapping =AliTPCcalibDB::Instance()->GetMapping();
  //
  //


  //define tree
  TFile *hfile=new TFile("adc.root","RECREATE","ADC file");
  // Create a ROOT Tree
  TTree *mytree = new TTree("Kr","Krypton cluster tree");


  Int_t debugLevel=1;
  if(debugLevel>0){
    TH1F *histoRow   =new TH1F("histoRow","rows",100,0.,100.);
    TH1F *histoPad   =new TH1F("histoPad","pads",150,0.,150.);
    TH1F *histoTime  =new TH1F("histoTime","timebins",100,0.,1000.);
    TH2F *histoRowPad=new TH2F("histoRowPad","pads-vs-rows" ,150,0.,150.,100,0.,100.);
  }


  //one general output
  AliTPCclustererKr *clusters = new AliTPCclustererKr();
  clusters->SetOutput(mytree);
  clusters->SetRecoParam(0);

  if(debugLevel>0){
    clusters->SetDebugLevel(debugLevel);
    clusters->SetHistoRow(histoRow   );
    clusters->SetHistoPad(histoPad   );
    clusters->SetHistoTime(histoTime  );
    clusters->SetHistoRowPad(histoRowPad);
  }


  AliTPCParamSR *param=new AliTPCParamSR();
  //only for geometry parameters loading - temporarly
//  AliRunLoader* rl = AliRunLoader::Open("galice.root");
//  AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
  //if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}

  clusters->SetParam(param);

  //set cluster finder parameters (from data)
  clusters->SetZeroSup(param->GetZeroSup());//zero suppression parameter
  clusters->SetFirstBin(60);//first bin
  clusters->SetLastBin(950);//last bin
  clusters->SetMaxNoiseAbs(2);//maximal noise
  clusters->SetMaxNoiseSigma(3);//maximal amount of sigma of noise

  //set cluster finder parameters (from MC)
  clusters->SetMinAdc(3);//signal threshold (everything below is treated as 0)
  clusters->SetMinTimeBins(2);//number of neighbouring timebins
  clusters->SetMaxPadRangeCm(5.);//distance of the cluster center to the center of a pad (in cm)
  clusters->SetMaxRowRangeCm(5.);//distance of the cluster center to the center of a padrow (in cm)
  clusters->SetMaxTimeRange(5.);//distance of the cluster center to the max time bin on a pad (in tackts)
  //ie. fabs(centerT - time)<7
  clusters->SetValueToSize(7.);//cut reduce peak at 0
  clusters->SetIsolCut(3);//set isolation cut threshold

  AliRawReader *reader = new AliRawReaderRoot(fileName);
  reader->Reset();

  TStopwatch timer;
  timer.Start();

  AliAltroRawStreamFast* stream = new AliAltroRawStreamFast(reader);
  stream->SelectRawData("TPC");

  Int_t evtnr=0;
  while (reader->NextEvent()) {
    //output for each event

    //if(evtnr>4) break;
    cout<<"Evt = "<<evtnr<<endl;
    clusters->FinderIO(reader);
    evtnr++;
    AliSysInfo::AddStamp(Form("Event%d",evtnr),evtnr);
  }


  mytree->Print();//print rootuple summary 
  // Save all objects in this file
  hfile->Write();
  // Close the file
  hfile->Close();

  timer.Stop();
  timer.Print();
  printf("Deleting clusterer\n");
  delete clusters;
  printf("Deleting stream\n");
  delete stream;
  printf("Deleting raw reader\n");
  delete reader;

//   TCanvas *c2=new TCanvas("c2","title",800,800);
//   c2->SetHighLightColor(2);
//   c2->Range(-458.9552,-2948.238,3296.642,26856.6);
//   c2->SetBorderSize(2);
//   c2->SetLeftMargin(0.15);
//   c2->SetRightMargin(0.06);
//   c2->SetFrameFillColor(0);

//   gStyle->SetOptStat(111111);
//   histoRow->Draw();
//   c2->Print("rows.ps");
//   histoPad->Draw();
//   c2->Print("pads.ps");
//   histoTime->Draw();
//   c2->Print("timebins.ps");
//   histoRowPad->Draw();
//   c2->Print("row-pad.ps");

  return 0;
}


Int_t FindKrClusterCheck(const char *fileName){
  //
  //
  gSystem->Load("$ROOTSYS/lib/libGui.so");
  gSystem->Load("$ROOTSYS/lib/libTree.so");
  gSystem->Load("$MEMSTAT/libMemStat.so");
  {
    TMemStat memstat(1000000,100000,kTRUE);
    AliSysInfo::AddCallBack(TMemStatManager::GetInstance()->fStampCallBack);
    FindKrClustersRaw(fileName); 
  }
  // the output memstat.root file
  TMemStat draw("memstat.root");
  // Print some information
  // code info
  draw.MakeReport(0,0);

}
 FindKrClustersRaw.C:1
 FindKrClustersRaw.C:2
 FindKrClustersRaw.C:3
 FindKrClustersRaw.C:4
 FindKrClustersRaw.C:5
 FindKrClustersRaw.C:6
 FindKrClustersRaw.C:7
 FindKrClustersRaw.C:8
 FindKrClustersRaw.C:9
 FindKrClustersRaw.C:10
 FindKrClustersRaw.C:11
 FindKrClustersRaw.C:12
 FindKrClustersRaw.C:13
 FindKrClustersRaw.C:14
 FindKrClustersRaw.C:15
 FindKrClustersRaw.C:16
 FindKrClustersRaw.C:17
 FindKrClustersRaw.C:18
 FindKrClustersRaw.C:19
 FindKrClustersRaw.C:20
 FindKrClustersRaw.C:21
 FindKrClustersRaw.C:22
 FindKrClustersRaw.C:23
 FindKrClustersRaw.C:24
 FindKrClustersRaw.C:25
 FindKrClustersRaw.C:26
 FindKrClustersRaw.C:27
 FindKrClustersRaw.C:28
 FindKrClustersRaw.C:29
 FindKrClustersRaw.C:30
 FindKrClustersRaw.C:31
 FindKrClustersRaw.C:32
 FindKrClustersRaw.C:33
 FindKrClustersRaw.C:34
 FindKrClustersRaw.C:35
 FindKrClustersRaw.C:36
 FindKrClustersRaw.C:37
 FindKrClustersRaw.C:38
 FindKrClustersRaw.C:39
 FindKrClustersRaw.C:40
 FindKrClustersRaw.C:41
 FindKrClustersRaw.C:42
 FindKrClustersRaw.C:43
 FindKrClustersRaw.C:44
 FindKrClustersRaw.C:45
 FindKrClustersRaw.C:46
 FindKrClustersRaw.C:47
 FindKrClustersRaw.C:48
 FindKrClustersRaw.C:49
 FindKrClustersRaw.C:50
 FindKrClustersRaw.C:51
 FindKrClustersRaw.C:52
 FindKrClustersRaw.C:53
 FindKrClustersRaw.C:54
 FindKrClustersRaw.C:55
 FindKrClustersRaw.C:56
 FindKrClustersRaw.C:57
 FindKrClustersRaw.C:58
 FindKrClustersRaw.C:59
 FindKrClustersRaw.C:60
 FindKrClustersRaw.C:61
 FindKrClustersRaw.C:62
 FindKrClustersRaw.C:63
 FindKrClustersRaw.C:64
 FindKrClustersRaw.C:65
 FindKrClustersRaw.C:66
 FindKrClustersRaw.C:67
 FindKrClustersRaw.C:68
 FindKrClustersRaw.C:69
 FindKrClustersRaw.C:70
 FindKrClustersRaw.C:71
 FindKrClustersRaw.C:72
 FindKrClustersRaw.C:73
 FindKrClustersRaw.C:74
 FindKrClustersRaw.C:75
 FindKrClustersRaw.C:76
 FindKrClustersRaw.C:77
 FindKrClustersRaw.C:78
 FindKrClustersRaw.C:79
 FindKrClustersRaw.C:80
 FindKrClustersRaw.C:81
 FindKrClustersRaw.C:82
 FindKrClustersRaw.C:83
 FindKrClustersRaw.C:84
 FindKrClustersRaw.C:85
 FindKrClustersRaw.C:86
 FindKrClustersRaw.C:87
 FindKrClustersRaw.C:88
 FindKrClustersRaw.C:89
 FindKrClustersRaw.C:90
 FindKrClustersRaw.C:91
 FindKrClustersRaw.C:92
 FindKrClustersRaw.C:93
 FindKrClustersRaw.C:94
 FindKrClustersRaw.C:95
 FindKrClustersRaw.C:96
 FindKrClustersRaw.C:97
 FindKrClustersRaw.C:98
 FindKrClustersRaw.C:99
 FindKrClustersRaw.C:100
 FindKrClustersRaw.C:101
 FindKrClustersRaw.C:102
 FindKrClustersRaw.C:103
 FindKrClustersRaw.C:104
 FindKrClustersRaw.C:105
 FindKrClustersRaw.C:106
 FindKrClustersRaw.C:107
 FindKrClustersRaw.C:108
 FindKrClustersRaw.C:109
 FindKrClustersRaw.C:110
 FindKrClustersRaw.C:111
 FindKrClustersRaw.C:112
 FindKrClustersRaw.C:113
 FindKrClustersRaw.C:114
 FindKrClustersRaw.C:115
 FindKrClustersRaw.C:116
 FindKrClustersRaw.C:117
 FindKrClustersRaw.C:118
 FindKrClustersRaw.C:119
 FindKrClustersRaw.C:120
 FindKrClustersRaw.C:121
 FindKrClustersRaw.C:122
 FindKrClustersRaw.C:123
 FindKrClustersRaw.C:124
 FindKrClustersRaw.C:125
 FindKrClustersRaw.C:126
 FindKrClustersRaw.C:127
 FindKrClustersRaw.C:128
 FindKrClustersRaw.C:129
 FindKrClustersRaw.C:130
 FindKrClustersRaw.C:131
 FindKrClustersRaw.C:132
 FindKrClustersRaw.C:133
 FindKrClustersRaw.C:134
 FindKrClustersRaw.C:135
 FindKrClustersRaw.C:136
 FindKrClustersRaw.C:137
 FindKrClustersRaw.C:138
 FindKrClustersRaw.C:139
 FindKrClustersRaw.C:140
 FindKrClustersRaw.C:141
 FindKrClustersRaw.C:142
 FindKrClustersRaw.C:143
 FindKrClustersRaw.C:144
 FindKrClustersRaw.C:145
 FindKrClustersRaw.C:146
 FindKrClustersRaw.C:147
 FindKrClustersRaw.C:148
 FindKrClustersRaw.C:149
 FindKrClustersRaw.C:150
 FindKrClustersRaw.C:151
 FindKrClustersRaw.C:152
 FindKrClustersRaw.C:153
 FindKrClustersRaw.C:154
 FindKrClustersRaw.C:155
 FindKrClustersRaw.C:156
 FindKrClustersRaw.C:157
 FindKrClustersRaw.C:158
 FindKrClustersRaw.C:159
 FindKrClustersRaw.C:160
 FindKrClustersRaw.C:161
 FindKrClustersRaw.C:162
 FindKrClustersRaw.C:163
 FindKrClustersRaw.C:164
 FindKrClustersRaw.C:165