Example #1
0
void rec() {
	//  AliLog::SetGlobalDebugLevel(10);
	AliCDBManager * man = AliCDBManager::Instance();
	man->SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-10-Release/Residual/");
	man->SetSpecificStorage("EMCAL/*","local://DB");
	
	AliReconstruction reco;
	AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
	AliTracker::SetFieldMap(field,kTRUE);
	reco.SetUniformFieldTracking(kFALSE);
	reco.SetWriteESDfriend();
	reco.SetWriteAlignmentData();
  
	AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetLowFluxParam();
	AliTPCReconstructor::SetRecoParam(tpcRecoParam);
	AliTPCReconstructor::SetStreamLevel(0);
	reco.SetRunReconstruction("ITS TPC TRD TOF HMPID PHOS EMCAL MUON T0 VZERO FMD PMD ZDC");
	//reco.SetInput("raw.root") ;
	//AliPHOSRecoParam* recEmc = new AliPHOSRecoParamEmc();
//	recEmc->SetSubtractPedestals(kFALSE);
//	AliPHOSReconstructor::SetRecoParamEmc(recEmc);  
	reco.SetRunQA(kFALSE) ; 

	TStopwatch timer;
	timer.Start();
	reco.Run();
	timer.Stop();
	timer.Print();
}
Example #2
0
void runReconstruction(int seed, const char* input, const char* recoptions, bool rawocdb)
{ 
  AliCDBManager* man = AliCDBManager::Instance();
  
  if ( rawocdb ) 
  {
    cout << "**** WILL USE RAW OCDB" << endl;
    man->SetDefaultStorage("raw://"); //alien://folder=/alice/data/2011/OCDB?cacheFold=/Users/laurent/OCDBcache");
    man->SetSpecificStorage("ITS/Calib/RecoParam","alien://folder=/alice/cern.ch/user/p/ppillot/OCDB_PbPbSim");
  } 
  else
  {
    man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");

    man->SetSpecificStorage("GRP/GRP/Data",
                            Form("local://%s",gSystem->pwd()));

  }
  
  gRandom->SetSeed(seed);
  
  AliReconstruction* MuonRec = new AliReconstruction("galice.root");
  MuonRec->SetInput(gSystem->ExpandPathName(input));
  MuonRec->SetRunReconstruction("MUON ITS");
  MuonRec->SetFillESD("HLT");
  MuonRec->SetOption("HLT", "libAliHLTMUON.so");
  MuonRec->SetNumberOfEventsPerFile(10000);
  MuonRec->SetOption("MUON",recoptions);
  MuonRec->SetRunQA("MUON:ALL");
  MuonRec->SetQAWriteExpert(AliQAv1::kMUON);
  MuonRec->SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
  MuonRec->SetWriteESDfriend(kFALSE);
  MuonRec->SetCleanESD(kFALSE);  
  MuonRec->SetStopOnError(kFALSE);
  
  // uncomment the following lines if you want to set custom RecoParam
  // instead of getting them from the OCDB
  //  AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLowFluxParam();
  //  muonRecoParam->SaveFullClusterInESD(kTRUE,100.);
  //  MuonRec->SetRecoParam("MUON",muonRecoParam);
  
  MuonRec->Run();
  
  delete MuonRec;
  
  //gObjectTable->Print();
}
Example #3
0
AliTOFTriggerMask *
ReadCDBEntryTriggerMask(Int_t run, const Char_t *defaultStorage = "raw://", const Char_t *specificStorage = NULL)
{
  AliCDBManager *cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage(defaultStorage);
  if (specificStorage)
    cdb->SetSpecificStorage("TRIGGER/TOF/TriggerMask", specificStorage);
  cdb->SetRun(run);
  AliCDBEntry *cdbe = cdb->Get("TRIGGER/TOF/TriggerMask");
  AliTOFTriggerMask *triggerMaskObj = (AliTOFTriggerMask *)cdbe->GetObject();

  return triggerMaskObj;
}
Example #4
0
void makeSDigit(Int_t run=117048,
                const char *fname="/alice/data/2010/LHC10b/000117048/raw/10000117048041.30.root")
{
  AliSimulation sim;
  //AliLog::SetGlobalDebugLevel(1);
  AliLog::SetModuleDebugLevel("STEER",1);
  AliCDBManager *cdbm = AliCDBManager::Instance();
  cdbm->SetRun(run);
  cdbm->SetDefaultStorage("local://$ALIROOT_OCDB_ROOT/OCDB");     
  //cdbm->SetDefaultStorage("raw://");     
  cdbm->SetSpecificStorage("GRP/GRP/Data",Form("local://%s","$ALICE_ROOT/test/rawmerge"));  
  sim.SetMakeSDigits("ITS TPC");
  sim.SetNumberOfEvents(10000);
  sim.ConvertRaw2SDigits(fname);
  return;
}
Example #5
0
File: sim.C Project: ktf/AliRoot
void sim(Int_t embrun) 
{
  AliSimulation sim;
  if (embrun == 4) {
    AliCDBManager *cdbm = AliCDBManager::Instance();
    cdbm->SetRun(atoi(gSystem->Getenv("DC_RUN")));
    cdbm->SetDefaultStorage("local://$ALICE_ROOT/OCDB");     
    cdbm->SetSpecificStorage("GRP/GRP/Data",Form("local://%s",gSystem->pwd()));
    sim.SetMakeSDigits("ITS TPC TRD TOF VZERO");  

    sim.ConvertRaw2SDigits("raw.root","AliESDs.root");
    return;
  }
  
  if (embrun == 2) {
    sim.SetRunGeneration(kFALSE);
    sim.SetMakeSDigits("");
    sim.SetMakeDigitsFromHits("");
  }
  else {
    sim.SetRunGeneration(kTRUE);
    sim.SetMakeSDigits("ITS TPC TRD TOF VZERO");
  }
  sim.SetRunSimulation(kTRUE);
  sim.SetMakeDigits("ITS TPC TRD TOF VZERO");
  sim.SetWriteRawData("ITS TPC TRD TOF VZERO","raw.root",kTRUE);
  if (embrun == 1)
    sim.MergeWith("../BackgroundSDigits/galice.root",1);

  sim.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  sim.SetSpecificStorage("GRP/GRP/Data",
			       Form("local://%s",gSystem->pwd()));
  sim.SetRunQA(":") ; 
  AliQA::SetQARefStorage("local://$ALICE_ROOT/OCDB") ;
  
  for (Int_t det = 0 ; det < AliQA::kNDET ; det++) {
    sim.SetQACycles(det, 1) ;
  }

//   sim.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Full/");
//   sim.SetRunHLT("");
//   sim.SetQA(kFALSE);

  sim.Run(1);
}
Example #6
0
void recqa()
{
	const char * kYear = "08" ; 
 	gEnv->SetValue("Root.Stacktrace","no");
	gEnv->SetValue("Root.Stacktrace","no");
	AliCDBManager * man = AliCDBManager::Instance();
	//man->SetDefaultStorage("alien://Folder=/alice/data/2008/LHC08d/OCDB/") ; 
	man->SetDefaultStorage("local://$ALIROOT_OCDB_ROOT/OCDB");
  man.SetSpecificStorage("GRP/GRP/Data",Form("local://%s",gSystem->pwd()));
	TString detectors("ITS TPC TRD TOF PHOS HMPID EMCAL/*MUON*/ FMD ZDC PMD T0 VZERO");
	
	//AliQA::SetQARefStorage(Form("%s%s/", AliQA::GetQARefDefaultStorage(), kYear)) ;
	AliQA::SetQARefStorage("local://$ALIROOT_OCDB_ROOT/OCDB") ;
	//AliQA::SetQARefDataDirName(AliQA::kMONTECARLO) ; //RUN_TYPE
   
  AliQADataMamanager qas("rec") ; 
  qas.Run(detectors.Data(), AliQA::kRECPOINTS);
}
Example #7
0
void recTracking(Int_t type, const char *filename="data.root")
{
  /// Set path to calibration data

  AliCDBManager * man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  man->SetRun(0);
  man->SetSpecificStorage("TPC/*/*","local:///afs/cern.ch/user/m/mivanov/public/Calib");
  //
  // Set reconstruction parameters
  //
  AliLog::SetClassDebugLevel("AliTPCclusterer",2);

  AliTPCRecoParam * tpcRecoParam = 0;
  if (type==0)  tpcRecoParam = AliTPCRecoParam::GetCosmicTestParam(kTRUE);
  if (type>0)  tpcRecoParam = AliTPCRecoParam::GetLaserTestParam(kTRUE);

  AliTPCReconstructor::SetRecoParam(tpcRecoParam);
  AliTPCReconstructor::SetStreamLevel(1);

  //
  //
  //
  AliReconstruction rec;
  rec.SetSpecificStorage("TPC/*/*","local:///afs/cern.ch/user/m/mivanov/public/Calib");
  rec.SetLoadAlignData("");
  rec.SetWriteESDfriend(kTRUE);
  rec.SetInput(filename);
  rec.SetEquipmentIdMap("EquipmentIdMap.data");
  //rec.SetRunReconstruction("TPC");
  rec.SetOption("TPC","PedestalSubtraction");
  rec.SetRunLocalReconstruction("");
  rec.SetRunTracking("TPC");
  rec.SetFillESD("TPC");
  rec.SetFillTriggerESD(kFALSE);
  rec.SetRunVertexFinder(kFALSE);
  rec.SetWriteAlignmentData(kTRUE);
  rec.Run(0);
}
Example #8
0
//void PlotNoiseBaseline(Int_t run, Int_t sm, Int_t det, const char * pathdatabase="local:///d/alice12/bailhache/TestShuttle/database/", const char * pathreferencefile="local:///d/alice12/bailhache/TestShuttle/reference")
//void PlotNoiseBaseline(Int_t run=34529, Int_t sm=0, Int_t det=0, const char * pathdatabase="alien://Folder=/alice/data/2008/LHC08b/OCDB/", const char * pathreferencedatabase="alien://Folder=/alice/data/2008/LHC08b/Reference/")
//void PlotNoiseBaseline(Int_t run=1, Int_t sm=0, Int_t det=0, const char * pathdatabase="local:///d/alice12/bailhache/AliAnalysisTask/v4-13-Head/SHUTTLE/TestShuttle/TestCDB/", const char * pathreferencedatabase="local:///d/alice12/bailhache/AliAnalysisTask/v4-13-Head/SHUTTLE/TestShuttle/TestReference/")
void AliTRDplotNoiseBaseline(Int_t run=34529, Int_t sm=0, Int_t det=0, const char * pathdatabase="alien://Folder=/alice/data/2008/LHC08b/OCDB/", const char * pathreferencedatabase="alien://Folder=/alice/data/2008/LHC08b/Reference/")
{

  //TGrid::Connect("alien://",0,0,"t");

  AliCDBManager *CDB = AliCDBManager::Instance();
  CDB->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); 
  CDB->SetSpecificStorage("TRD/Calib/PadNoise",pathdatabase);
  CDB->SetSpecificStorage("TRD/Calib/DetNoise",pathdatabase);
  CDB->SetSpecificStorage("TRD/Calib/PadStatus",pathdatabase);
  CDB->SetRun(run);

  AliTRDcalibDB *cal = AliTRDcalibDB::Instance();

  //const AliTRDCalDet *u = cal->GetNoiseDet();

  AliTRDCalDet *u = new AliTRDCalDet("u","u");
  for(Int_t k = 0; k < 540; k++){
    u->SetValue(k,10.0);
  }

  //Style
  //************************
  gStyle->SetPalette(1);
  gStyle->SetOptStat(1111);
  gStyle->SetPadBorderMode(0);
  gStyle->SetCanvasColor(10);
  gStyle->SetPadLeftMargin(0.13);
  gStyle->SetPadRightMargin(0.13);

  //Build the Cal Pad
  //********************************
  Int_t smi = sm*30;
  AliTRDCalPad *ki = new AliTRDCalPad("testnoise","testnoise");
  for(Int_t k = 0; k < 540; k++){
    ki->SetCalROC(k,(AliTRDCalROC *) cal->GetNoiseROC(k));   
  }

  // padstatus 2D
  Int_t smn = (Int_t) det/30;
  if((smn==0) || (smn==1) || (smn==2) || (smn==9) || (smn==10) || (smn==11)) smn = 1;
  if((smn==3) || (smn==4) || (smn==5) || (smn==12) || (smn==13) || (smn==14)) smn = 2;
  if((smn==6) || (smn==7) || (smn==8) || (smn==15) || (smn==16) || (smn==17)) smn = 3;
  TString name("TRD/DAQData/PadStatus");
  name += smn;
  //name += 3;
  AliCDBEntry *entrypadstatus = AliCDBManager::Instance()->Get("TRD/Calib/PadStatus",run);
  if(!entrypadstatus) return;
  AliTRDCalPadStatus *lo = (AliTRDCalPadStatus *)entrypadstatus->GetObject();
  AliCDBEntry *entryo = AliCDBManager::Instance()->GetStorage(pathreferencedatabase)->Get(name, run);
  if(!entryo) return;
  AliTRDCalibPadStatus *calpad = (AliTRDCalibPadStatus *) entryo->GetObject();
  if(!calpad) return;
 

  // Plot
  //***********
 
  
  // noise 2D
  TCanvas *cnoise = new TCanvas((const char*)"noise1",(const char*)"noise1",50,50,600,800);
  cnoise->Divide(3,2);
  cnoise->cd(1);
  ((TH2F *)ki->MakeHisto2DSmPl(sm,0,u,0,0.0,3.5,-1))->Draw("colz");
  cnoise->cd(2);
  ((TH2F *)ki->MakeHisto2DSmPl(sm,1,u,0,0.0,3.5,-1))->Draw("colz");
  cnoise->cd(3);
  ((TH2F *)ki->MakeHisto2DSmPl(sm,2,u,0,0.0,3.5,-1))->Draw("colz");
  cnoise->cd(4);
  ((TH2F *)ki->MakeHisto2DSmPl(sm,3,u,0,0.0,3.5,-1))->Draw("colz");
  cnoise->cd(5);
  ((TH2F *)ki->MakeHisto2DSmPl(sm,4,u,0,0.0,3.5,-1))->Draw("colz");
  cnoise->cd(6);
  ((TH2F *)ki->MakeHisto2DSmPl(sm,5,u,0,0.0,3.5,-1))->Draw("colz");
  

  // Pad Status 
  TCanvas *cpadstatus = new TCanvas((const char*)"padstatus",(const char*)"padstatus",50,50,600,800);
  cpadstatus->Divide(3,2);
  cpadstatus->cd(1);
  ((TH2F *)lo->MakeHisto2DSmPl(sm,0))->Draw("colz");
  cpadstatus->cd(2);
  ((TH2F *)lo->MakeHisto2DSmPl(sm,1))->Draw("colz");
  cpadstatus->cd(3);
  ((TH2F *)lo->MakeHisto2DSmPl(sm,2))->Draw("colz");
  cpadstatus->cd(4);
  ((TH2F *)lo->MakeHisto2DSmPl(sm,3))->Draw("colz");
  cpadstatus->cd(5);
  ((TH2F *)lo->MakeHisto2DSmPl(sm,4))->Draw("colz");
  cpadstatus->cd(6);
  ((TH2F *)lo->MakeHisto2DSmPl(sm,5))->Draw("colz");

    
 
  // reference data 

  TCanvas *cpoui = new TCanvas((const char*)"cpoui",(const char*)"cpoui",50,50,600,800);
  cpoui->cd();
  ((TH2F *)calpad->GetHisto(det))->Draw("lego");


  AliTRDCalROC *ouip = calpad->GetCalRocMean(det);
  TCanvas *cpouilo = new TCanvas((const char*)"cpouilo",(const char*)"cpouilo",50,50,600,800);
  cpouilo->Divide(2,1);
  cpouilo->cd(1);
  ((TH1F *)ouip->MakeHisto1D(8.5,10.5,-1,10.0))->Draw();
  //((TH1F *)ouip->MakeHisto1D(0.85,1.05,-1))->Draw();
  cpouilo->cd(2);
  ((TH2F *)ouip->MakeHisto2D(8.5,10.5,-1,10.0))->Draw("colz");
  //((TH2F *)ouip->MakeHisto2D(0.85,1.05,-1))->Draw("colz");

  AliTRDCalROC *ouiphy = calpad->GetCalRocRMS(det);
  TCanvas *cpouiloh = new TCanvas((const char*)"cpouiloh",(const char*)"cpouiloh",50,50,600,800);
  cpouiloh->Divide(2,1);
  cpouiloh->cd(1);
  ((TH1F *)ouiphy->MakeHisto1D(0.1,4.5,-1,10.0))->Draw();
  //((TH1F *)ouiphy->MakeHisto1D(0.01,0.45,-1))->Draw();
  cpouiloh->cd(2);
  ((TH2F *)ouiphy->MakeHisto2D(0.1,4.5,-1,10.0))->Draw("colz");
  //((TH2F *)ouiphy->MakeHisto2D(0.01,0.45,-1))->Draw("colz");
  
    

 
}
Example #9
0
// ---------------------------------------------------------------------------- 
void HLTT0Test(const Char_t *filename, const Char_t *cdbURI,
		  Int_t minEvent=-1, Int_t maxEvent=-1) {
  
  printf (" ============================================= \n\n");
  printf ("        TEST T0 RECONSTRUCTION              \n\n");
  printf (" ============================================= \n");

  if(!gSystem->AccessPathName("galice.root")){
    cerr << "AliReconstruction on raw data requires to delete galice.root, ";
    cerr << "or run at different place." << endl;
    cerr << "!!! DO NOT DELETE the galice.root of your simulation, ";
    cerr << "but create a subfolder !!!!" << endl;
    return;
  }
    TGrid::Connect("alien");

  if (gSystem->AccessPathName(filename)) {
    cerr << "can not find file " << filename << endl;
    return;
  }

  // -- connect to the GRID if we use a file or OCDB from the GRID
  TString struri=cdbURI;
  TString strfile=filename;
  if (struri.BeginsWith("raw://") ||
      strfile.Contains("://") && !strfile.Contains("local://")) {
    TGrid::Connect("alien");
  }

  // -- Set the CDB storage location
  AliCDBManager * man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbURI);
  if (struri.BeginsWith("local://")) {
    // set specific storage for GRP entry
    // search in the working directory and one level above, the latter
    // follows the standard simulation setup like e.g. in test/ppbench
    if (!gSystem->AccessPathName("GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
    } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");      
    } else {
      cerr << "can not find a GRP entry, please run the macro in the folder" << endl;
      cerr << "of a simulated data sample, or specify a GRID OCDB" << endl;
      HLTT0Test();      
      return;
    }
  }

  //////////////////////////////////////////////////////////////////////////////////////
  //
  // Reconstruction settings
  AliReconstruction rec;

  if (minEvent>=0 || maxEvent>minEvent) {
    if (minEvent<0) minEvent=0;
    if (maxEvent<minEvent) maxEvent=minEvent;
    rec.SetEventRange(minEvent,maxEvent);
  }

  rec.SetRunReconstruction("HLT");
  rec.SetLoadAlignFromCDB(kFALSE);
  rec.SetWriteESDfriend(kFALSE);

  // due to bug ...
  // StopOnError needs to be disabled
  rec.SetStopOnError(kFALSE);
  rec.SetRunVertexFinder(kFALSE);
  rec.SetInput(filename);

  // QA options
  rec.SetRunQA(":") ;
  //rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;

  //////////////////////////////////////////////////////////////////////////////////////
  //
  // setup the HLT system
  AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
  /*
  // define a data publisher configuration for T0 raw data
  AliHLTConfiguration publisher("RAW-Publisher", 
				"AliRawReaderPublisher", 
				"", 
				"-equipmentid 3584 "
				"-datatype 'DDL_RAW ' 'VZRO' "
				"-dataspec 0x01"
				);

  // define configuration of the T0Reconstruction component
  AliHLTConfiguration vzeroReco("T0-Reconstruction", 
				"T0Reconstruction", 
				"RAW-Publisher",
				""
				);

  // define configuration of the GlobalEsdConverter component
  AliHLTConfiguration esdConverter("GLOBAL-ESD-Converter",
				   "GlobalEsdConverter", 
				   "T0-Reconstruction",
				   ""
				   );

  // define configuration for Root file writer of T0 output
  AliHLTConfiguration rootWriter("RootWriter", 
				 "ROOTFileWriter",
				 "T0-Reconstruction GLOBAL-ESD-Converter",
				 "-directory analysis -datafile vzeroRec"
				 );

  */

  // set option for the HLT module in AliReconstruction
  // arguments
  //  - ignore-hltout : ignore the HLTOUT payload from the HLT DDLs
  //  - libraries to be used as plugins
  //  - loglevel=0x7c : Important, Info, Warning, Error, Fatal
  rec.SetOption("HLT",
		"ignore-hltout " 
		"libAliHLTUtil.so libAliHLTGlobal.so libAliHLTITS.so libAliHLTT0.so "
		"loglevel=0x7c "
		"chains=T0-RECO"//"GLOBAL-ESD-Converter,RootWriter"
		);

  rec.SetRunPlaneEff(kFALSE);

  // switch off cleanESD
  rec.SetCleanESD(kFALSE);

  AliLog::Flush();
  rec.Run();
}
Example #10
0
void trackhisto(const char *filename, const char *cdbURI, int minEvent=-1, int maxEvent=-1, Bool_t bTracklets=kFALSE){

  if(!gSystem->AccessPathName("galice.root")){
    cerr << "Remove galice.root or run in a different folder." << endl;
    return;
  }

  if (!filename) {
    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();
 
  int iMinSlice =  0;
  int iMaxSlice = 35;
  int iMinPart  =  0;
  int iMaxPart  =  5;
  
  TString tracklets;
  
  for(int slice=iMinSlice; slice<=iMaxSlice; slice++){
      
      TString trackerInput;      
      for(int part=iMinPart; part<=iMaxPart; part++){
          
	  TString arg, publisher, cf;
          
          // raw data 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 -verbose", ddlno, slice, slice, part, part);
          publisher.Form("DP_%02d_%d", slice, part);
          AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());

          // cluster finder components
          cf.Form("CF_%02d_%d", slice, part);
          AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinder32Bit", publisher.Data(), "");
     
          if (trackerInput.Length()>0) trackerInput+=" ";
          trackerInput+=cf;     
    }
    
    TString tracker, converted_tracklet;
    // tracker components
    tracker.Form("TR_%02d", slice);
    converted_tracklet.Form("CONVTR_%02d", slice);
    AliHLTConfiguration trackerconf(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
    AliHLTConfiguration convertedconf(converted_tracklet.Data(), "TPCCATrackerOutputConverter", tracker.Data(), "");    
       
    if (tracklets.Length()>0) tracklets+=" ";
    tracklets+=converted_tracklet;
  }
   
  TString histoInput;
   
  if(bTracklets==kTRUE){
     if(histoInput.Length()>0) 
     histoInput+=" ";
     histoInput+=tracklets;
     
     AliHLTConfiguration tracklethiconf("tracklethi", "TPCTrackHisto", histoInput.Data(), "");
     AliHLTConfiguration trackletrwfconf("trackletrfw", "ROOTFileWriter", "tracklethi", "-datafile TrackletHisto -concatenate-events -overwrite");
  }
  else {
     if(histoInput.Length()>0) 
     histoInput+=" ";
     histoInput+="TPC-clusters";
     histoInput+=" ";
     histoInput+="TPC-globalmerger";
  
     AliHLTConfiguration trhiconf("trhi", "TPCTrackHisto", histoInput.Data(), "");
     AliHLTConfiguration rwfconf("rfw", "ROOTFileWriter", "trhi", "-datafile TrackHisto -concatenate-events -overwrite");
  }


  AliReconstruction rec;

  rec.SetRunQA(":");
  rec.SetInput(filename);
  
  // connect to the GRID if we use a file or OCDB from the GRID
  TString struri  = cdbURI;
  TString strfile = filename;
  if(struri.BeginsWith("raw://") ||  strfile.Contains("://") && !strfile.Contains("local://")){
     TGrid::Connect("alien");
  }
  
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbURI);

  if(struri.BeginsWith("local://")) {
     // set specific storage for GRP entry
     // search in the working directory and one level above, the latter
     // follows the standard simulation setup like e.g. in test/ppbench
     if(!gSystem->AccessPathName("GRP/GRP/Data")) {
       man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
     } 
     else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
          man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");
     }
  }

  if(minEvent>=0 || maxEvent>minEvent){
     if(minEvent<0) minEvent=0;
     if(maxEvent<minEvent) maxEvent=minEvent;
     rec.SetEventRange(minEvent,maxEvent);
  }
 
  rec.SetRunVertexFinder(kFALSE);
  rec.SetRunReconstruction("HLT"); 
 
  if(bTracklets==kTRUE){
     rec.SetOption("HLT", "loglevel=0x7c chains=trackletrfw");
  }
  else {
     rec.SetOption("HLT", "loglevel=0x7c chains=rfw");
  }

  rec.Run();

}
Example #11
0
/**
 * @file sampleRawAnalysis.C
 * @brief Example macro to run the AliHLTSampleRawAnalysisComponent in
 * AliReconstruction.
 *
 * The component subscribes to DDL raw data published by the
 * AliHLTRawReaderPublisherComponent. The macros requires a raw data file
 * and a corresponding GRP entry.
 *
 * <pre>
 * Usage: aliroot -b -q -l \
 *     sampleRawAnalysis.C'("rawfile", "cdb", minEvent, maxEvent)'
 *
 * Examples:
 *     sampleRawAnalysis.C'("raw.root", minEvent, MaxEvent)'
 *     sampleRawAnalysis.C'("./", minEvent, MaxEvent)'
 *     sampleRawAnalysis.C'("alien:///alice/data/2010/.../raw/....root")' 
 *
 * Defaults
 *     cdb="local://$ALICE_ROOT/OCDB" -> take local OCDB from distribution
 *     minEvent=-1   -> no lower event selection
 *     maxEvent=-1   -> no upper event selection
 *
 * </pre>
 *
 * The input file can be a local raw.root file but also a file from the
 * GRID. The separate DDL files generated in simulation can be accessed
 * using AliRawReaderFile by speficying "directory/".
 *
 * Since the macro runs AliReconstruction the OCDB needs to be set up, in
 * particular the GRP entry. If testing with a local OCDB you have to
 * simulate some events and run the macro in the folder of the simulation.
 * Also HLT components configure from objects in the OCDB.
 *
 * Note: You need a valid GRID token, if you want to access files directly
 * from the Grid, use 'alien-token-init' of your alien installation.
 *
 * @author [email protected]
 * @ingroup alihlt_tutorial
 */
void sampleRawAnalysis(const char *filename,
		       const char *cdbURI,
		       int minEvent=-1,
		       int maxEvent=-1)
{
  if(!gSystem->AccessPathName("galice.root")){
    cerr << "AliReconstruction on raw data requires to delete galice.root, or run at different place." << endl;
    cerr << "!!! DO NOT DELETE the galice.root of your simulation, but create a subfolder !!!!" << endl;
    return;
  }

  if (gSystem->AccessPathName(filename)) {
    cerr << "can not find file " << filename << endl;
    return;
  }

  // connect to the GRID if we use a file or OCDB from the GRID
  TString struri=cdbURI;
  TString strfile=filename;
  if (struri.BeginsWith("raw://") ||
      strfile.Contains("://") && !strfile.Contains("local://")) {
    TGrid::Connect("alien");
  }

  // Set the CDB storage location
  AliCDBManager * man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbURI);
  if (struri.BeginsWith("local://")) {
    // set specific storage for GRP entry
    // search in the working directory and one level above, the latter
    // follows the standard simulation setup like e.g. in test/ppbench
    if (!gSystem->AccessPathName("GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
    } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");      
    } else {
      cerr << "can not find a GRP entry, please run the macro in the folder" << endl;
      cerr << "of a simulated data sample, or specify a GRID OCDB" << endl;
      sampleRawAnalysis();      
      return;
    }
  }

  //////////////////////////////////////////////////////////////////////////////////////
  //
  // Reconstruction settings
  AliReconstruction rec;

  if (minEvent>=0 || maxEvent>minEvent) {
    if (minEvent<0) minEvent=0;
    if (maxEvent<minEvent) maxEvent=minEvent;
    rec.SetEventRange(minEvent,maxEvent);
  }
  rec.SetRunReconstruction("HLT");
  rec.SetLoadAlignFromCDB(kFALSE);
  rec.SetWriteESDfriend(kFALSE);
  // due to bug ...
  // StopOnError needs to be disabled
  rec.SetStopOnError(kFALSE);
  rec.SetRunVertexFinder(kFALSE);
  rec.SetInput(filename);

  // QA options
  rec.SetRunQA(":") ;
  //rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;

  //////////////////////////////////////////////////////////////////////////////////////
  //
  // setup the HLT system
  AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();

  // define a data publisher configuration
  // arguments:
  //  1) id of the configuartion, later used to refer to this configuration
  //  2) id of the component to run
  //  3) parents, no parents for publisher components
  //  4) optional component arguments
  //              publish link #512, the first link (numbered 0) of SSD
  AliHLTConfiguration publisher("RAW-Publisher", 
				"AliRawReaderPublisher", 
				"", 
				"-minid 512 "
				"-datatype 'DDL_RAW ' 'ISSD' "
				"-dataspec 0x01"
				);

  // define configuration of the SampleRawAnalyis component
  // arguments:
  //  1) id of the configuartion, later used to refer to this configuration
  //  2) id of the component to run
  //  3) parents, here the publisher configuration defined above
  //  4) optional component arguments
  AliHLTConfiguration rawanalysis("RAW-Analysis", 
				  "SampleRawAnalysis", 
				  "RAW-Publisher", 
				  "-mandatory1 test "
				  "-verbose"
				  );

  // set option for the HLT module in AliReconstruction
  // arguments
  //  - ignore-hltout : ignore the HLTOUT payload from the HLT DDLs
  //  - libraries to be used as plugins
  //  - loglevel=0x7c : Important, Info, Warning, Error, Fatal
  //  - chains=RAW-Analysis : chains to be run
  rec.SetOption("HLT",
		"ignore-hltout " 
		"libAliHLTUtil.so libAliHLTSample.so "
		"loglevel=0x7c "
		"chains=RAW-Analysis "
		);

  rec.SetRunPlaneEff(kFALSE);

  // switch off cleanESD
  rec.SetCleanESD(kFALSE);

  AliLog::Flush();
  rec.Run();

}
Example #12
0
void compClusHitsMod2(int nev=-1)
{
  
  const int kSplit=0x1<<22;
  const int kSplCheck=0x1<<23;
  //
  gSystem->Load("libITSUpgradeBase");
  gSystem->Load("libITSUpgradeSim");
  gSystem->Load("libITSUpgradeRec");
  gROOT->SetStyle("Plain");

  AliCDBManager* man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  man->SetSpecificStorage("GRP/GRP/Data",
        Form("local://%s",gSystem->pwd()));
  man->SetSpecificStorage("ITS/Align/Data",
        Form("local://%s",gSystem->pwd()));
  man->SetSpecificStorage("ITS/Calib/RecoParam",
        Form("local://%s",gSystem->pwd()));
  man->SetRun(0);

  TH1F* hL0A = new TH1F("hL0A", "Layer 0, polar angle", 20, 0, TMath::PiOver2());
  hL0A->SetDirectory(0);
  hL0A->GetXaxis()->SetTitle("#alpha");
  TH1F* hL0B = new TH1F("hL0B", "Layer 0, azimuthal angle", 20, 0, TMath::PiOver2());
  hL0B->SetDirectory(0);
  hL0B->GetXaxis()->SetTitle("#beta");

  TH1F* hL1A = new TH1F("hL1A", "Layer 1, polar angle", 20, 0, TMath::PiOver2());
  hL1A->SetDirectory(0);
  hL1A->GetXaxis()->SetTitle("#alpha");
  TH1F* hL1B = new TH1F("hL1B", "Layer 1, azimuthal angle", 20, 0, TMath::PiOver2());
  hL1B->SetDirectory(0);
  hL1B->GetXaxis()->SetTitle("#beta");

  TH1F* hL2A = new TH1F("hL2A", "Layer 2, polar angle", 20, 0, TMath::PiOver2());
  hL2A->SetDirectory(0);
  hL2A->GetXaxis()->SetTitle("#alpha");
  TH1F* hL2B = new TH1F("hL2B", "Layer 2, azimuthal angle", 20, 0, TMath::PiOver2());
  hL2B->SetDirectory(0);
  hL2B->GetXaxis()->SetTitle("#beta");

  TH1F* hL3A = new TH1F("hL3A", "Layer 3, polar angle", 20, 0, TMath::PiOver2());
  hL3A->SetDirectory(0);
  hL3A->GetXaxis()->SetTitle("#alpha");
  TH1F* hL3B = new TH1F("hL3B", "Layer 3, azimuthal angle", 20, 0, TMath::PiOver2());
  hL3B->SetDirectory(0);
  hL3B->GetXaxis()->SetTitle("#beta");

  TH1F* hL4A = new TH1F("hL4A", "Layer 4, polar angle", 20, 0, TMath::PiOver2());
  hL4A->SetDirectory(0);
  hL4A->GetXaxis()->SetTitle("#alpha");
  TH1F* hL4B = new TH1F("hL4B", "Layer 4, azimuthal angle", 20, 0, TMath::PiOver2());
  hL4B->SetDirectory(0);
  hL4B->GetXaxis()->SetTitle("#beta");

  TH1F* hL5A = new TH1F("hL5A", "Layer 5, polar angle", 20, 0, TMath::PiOver2());
  hL5A->SetDirectory(0);
  hL5A->GetXaxis()->SetTitle("#alpha");
  TH1F* hL5B = new TH1F("hL5B", "Layer 5, azimuthal angle", 20, 0, TMath::PiOver2());
  hL5B->SetDirectory(0);
  hL5B->GetXaxis()->SetTitle("#beta");

  TH1F* hL6A = new TH1F("hL6A", "Layer 6, polar angle", 20, 0, TMath::PiOver2());
  hL6A->SetDirectory(0);
  hL6A->GetXaxis()->SetTitle("#alpha");
  TH1F* hL6B = new TH1F("hL6B", "Layer 6, azimuthal angle", 20, 0, TMath::PiOver2());
  hL6B->SetDirectory(0);
  hL6B->GetXaxis()->SetTitle("#beta");

  gAlice=NULL;
  AliRunLoader* runLoader = AliRunLoader::Open("galice.root");
  runLoader->LoadgAlice();

  gAlice = runLoader->GetAliRun();

  runLoader->LoadHeader();
  runLoader->LoadKinematics();
  runLoader->LoadRecPoints();
  runLoader->LoadSDigits();
  runLoader->LoadHits();

  AliLoader *dl = runLoader->GetDetectorLoader("ITS");

  AliGeomManager::LoadGeometry("geometry.root");
  TObjArray algITS;
  AliGeomManager::LoadAlignObjsFromCDBSingleDet("ITS",algITS);
  AliGeomManager::ApplyAlignObjsToGeom(algITS);
  //
  AliITSUGeomTGeo* gm = new AliITSUGeomTGeo(kTRUE);
  AliITSMFTClusterPix::SetGeom(gm);
  //
  AliITSURecoDet *its = new AliITSURecoDet(gm, "ITSinterface");
  its->CreateClusterArrays();
  //
  Double_t xg1,yg1,zg1=0.,xg0,yg0,zg0=0.,tg0;
  Double_t xExit,yExit,zExit,xEnt,yEnt,zEnt,tof1;

  //
  TTree *cluTree = 0x0;
  TTree *hitTree = 0x0;
  TClonesArray *hitList=new TClonesArray("AliITSMFTHit");
  //
  Float_t xyzClGloF[3];
  Double_t xyzClGlo[3],xyzClTr[3];
  Int_t labels[3];
  int nLab = 0;
  int nlr=its->GetNLayersActive();
  int ntotev = (Int_t)runLoader->GetNumberOfEvents();

  printf("N Events : %i \n",ntotev);
  if (nev>0) ntotev = TMath::Min(nev,ntotev);
  //
  
  // output tree
  TFile* flOut = TFile::Open("clInfo.root","recreate");
  TTree* trOut = new TTree("clitsu","clitsu");
  clSumm cSum;
  trOut->Branch("evID", &cSum.evID ,"evID/I");
  trOut->Branch("volID",&cSum.volID,"volID/I");
  trOut->Branch("lrID", &cSum.lrID ,"lrID/I");  
  trOut->Branch("clID", &cSum.clID ,"clID/I");  
  trOut->Branch("nPix", &cSum.nPix ,"nPix/I");
  trOut->Branch("nX"  , &cSum.nX   ,"nX/I");
  trOut->Branch("nZ"  , &cSum.nZ   ,"nZ/I");
  trOut->Branch("q"   , &cSum.q    ,"q/I");
  trOut->Branch("pt"  , &cSum.pt   ,"pt/F");  
  trOut->Branch("eta"  ,&cSum.eta  ,"eta/F");  
  trOut->Branch("phi"  , &cSum.phi  ,"phi/F");  
  trOut->Branch("xyz",   cSum.xyz,  "xyz[3]/F");  
  trOut->Branch("dX"  , &cSum.dX   ,"dX/F");
  trOut->Branch("dY"  , &cSum.dY   ,"dY/F");
  trOut->Branch("dZ"  , &cSum.dZ   ,"dZ/F");  
  trOut->Branch("split",&cSum.split,"split/O");
  trOut->Branch("prim", &cSum.prim, "prim/O");
  trOut->Branch("pdg",  &cSum.pdg,  "pdg/I");
  trOut->Branch("ntr",  &cSum.ntr,  "ntr/I");
  trOut->Branch("alpha", &cSum.alpha, "alpha/F");
  trOut->Branch("beta", &cSum.beta, "beta/F");
  trOut->Branch("nRowPatt", &cSum.nRowPatt, "nRowPatt/I");
  trOut->Branch("nColPatt", &cSum.nColPatt, "nColPatt/I");

  TopDatabase DB;
  
  for (Int_t iEvent = 0; iEvent < ntotev; iEvent++) {
    printf("\n Event %i \n",iEvent);
    runLoader->GetEvent(iEvent);
    AliStack *stack = runLoader->Stack();
    cluTree=dl->TreeR();
    hitTree=dl->TreeH();
    hitTree->SetBranchAddress("ITS",&hitList);
    // 
    // read clusters
    for (int ilr=nlr;ilr--;) {
      TBranch* br = cluTree->GetBranch(Form("ITSRecPoints%d",ilr));
      if (!br) {printf("Did not find cluster branch for lr %d\n",ilr); exit(1);}
      br->SetAddress(its->GetLayerActive(ilr)->GetClustersAddress());
    }
    cluTree->GetEntry(0);
    its->ProcessClusters();
    //
    // read hits
    for(Int_t iEnt=0;iEnt<hitTree->GetEntries();iEnt++){//entries loop of the hits
      hitTree->GetEntry(iEnt);
      int nh = hitList->GetEntries();
      for(Int_t iHit=0; iHit<nh;iHit++){
        AliITSMFTHit *pHit = (AliITSMFTHit*)hitList->At(iHit);
        int mcID = pHit->GetTrack();
	//printf("MCid: %d %d %d Ch %d\n",iEnt,iHit, mcID, pHit->GetChip());
        TClonesArray* harr = arrMCTracks.GetEntriesFast()>mcID ? (TClonesArray*)arrMCTracks.At(mcID) : 0;
        if (!harr) {
          harr = new TClonesArray("AliITSMFTHit"); // 1st encounter of the MC track
          arrMCTracks.AddAtAndExpand(harr,mcID);
        }
        //
        new ( (*harr)[harr->GetEntriesFast()] ) AliITSMFTHit(*pHit);
      }
    }
    //    return;
    //
    // compare clusters and hits
    //
    printf(" tree entries: %lld\n",cluTree->GetEntries());
    //
    for (int ilr=0;ilr<nlr;ilr++) {
      AliITSURecoLayer* lr = its->GetLayerActive(ilr);
      TClonesArray* clr = lr->GetClusters();
      int nClu = clr->GetEntries();
      //printf("Layer %d : %d clusters\n",ilr,nClu);
      //
      for (int icl=0;icl<nClu;icl++) {
        AliITSMFTClusterPix *cl = (AliITSMFTClusterPix*)clr->At(icl);
        int modID = cl->GetVolumeId();

        //------------ check if this is a split cluster
        int sInL = modID - gm->GetFirstChipIndex(ilr);
        if (!cl->TestBit(kSplCheck)) {
          cl->SetBit(kSplCheck);
          // check if there is no other cluster with same label on this module
          AliITSURecoSens* sens = lr->GetSensor(sInL);
          int nclSn = sens->GetNClusters();
          int offs = sens->GetFirstClusterId();
          //  printf("To check for %d (mod:%d) N=%d from %d\n",icl,modID,nclSn,offs);
          for (int ics=0;ics<nclSn;ics++) {
            AliITSMFTClusterPix* clusT = (AliITSMFTClusterPix*)lr->GetCluster(offs+ics); // access to clusters
            if (clusT==cl) continue;
            for (int ilb0=0;ilb0<3;ilb0++) {
              int lb0 = cl->GetLabel(ilb0); if (lb0<=-1) break;
              for (int ilb1=0;ilb1<3;ilb1++) {
                int lb1 = clusT->GetLabel(ilb1); if (lb1<=-1) break;
                if (lb1==lb0) {
                  cl->SetBit(kSplit);
                  clusT->SetBit(kSplit);
                  /*
                  printf("Discard clusters of module %d:\n",modID);
                  cl->Print();
                  clusT->Print();
                  */
                  break;
                }
              }
            }
          }
        }
        //------------
        const AliITSMFTSegmentationPix* segm = gm->GetSegmentation(ilr);
        //
        cl->GetGlobalXYZ(xyzClGloF);
        int clsize = cl->GetNPix();
        for (int i=3;i--;) xyzClGlo[i] = xyzClGloF[i];
        const TGeoHMatrix* mat = gm->GetMatrixSens(modID);
        if (!mat) {printf("failed to get matrix for module %d\n",cl->GetVolumeId());}
        mat->MasterToLocal(xyzClGlo,xyzClTr);
        //
        int col,row;
        segm->LocalToDet(xyzClTr[0],xyzClTr[2],row,col); // effective col/row
        nLab = 0;
        for (int il=0;il<3;il++) {
          if (cl->GetLabel(il)>=0) labels[nLab++] = cl->GetLabel(il);
          else break;
        }
        // find hit info
        for (int il=0;il<nLab;il++) {
          TClonesArray* htArr = (TClonesArray*)arrMCTracks.At(labels[il]);
	  //printf("check %d/%d LB %d  %p\n",il,nLab,labels[il],htArr);
	  if (!htArr) {printf("did not find MChits for label %d ",labels[il]); cl->Print(); continue;}
          //
          int nh = htArr->GetEntriesFast();
          AliITSMFTHit *pHit=0;
          for (int ih=nh;ih--;) {
            AliITSMFTHit* tHit = (AliITSMFTHit*)htArr->At(ih);
            if (tHit->GetChip()!=modID) continue;
            pHit = tHit;
            break;
          }
          if (!pHit) {
            printf("did not find MChit for label %d on module %d ",il,modID); 
            cl->Print(); 
            htArr->Print();
            continue;
          }
          //
          pHit->GetPositionG(xg1,yg1,zg1);
          pHit->GetPositionG0(xg0,yg0,zg0,tg0);
          //
          double txyzH[3],gxyzH[3] = { (xg1+xg0)/2, (yg1+yg0)/2, (zg1+zg0)/2 };
          mat->MasterToLocal(gxyzH,txyzH);

          double rcl = TMath::Sqrt(xyzClTr[0]*xyzClTr[0]+xyzClTr[1]*xyzClTr[1]);
          double rht = TMath::Sqrt(txyzH[0]*txyzH[0]+txyzH[1]*txyzH[1]);
          //
          //Angles determination

          pHit->GetPositionL(xExit,yExit,zExit,gm);
          pHit->GetPositionL0(xEnt,yEnt,zEnt,tof1,gm);

          Double_t dirHit[3]={(xExit-xEnt),(yExit-yEnt),(zExit-zEnt)};

          /*double PG[3] = {(double)pHit->GetPXG(), (double)pHit->GetPYG(), (double)pHit->GetPZG()}; //Momentum at hit-point in Global Frame
          double PL[3];
          if (TMath::Abs(PG[0])<10e-7 && TMath::Abs(PG[1])<10e-7) {
            pHit->Dump();
            int lb = pHit->GetTrack();
            stack->Particle(lb)->Print();
            continue;
          }
          mat->MasterToLocalVect(PG,PL); //Momentum in local Frame
          //printf(">> %e %e   %e %e   %e %e\n",PG[0],PL[0],PG[1],PL[1],PG[2],PL[2]);*/

          Double_t alpha1 = TMath::ACos(TMath::Abs(dirHit[1])/TMath::Sqrt(dirHit[0]*dirHit[0]+dirHit[1]*dirHit[1]+dirHit[2]*dirHit[2])); //Polar Angle
          Float_t alpha2 = (Float_t) alpha1; //convert to float
          cSum.alpha = alpha2;

          Double_t beta1;
          beta1 = TMath::ATan2(dirHit[0],dirHit[2]); //Azimuthal angle, values from -Pi to Pi
          Float_t beta2 = (Float_t) beta1;
          cSum.beta = beta2;

	  if(ilr==0){
	    hL0A->Fill(alpha2);
	    hL0B->Fill(beta2);
	  }
	  
	  if(ilr==1){
	    hL1A->Fill(alpha2);
	    hL1B->Fill(beta2);
	  }

	  if(ilr==2){
	    hL2A->Fill(alpha2);
	    hL2B->Fill(beta2);
	  }

	  if(ilr==3){
	    hL3A->Fill(alpha2);
	    hL3B->Fill(beta2);
	  }

	  if(ilr==4){
	    hL4A->Fill(alpha2);
	    hL4B->Fill(beta2);
	  }

	  if(ilr==5){
	    hL5A->Fill(alpha2);
	    hL5B->Fill(beta2);
	  }

	  if(ilr==6){
	    hL6A->Fill(alpha2);
	    hL6B->Fill(beta2);
	  }
          
          GetHistoClSize(clsize,kDR,&histoArr)->Fill((rht-rcl)*1e4);
          if (cl->TestBit(kSplit)) {
            if (col%2) GetHistoClSize(clsize,kDTXoddSPL,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
            else       GetHistoClSize(clsize,kDTXevenSPL,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
            GetHistoClSize(clsize,kDTZSPL,&histoArr)->Fill((txyzH[2]-xyzClTr[2])*1e4);
            GetHistoClSize(0,kNPixSPL,&histoArr)->Fill(clsize);
          }
          if (col%2) GetHistoClSize(clsize,kDTXodd,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
          else       GetHistoClSize(clsize,kDTXeven,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
          GetHistoClSize(clsize,kDTZ,&histoArr)->Fill((txyzH[2]-xyzClTr[2])*1e4);
          GetHistoClSize(0,kNPixAll,&histoArr)->Fill(clsize);
          //
          cSum.evID = iEvent;
          cSum.volID = cl->GetVolumeId();
          cSum.lrID = ilr;
          cSum.clID = icl;
          cSum.nPix = cl->GetNPix();
          cSum.nX   = cl->GetNx();
          cSum.nZ   = cl->GetNz();
          cSum.q    = cl->GetQ();
          cSum.split = cl->TestBit(kSplit);
          cSum.dX = (txyzH[0]-xyzClTr[0])*1e4;
          cSum.dY = (txyzH[1]-xyzClTr[1])*1e4;
          cSum.dZ = (txyzH[2]-xyzClTr[2])*1e4;
          cSum.nRowPatt = cl-> GetPatternRowSpan();
          cSum.nColPatt = cl-> GetPatternColSpan();
	  DB.AccountTopology(*cl, cSum.dX, cSum.dZ, cSum.alpha, cSum.beta);
          
          GetHistoClSize(clsize,kDR,&histoArr)->Fill((rht-rcl)*1e4);
          if (cl->TestBit(kSplit)) {
            if (col%2) GetHistoClSize(clsize,kDTXoddSPL,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
            else       GetHistoClSize(clsize,kDTXevenSPL,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
            GetHistoClSize(clsize,kDTZSPL,&histoArr)->Fill((txyzH[2]-xyzClTr[2])*1e4);
            GetHistoClSize(0,kNPixSPL,&histoArr)->Fill(clsize);
          }
          if (col%2) GetHistoClSize(clsize,kDTXodd,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
          else       GetHistoClSize(clsize,kDTXeven,&histoArr)->Fill((txyzH[0]-xyzClTr[0])*1e4);
          GetHistoClSize(clsize,kDTZ,&histoArr)->Fill((txyzH[2]-xyzClTr[2])*1e4);
          GetHistoClSize(0,kNPixAll,&histoArr)->Fill(clsize);
          //
          cSum.evID = iEvent;
          cSum.volID = cl->GetVolumeId();
          cSum.lrID = ilr;
          cSum.clID = icl;
          cSum.nPix = cl->GetNPix();
          cSum.nX   = cl->GetNx();
          cSum.nZ   = cl->GetNz();
          cSum.q    = cl->GetQ();
          cSum.split = cl->TestBit(kSplit);
          cSum.dX = (txyzH[0]-xyzClTr[0])*1e4;
          cSum.dY = (txyzH[1]-xyzClTr[1])*1e4;
          cSum.dZ = (txyzH[2]-xyzClTr[2])*1e4;
          cSum.nRowPatt = cl-> GetPatternRowSpan();
          cSum.nColPatt = cl-> GetPatternColSpan();
 
                    
          int label = cl->GetLabel(0);
          TParticle* part = 0;
          if (label>=0 && (part=stack->Particle(label)) ) {
            cSum.pdg = part->GetPdgCode();
            cSum.eta = part->Eta();
            cSum.pt  = part->Pt();
            cSum.phi = part->Phi();
            cSum.prim = stack->IsPhysicalPrimary(label);
          } 
          cSum.ntr = 0;
          for (int ilb=0;ilb<3;ilb++) if (cl->GetLabel(ilb)>=0) cSum.ntr++;
          for (int i=0;i<3;i++) cSum.xyz[i] = xyzClGloF[i];
          //
          trOut->Fill();
          /*
          if (clsize==5) {
            printf("\nL%d(%c) Mod%d, Cl:%d | %+5.1f %+5.1f (%d/%d)|H:%e %e %e | C:%e %e %e\n",ilr,cl->TestBit(kSplit) ? 'S':'N',
             modID,icl,(txyzH[0]-xyzClTr[0])*1e4,(txyzH[2]-xyzClTr[2])*1e4, row,col,
             gxyzH[0],gxyzH[1],gxyzH[2],xyzClGlo[0],xyzClGlo[1],xyzClGlo[2]);
            cl->Print();
            pHit->Print();
            //
            double a0,b0,c0,a1,b1,c1,e0;
            pHit->GetPositionL0(a0,b0,c0,e0);
            pHit->GetPositionL(a1,b1,c1);
            float cloc[3];
            cl->GetLocalXYZ(cloc);
            printf("LocH: %e %e %e | %e %e %e\n",a0,b0,c0,a1,b1,c1);
            printf("LocC: %e %e %e | %e %e %e\n",cloc[0],cloc[1],cloc[2],xyzClTr[0],xyzClTr[1],xyzClTr[2]);
          }
          */
          //
        }
      }
    }
    
    //    layerClus.Clear();
    //
    arrMCTracks.Delete();
  }//event loop
  //
  DB.EndAndSort();
  DB.SetThresholdCumulative(0.95);
  cout << "Over threshold: : "<< DB.GetOverThr()<<endl;
  DB.Grouping(10,10);
  DB.PrintDB("Database1.txt"); 
  flOut->cd();
  trOut->Write();
  delete trOut;
  flOut->Close();
  flOut->Delete();
  DrawReport("clinfo.ps",&histoArr);
  TFile* flDB = TFile::Open("TopologyDatabase.root", "recreate");
  flDB->WriteObject(&DB,"DB","kSingleKey");
  flDB->Close();
  delete flDB;

  TCanvas* cnv123 = new TCanvas("cnv123","cnv123");
  cnv123->Divide(1,2);
  cnv123->Print("anglesdistr.pdf[");
  cnv123->cd(1);
  hL0A->Draw();
  cnv123->cd(2);
  hL0B->Draw();
  cnv123->Print("anglesdistr.pdf");
  cnv123->cd(1);
  hL1A->Draw();
  cnv123->cd(2);
  hL1B->Draw();
  cnv123->Print("anglesdistr.pdf");
  cnv123->cd(1);
  hL2A->Draw();
  cnv123->cd(2);
  hL2B->Draw();
  cnv123->Print("anglesdistr.pdf");
  cnv123->cd(1);
  hL3A->Draw();
  cnv123->cd(2);
  hL3B->Draw();
  cnv123->Print("anglesdistr.pdf");
  cnv123->cd(1);
  hL4A->Draw();
  cnv123->cd(2);
  hL4B->Draw();
  cnv123->Print("anglesdistr.pdf");
  cnv123->cd(1);
  hL5A->Draw();
  cnv123->cd(2);
  hL5B->Draw();
  cnv123->Print("anglesdistr.pdf");
  cnv123->cd(1);
  hL6A->Draw();
  cnv123->cd(2);
  hL6B->Draw();
  cnv123->Print("anglesdistr.pdf");
  cnv123->Print("anglesdistr.pdf]");
  //
}
Example #13
0
void MakeSnapshot(Int_t run, const char* defStorage, TMap* specStorages, const char* snapshotFileName)
{
    AliCDBManager *cdb = AliCDBManager::Instance();
    cdb->SetDefaultStorage(defStorage);
    cdb->SetRun(run);

    TIter iter(specStorages->GetTable());
    TPair *pair = 0;
    while((pair = dynamic_cast<TPair*> (iter.Next()))){
	TObjString* caltype = dynamic_cast<TObjString*> (pair->Key());
	TObjString* specstor= dynamic_cast<TObjString*> (pair->Value());
	if (caltype && specstor)
	    //TString calType = caltype->GetString();
	    //TString specStor = specstor->GetString();
	    //cdb->SetSpecificStorage(calType.Data(),specStor.Data());
	    cdb->SetSpecificStorage(caltype->GetString().Data(),specstor->GetString().Data());
	else
	    //AliFatal("Error reading info for specific storage")
	    Printf("Error reading info for specific storage");
    }

    // ********************************** GRP ******************************************
    cdb->Get("GRP/CTP/Config");
    cdb->Get("GRP/Calib/LHCClockPhase");
    cdb->Get("GRP/GRP/Data");
    cdb->Get("GRP/Align/Data");
    cdb->Get("GRP/Calib/MeanVertexSPD");
    cdb->Get("GRP/Calib/MeanVertex");
    cdb->Get("GRP/Calib/MeanVertexTPC");
    cdb->Get("GRP/Calib/CosmicTriggers");
    cdb->Get("GRP/CTP/Scalers");
    cdb->Get("GRP/CTP/CTPtiming");
    cdb->Get("GRP/CTP/TimeAlign");
    cdb->Get("GRP/GRP/LHCData");
    cdb->Get("GRP/Calib/RecoParam");

    // ********************************** ALL ******************************************
    TString detStr = ("ITS TPC TRD TOF PHOS HMPID EMCAL MUON ZDC PMD T0 VZERO");
    //TString detStr = ("ITS MUON TPC");
    TObjArray *arr = detStr.Tokenize(' ');
    for (Int_t iDet=0; iDet<arr->GetEntries(); iDet++) {
	TObjString *detOStr = dynamic_cast<TObjString*>(arr->At(iDet));
	AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",detOStr->GetString().Data()));
	AliCDBManager::Instance()->Get(Form("%s/Align/Data",detOStr->GetString().Data()));
    }

    // ******************************** TRIGGER ****************************************
    // Temporary fix - one has to define the correct policy in order
    // to load the trigger OCDB entries only for the detectors that
    // in the trigger or that are needed in order to put correct
    // information in ESD
    AliCDBManager::Instance()->GetAll("TRIGGER/*/*");

    // ********************************** HLT ******************************************
    // cdb->Get("HLT/ConfigHLT/esdLayout");
    // cdb->Get("HLT/Calib/StreamerInfo");

    TMap* entriesMap = const_cast<TMap*>(cdb->GetEntryCache());
    Printf("\nentriesMap has %d entries!\n", entriesMap->GetEntries());

    TList* entriesList = const_cast<TList*>(cdb->GetRetrievedIds());
    Printf("\nentriesList has %d entries!\n", entriesList->GetEntries());

    //TString filename(TString::Format("CDBsnapshot_Run%d.root",run));
    TString filename(snapshotFileName);
    TFile *f = new TFile(filename.Data(),"recreate");
    f->cd();
    f->WriteObject(entriesMap,"entriesMap");
    f->WriteObject(entriesList,"entriesList");
    f->Close();
    entriesMap->SetOwnerKeyValue(kFALSE,kFALSE);
    entriesList->SetOwner(kFALSE);
}
Example #14
0
void testCosmicsTrigger(const char *esdfilename,
		        const char *treename,
			const char *cdbURI,
		        int nofEvents=-1
		        )
{
  // check the name of the tree
  TString strtree=treename;
  if (strtree.CompareTo("esdTree")==0) strtree="ESD";
  else if (strtree.CompareTo("HLTesdTree")==0) strtree="HLTESD";
  else {
    cerr << "invalid treename '" << treename << "', supported 'esdTree' and 'HLTesdTree'" << endl;
    return;
  }

  // connect to the GRID if we use a file or OCDB from the GRID
  TString struri=cdbURI;
  TString strfile=esdfilename;
  if (struri.BeginsWith("raw://") ||
      strfile.Contains("://") && !strfile.Contains("local://")) {
    TGrid::Connect("alien");
  }

  // open the ESD file and get the event count
  if (!strfile.EndsWith("/")) strfile+="/";
  strfile+="AliESDs.root";
  TFile* esdfile=TFile::Open(strfile);
  if (!esdfile || esdfile->IsZombie()) {
    cerr << "cannot open file " << strfile << endl;
    return;
  }

  // get number of events
  TTree* pTree=NULL;
  esdfile->GetObject(treename, pTree);
  if (!pTree) {
    cerr << "can not find " << treename << " in file " << strfile << endl;
    return;
  }
  if (pTree->GetEntries()<=0) {
    cerr << "empty tree " << treename << " in file " << strfile << endl;
    return;
  }
  
  AliESDEvent* esd=new AliESDEvent;
  esd->ReadFromTree(pTree);
  pTree->GetEntry(0);

  if (nofEvents<0 || nofEvents>pTree->GetEntries())
    nofEvents=pTree->GetEntries();

  // Set the CDB storage location
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbURI);
  man->SetRun(esd->GetRunNumber());
  if (struri.BeginsWith("local://")) {
    // set specific storage for GRP entry
    // search in the working directory and one level above, the latter
    // follows the standard simulation setup like e.g. in test/ppbench
    if (!gSystem->AccessPathName("GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
    } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");      
    }
  }

  //////////////////////////////////////////////////////////////////////////////////////
  //
  // setup the HLT system
  AliHLTSystem *pHLT = AliHLTPluginBase::GetInstance();
  
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libTPCcalib");  
  
  TString arguments, triggerinput;

  // ESD publisher component
  arguments=" -datapath "; arguments+=esdfilename;
  arguments+=" -entrytype "; arguments+=strtree;
  triggerinput="ESD-publisher";

  AliHLTConfiguration esdpublisher(triggerinput.Data(), "ESDMCEventPublisher", "", arguments.Data());

  AliHLTConfiguration cosmicstr("cosmics-trigger","CosmicsTrigger", triggerinput.Data(),"");
  //AliHLTConfiguration globaltriggerconf("global-trigger", "HLTGlobalTrigger", "cosmics-trigger" , "");
    
  // set option for the HLT system
  // arguments
  //  - libraries to be used as plugins
  //  - loglevel=0x79 : Important, Warning, Error, Fatal
  pHLT->ScanOptions("libAliHLTUtil.so libAliHLTMUON.so libAliHLTTRD.so libAliHLTGlobal.so libAliHLTTrigger.so loglevel=0x79");

  pHLT->BuildTaskList("cosmics-trigger");
  //pHLT->BuildTaskList("global-trigger");
  pHLT->Run(nofEvents);
}