예제 #1
0
//-----------------------------------------------------------------------
void MakeMUONRecoParamArray(Int_t startRun = 0, 
                            Int_t endRun = AliCDBRunRange::Infinity(),
                            const char* settings="ppIdeal")
{
  /// set the reconstruction parameters and store them in the OCDB ($ALICE_ROOT/OCDB/MUON/Calib/RecoParam/).
  ///
  /// - make a CDB entry for the run range [startRun, endRun]
  ///
  /// for the possible values of settings, please see AliMUONRecoParam::Create
  
  // init CDB
  AliCDBManager* man = AliCDBManager::Instance();
  
  if (!man->IsDefaultStorageSet()) 
  {
    man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");    
  }
  
  man->SetRun(startRun);
  
  TObjArray* recoParams = AliMUONRecoParam::Create(settings);
  
  if (recoParams)
  {
    // save RecoParam in CDB
    AliMUONCDB::WriteToCDB(recoParams, "MUON/Calib/RecoParam", startRun, endRun, 
                           "reconstruction parameters for MUON", "L. Aphecetche and P. Pillot");
  }
  
  delete recoParams;
}
예제 #2
0
파일: OCDBConfig.C 프로젝트: alisw/AliDPG
void OCDBDefault(Int_t mode)
{

  Int_t run  = atoi(gSystem->Getenv("CONFIG_RUN"));  
  AliCDBManager* man = AliCDBManager::Instance();
  man->SetDefaultStorage("raw://");
  
  if(gSystem->Getenv("CONFIG_OCDBTIMESTAMP"))
  {
    TString t = gSystem->Getenv("CONFIG_OCDBTIMESTAMP");
    TObjArray* list =t.Tokenize("_");
    UInt_t tU[6];
    for(Int_t i=0; i<list->GetEntries(); i++)
    {
      TString st = ((TObjString*)list->At(i))->GetString();
      tU[i] =(UInt_t)atoi(st.Data());
    }
    man->SetMaxDate(TTimeStamp(tU[0], tU[1], tU[2], tU[3], tU[4], tU[5]));
    printf("*** Setting custom OCDB time stamp %s ***\n", t.Data());
  }
  
  man->SetRun(run);
  
  // set detector specific paths
  DefaultSpecificStorage(man, mode);

}
예제 #3
0
void MakeFMDZeroMisAlignment()
{
  // Create TClonesArray of zero-misalignment objects for FMD
  //
  const char* macroname = "MakeFMDZeroMisAlignment.C";

  // Activate CDB storage and load geometry from CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);

  Bool_t    toCdb   = TString(gSystem->Getenv("TOCDB")) == TString("kTRUE");
  TString   storage = gSystem->Getenv("STORAGE");
  TString   output  = "FMDfullMisalignment.root";
  if(toCdb) output  = storage;
  
  gSystem->Load("libFMDutil");
  AliFMDAlignFaker::GetGeometry(toCdb, storage);
  AliFMDAlignFaker* faker = new AliFMDAlignFaker(AliFMDAlignFaker::kAll, 
						 "geometry.root", 
						 output.Data());

  faker->SetSensorDisplacement(0., 0., 0., 0., 0., 0.);
  faker->SetSensorRotation(0., 0., 0., 0., 0., 0.);
  faker->SetHalfDisplacement(0., 0., 0., 0., 0., 0.);
  faker->SetHalfRotation(0., 0., 0., 0., 0., 0.);
  faker->Exec();
  delete faker;


}
예제 #4
0
파일: PatchCDB.C 프로젝트: aphecetche/acode
void PatchCDB(const char* runlist, const char* runlist1400, const char* srcOCDBPath="alien://folder=/alice/data/2016/OCDB", const char* destOCDBPath="alien://folder=/alice/cern.ch/user/l/laphecet/OCDBCH3L")
{
    // function to patch the OCDB MUON/Calib/HV for the swap of CH3L Q2S1 and Q2S2
    // runlist = full list of runs where Chamber03Left/Quad2Sect1 has an HV problem (trips, too low, plus the 1400 V
    // below)
    // runlist1400 = list of runs where Chamber03Left/Quad2Sect1 was struggling at 1400 V
    // for the runs in runlist1400, the HV will be forced to zero for that sector
    // note that Chamber03Left/Quad2Sect1 = Chamber02Left/Quad1Sect0 in DCS alias world
     
  AliAnalysisTriggerScalers ts(runlist,srcOCDBPath);

  std::vector<int> vrunlist = ts.GetRunList();

  AliAnalysisTriggerScalers ts1400(runlist1400,srcOCDBPath);
  std::vector<int> vrunlist1400 = ts1400.GetRunList();

  AliCDBManager* man = AliCDBManager::Instance();

  TObjString sector2("MchHvLvLeft/Chamber02Left/Quad1Sect0.actual.vMon");
  TObjString sector1("MchHvLvLeft/Chamber02Left/Quad1Sect1.actual.vMon");

  for ( auto r : vrunlist )
  {
      man->SetDefaultStorage(srcOCDBPath);
      man->SetRun(r);
      std::cout << "Run " << r << std::endl;

      AliCDBEntry* entry = man->Get("MUON/Calib/HV");
      TMap* hvmap = static_cast<TMap*>(entry->GetObject()->Clone());

      TPair* p1 = hvmap->RemoveEntry(&sector2);

      if ( std::find(vrunlist1400.begin(),vrunlist1400.end(),r) != vrunlist1400.end() )
      {
        TObjArray* a1 = static_cast<TObjArray*>(p1->Value());
        AliDCSValue* first = static_cast<AliDCSValue*>(a1->First());
        AliDCSValue* last = static_cast<AliDCSValue*>(a1->Last());
        a1->Delete();
        a1->Add(new AliDCSValue(0.0f,first->GetTimeStamp()));
        a1->Add(new AliDCSValue(0.0f,last->GetTimeStamp()));
      }
      TPair* p2 = hvmap->RemoveEntry(&sector1);

      hvmap->Add(new TObjString(sector2),p2->Value());
      hvmap->Add(new TObjString(sector1),p1->Value());

      delete p1->Key();
      delete p2->Key();

      man->SetDefaultStorage(destOCDBPath);
      hvmap->SetUniqueID( hvmap->GetUniqueID() | ( 1 << 9 ) );
      AliMUONCDB::WriteToCDB(hvmap,"MUON/Calib/HV",r,r,"Patched for CH3L Quad2Sect1 vs 0 swapping","L. Aphecetche");
      man->ClearCache();
  }
}
예제 #5
0
파일: initGeom.C 프로젝트: alisw/AliRoot
void initGeom()
{
    // Macro replacing the gAlice->Init() to initialize the geometry
    // Suggested by Raffaele Grosso <*****@*****.**>
    
    AliCDBManager* man = AliCDBManager::Instance();
    man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
    man->SetRun(0);
    
    gROOT->LoadMacro("Config.C");
    gInterpreter->ProcessLine(gAlice->GetConfigFunction());
    gAlice->GetMCApp()->Init();
}
예제 #6
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;
}
예제 #7
0
//__________________________________________________________
void AliTRDCheckPedestal(const Int_t runNr){
  // Establish grid connection
  if(!TGrid::Connect("alien://")){printf("F-No grid connection\n");return;}
  // Set the storage to the OCDB of this runNr. It will be like
  // alien://folder=/alice/data/2016/OCDB
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorageFromRun(runNr);
  // We derive the reference storage from it
  const AliCDBStorage *stor =  man->GetDefaultStorage();
  TString folder = stor->GetBaseFolder();
  folder.ReplaceAll("OCDB","Reference");
  man->SetDefaultStorage(Form("alien://folder=%s",folder.Data()));
  // Set the run number
  man->SetRun(runNr);

  // We abuse the folder name to derive the year
  TString yearString(folder);
  yearString.ReplaceAll("/alice/data/","");
  yearString.ReplaceAll("/Reference/","");
  const Int_t year = yearString.Atoi();
  printf("W-Experimental: Derived year %d from storage folder\n",year);
  
  // The reference data is stored per Local Data Concentrator
  std::vector<Int_t> LDCvec = GetLDCVector(year);
  // Loop over LDCs
  for(std::vector<Int_t>::iterator LDCit = LDCvec.begin();LDCit!=LDCvec.end();LDCit++){
    const TString padstatus = Form("TRD/DAQData/PadStatus%d",*LDCit);
    AliCDBEntry *entry = AliCDBManager::Instance()->Get(padstatus.Data());
    AliTRDCalibPadStatus *calpadstatus = dynamic_cast<AliTRDCalibPadStatus *>(entry->GetObject());
    if(!calpadstatus){printf("E-Can not find %s in %s \n",padstatus.Data(),folder.Data());continue;}

    //Create the noise pad with the RMS values of each channel
    AliTRDCalPad *noisePad = calpadstatus->CreateCalPad();
    // LDC -> SM mapping
    std::vector<Int_t> SMvec = GetSMVector(year,*LDCit);
    for(std::vector<Int_t>::iterator SMit=SMvec.begin();SMit!=SMvec.end();SMit++){
      const TString padstatussm = Form("PadNoise-LDC%d-SM%02d",*LDCit,*SMit);
      TCanvas *cpadstatusm = new TCanvas(padstatussm.Data(),padstatussm.Data(),50,50,600,800);
      cpadstatusm->Divide(3,2);
      // Draw each layer (or here plane)
      const Float_t zRange[2]={0.,0.2};
      for(Int_t iLayer = 0;iLayer<6;iLayer++){
  	cpadstatusm->cd(iLayer+1);
	noisePad->MakeHisto2DSmPl(*SMit,iLayer,0,0,zRange[0],zRange[1],-1)->Draw("colz");
      }
      cpadstatusm->SaveAs(Form("%s.pdf",cpadstatusm->GetName()));
    } // Loop over SMs of this LDC
  } // End of loop over LDCs
} // End of void AliTRDcheckPedestal
예제 #8
0
파일: makeSDigit.C 프로젝트: alisw/AliRoot
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;
}
예제 #9
0
파일: PatternRaw.C 프로젝트: alisw/AliRoot
/** Display hits 
    @ingroup FMD_script
 */
void
PatternRaw(const char* file="raw.root")
{
  // AliLog::SetModuleDebugLevel("FMD", 8);
  AliCDBManager* cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  AliFMDParameters::Instance()->Init();
  gSystem->Load("libFMDutil");
  AliFMDPattern* d = new AliFMDPattern;
  d->AddLoad(AliFMDInput::kRaw);
  d->SetRawFile(file);
  d->SetName("raw");
  d->SetTitle("Raw");
  // d->AddLoad(AliFMDInput::kKinematics);
  d->Run();
}
예제 #10
0
파일: sim.C 프로젝트: 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);
}
예제 #11
0
파일: g4menu.C 프로젝트: alisw/AliRoot
void Init()
{  
  AliCDBManager* man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  man->SetRun(0);
 
  // MC application initialization
  TString configFileName = "$ALICE_ROOT/macros/g4Config.C";
  gROOT->LoadMacro(configFileName.Data());
  gInterpreter->ProcessLine(gAlice->GetConfigFunction());
  gAlice->GetMCApp()->Init();

  ((TGeant4*)gMC)->ProcessGeantCommand("/mcDet/printMedia");

  cout << endl
       << "Only MonteCarlo initialization has been performed. " << endl
       << "To run simulation you have to re-run aliroot and choose Run in g4menu." << endl;
}    
예제 #12
0
파일: trd_qaRec.C 프로젝트: alisw/AliRoot
void trd_qaRec()
{
  gSystem->Load("libANALYSIS");
  gSystem->Load("libTender");
  gSystem->Load("libPWGPP");

  if(!TFile::Open("TRD.DebugInfoGen.root")){
    printf("No debug file for InfoGen task.\n");
    return;
  }
  TTree *t = (TTree*)gFile->Get("trackInfo");
  AliTRDtrackInfo *fTrackInfo = 0x0;
  t->SetBranchAddress("TrackInfo.", &fTrackInfo);
  gROOT->cd();

  AliCDBManager *cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  AliEveEventManager::Instance()->AssertGeometry();
  AliEveEventManager::AssertMagField();

  AliTRDReconstructor *reco = new AliTRDReconstructor();
  reco->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());

  AliEveTRDTrackList *tracks = new AliEveTRDTrackList("TRD QA Tracks");



  AliTRDtrackV1 *fTrack = 0x0, *track = 0x0;
  for (Int_t it=0; it<t->GetEntries(); it++){
    if(!t->GetEntry(it)) continue;
    if(!fTrackInfo) continue;
    if(!(fTrack = fTrackInfo->GetTrack())) continue;
    
    track = new AliTRDtrackV1(*fTrack);
    track->SetOwner();
    track->SetReconstructor(reco);
    tracks->AddElement(new AliEveTRDTrack(track));
    printf("Trk[%3d] ESD[%d] Ncls[%d]\n", it, fTrackInfo->GetESDinfo()->GetId(), fTrack->GetNumberOfClusters());
    if(it>= 100) break;
  }
  gEve->AddElement(tracks);
  gEve->Redraw3D();
}
예제 #13
0
void AliTRDreadRaw2Clusters(const char *fname = "raw.root", const char *fnameGeom = "./geometry.root")
{
  AliCDBManager *cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);

  TFile *fGeometryFile = TFile::Open(fnameGeom);
  TGeoManager *fGeoManager = 0;
  if (fGeometryFile)
    {
      fGeoManager = (TGeoManager *)fGeometryFile->Get("Geometry");
    }

  if (fGeoManager == 0)
    {
      cout << "Geo Manager init failed." << endl;
    }

  AliTRDdigitsManager manR;
  manR.CreateArrays();

  AliRawReaderRoot reader(fname, 0);
  reader.Select("TRD");

  Int_t ievent = 0;
  while (reader.NextEvent())
    {
      TTree *treeR = new TTree(sdir, "TRD clusters");
      AliTRDclusterizer clusterizer("TRDclusterizer", "TRDclusterizer");
      clusterizer.OpenOutput(treeR);
      Int_t ir = clusterizer.Raw2ClustersChamber(&reader);
      
      cout << "Clusterizer returned " << ir << endl;

      // do something witht he clusters...

      ievent++;
    }

}
예제 #14
0
파일: recTPC.C 프로젝트: alisw/AliRoot
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);
}
예제 #15
0
파일: g4menu.C 프로젝트: alisw/AliRoot
void MakeGeometry()
{  
  AliCDBManager* man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  man->SetRun(1);

  // MC application initialization
  TString configFileName = "$ALICE_ROOT/macros/g4ConfigGeometry.C";
  gROOT->LoadMacro(configFileName.Data());
  gInterpreter->ProcessLine(gAlice->GetConfigFunction());
  gAlice->GetMCApp()->Init();
  
  // Generate geometry file
  //
  gGeoManager->Export("geometry.root");
  
  cout << endl
       << "Geometry file geometry.root has been generated." << endl
       << "You have to re-run aliroot and choose Run in g4menu." << endl;
       
  exit(0);     
}    
예제 #16
0
void getT0RecoParam(Int_t run)
{
  
  // Read calibration coefficients into the Calibration DB
  // Arguments:
  AliCDBManager* man = AliCDBManager::Instance();
   man->SetDefaultStorage("raw://");
  //  man->SetDefaultStorage("local:///home/alla/alice/Jul14/OCDB/");
  man->SetRun(run);
  AliCDBEntry *entry = AliCDBManager::Instance()->Get("T0/Calib/RecoParam");
  AliT0RecoParam* recoParam = 0x0;
  cout<<" entry "<< entry<<endl;
  if(entry) {
    // load recoParam according OCDB content (single or array)
    //    if (!(recoParam = dynamic_cast<AliT0RecoParam*>(entry->GetObject()))) {
    
    TObjArray* recoParamArray = static_cast<TObjArray*>(entry->GetObject());     
    cout<<" TObjArray* recoParamArray "<<recoParamArray->GetEntriesFast()<<endl;
    for(Int_t ie = 0; ie < recoParamArray->GetEntriesFast()-1; ie++) {
      
      recoParam = static_cast<AliT0RecoParam*>(recoParamArray->UncheckedAt(ie));	
      cout<<ie<<endl;
      cout<<" eq "<<recoParam->GetEq()<<endl;
      //	 recoParam->Dump();
      cout<<" cfd range "<<recoParam->GetLow(300)<<" amplitude "<<recoParam->GetLow(200)<<" "<<recoParam->GetHigh(200)<<endl;
      
      for (int i=0; i<500; i++) 
	if( recoParam->GetLow(i) !=0) cout<<i<<" low "<<recoParam->GetLow(i)<<"   "<<endl;
      for (int i=0; i<500; i++) 
	if( recoParam->GetHigh(i) !=50000)  cout<<i<<" high "<<recoParam->GetHigh(i)<<endl;
      recoParam = 0x0;
    }
  }
  else 
    cout<<" no entry "<<endl;
  
  
}
예제 #17
0
파일: AliPMDRec.C 프로젝트: alisw/AliRoot
void AliPMDRec()
{
  // This macro for the full reconstruction chain. Only PMD is ON.
  //
  AliCDBManager * man = AliCDBManager::Instance();
  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  man->SetRun(0);


  Int_t firstEvent = 0;
  Int_t lastEvent = 1;

  AliReconstruction rec;
  rec.SetRunReconstruction("PMD");
  rec.SetRunVertexFinder(kFALSE);
  rec.SetFillESD("PMD");
  rec.SetFillTriggerESD(kFALSE);

  //  rec.Run("./");
  //  rec.Run("raw.date");
  rec.Run("raw_6b_61.root",firstEvent,lastEvent);

}
예제 #18
0
TH1F *
CheckEnabledChannels(Int_t run, Bool_t checkROEff = kTRUE, const Char_t *dbString = "raw://")
{

  /* init */
  AliCDBManager *cdb = AliCDBManager::Instance();
  cdb->SetDefaultStorage(dbString);
  cdb->SetRun(run);
  AliTOFcalib calib;
  calib.Init();

  TH2F *hEnabledMap = new TH2F("hEnabledMap", "Enabled channel map;sector;strip", 72, 0., 18., 91, 0., 91.);
  TH1F *hEnabledFlag = new TH1F("hEnabledFlag", "Enabled channel flag;index;flag", 157248, 0., 157248.);

  AliTOFcalibHisto calibhisto;
  calibhisto.LoadCalibHisto();
  calibhisto.LoadCalibStat(); /* temp */

  Int_t sector, sectorStrip, padx, fea;
  Float_t hitmapx, hitmapy;
  /* loop over channels */
  for (Int_t ich = 0; ich < 157248; ich++) {
    if (!calib.IsChannelEnabled(ich, checkROEff)) continue;
    sector = calibhisto.GetCalibMap(AliTOFcalibHisto::kSector, ich);
    sectorStrip = calibhisto.GetCalibMap(AliTOFcalibHisto::kSectorStrip, ich);
    padx = calibhisto.GetCalibMap(AliTOFcalibHisto::kPadX, ich);
    fea = padx / 12;
    hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.;
    hitmapy = sectorStrip;
    hEnabledMap->Fill(hitmapx, hitmapy);
    hEnabledFlag->SetBinContent(ich + 1, 1);
  }
  
  hEnabledMap->DrawCopy("colz");
  return hEnabledFlag;

}
예제 #19
0
void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/FullMisAlignment", Bool_t partialGeom=kFALSE){
   // Make full misalignment objects for all detectors
  // Pass different "CDBstorage" argument if needed (e.g. to fill
  // conditions' data base on alien) or set it to null string to have
  // the objects saved locally on file 
  // This macro defines the default name and place for the detector-macros
  // in charge of producing the full misalignment objects as 
  // $ALICE_ROOT/DET/MakeDETFullMisAlignment.C
  //
  const char* macroname="MakeAllDETsFullMisAlignment.C";

  TString strStorage(CDBstorage);
  if(strStorage.IsNull()){
    gSystem->Setenv("TOCDB","kFALSE");
  }else{  
    gSystem->Setenv("TOCDB","kTRUE");
    gSystem->Setenv("STORAGE",strStorage.Data());
    gSystem->Setenv("ARVERSION",ALIROOT_VERSION);
  }
  if(partialGeom){
    gSystem->Setenv("REALSETUP","kTRUE");
  }else{
    gSystem->Setenv("REALSETUP","kFALSE");
  }

  // Load geometry from CDB updating it if we are producing the
  // alignment objects for the CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  
  if(strStorage.IsNull()){ //if we produce the objects into a file
    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
  }else{ // if we produce the objects in a CDB storage
    // update geometry in it
    Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data());
    gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C");
    if(partialGeom){
      UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config_PDC06.C");
    }else{
      UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config.C");
    }
    // load the same geometry from given CDB storage
    AliCDBPath path("GRP","Geometry","Data");
    AliCDBStorage* storage = cdb->GetStorage(strStorage.Data());
    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
    if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
    entry->SetOwner(0);
    TGeoManager* geom = (TGeoManager*) entry->GetObject();
    if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
    AliGeomManager::SetGeometry(geom);
  }
   
  // run macro for non-sensitive modules
  // (presently generates only FRAME alignment objects)
  gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTFullMisAlignment.C");

  // run macros for sensitive modules
  TString sModules="ACORDE,EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
  TObjArray *detArray = sModules.Tokenize(',');
  TIter iter(detArray);
  TObjString *ostr;
  TString exec_det_macro;

  while((ostr = (TObjString*) iter.Next())){
    TString str(ostr->String());
    exec_det_macro="aliroot -b -q $ALICE_ROOT/";
    exec_det_macro+=str;
    exec_det_macro+="/Make";
    exec_det_macro+=str;
    exec_det_macro+="FullMisAlignment.C";
    
    gSystem->Exec(exec_det_macro.Data());
  }

  return;
}
예제 #20
0
//_________________________________________________________________________________________________
void OccupancyInTimeBins(const char* input, const char* output)
{
  timeResolutions.push_back(1);
  timeResolutions.push_back(10);
  timeResolutions.push_back(100);
  
  AliRawReader* rawReader = AliRawReader::Create(input);
  
  AliMUONRawStreamTrackerHP stream(rawReader);
  
  stream.DisableWarnings();
  stream.TryRecover(kTRUE);
  
  int numberOfUsedEvents(0);
  int numberOfBadEvents(0);
  int numberOfEvents(0);
  int numberOfPhysicsEvent(0);
  int numberOfCalibrationEvent(0);
  int numberOfEventsWithMCH(0);
  int numberOfEventsWithoutCDH(0);
  
  int runNumber(-1);
  
  time_t runStart, runEnd;
  AliMergeableCollection* hc(0x0);
  
  AliCDBManager* cdbm = AliCDBManager::Instance();
  
  if (!cdbm->IsDefaultStorageSet())
  {
    cdbm->SetDefaultStorage("local:///cvmfs/alice-ocdb.cern.ch/calibration/data/2015/OCDB");
  }
  
  cdbm->SetRun(0);
  
  AliMpCDB::LoadAll();


  while (rawReader->NextEvent() ) //&& numberOfEvents < 1000 )
  {
    rawReader->Reset();
    ++numberOfEvents;
    
    if ( !rawReader->GetDataHeader() )
    {
      ++numberOfEventsWithoutCDH;
    }
    
    if (rawReader->GetType() != AliRawEventHeaderBase::kPhysicsEvent)
    {
      if ( rawReader->GetType() == AliRawEventHeaderBase::kCalibrationEvent )
      {
        ++numberOfCalibrationEvent;
      }
      continue;
    }
    
    if (runNumber<0)
    {
      runNumber = rawReader->GetRunNumber();
      GetTimeRange(runNumber,runStart,runEnd);

      hc = new AliMergeableCollection("occ");
      
      for ( std::vector<int>::size_type is = 0; is < timeResolutions.size(); ++is )
      {
        FillCollection(*hc,runStart,runEnd,timeResolutions[is]);
      }
      
      FillNumberOfPads(*hc);
      
    }
    
    ++numberOfPhysicsEvent;
    
    if ( numberOfPhysicsEvent % 5000 == 0 )
      cout << Form("%12d events processed : %12d physics %d used ones %d bad ones [ %d with MCH information ]",
                   numberOfEvents,numberOfPhysicsEvent,numberOfUsedEvents,numberOfBadEvents,numberOfEventsWithMCH) << endl;
    
    Bool_t mchThere(kFALSE);
    
    for ( int iDDL = 0; iDDL < AliDAQ::NumberOfDdls("MUONTRK") && !mchThere; ++iDDL )
    {
      rawReader->Reset();
      rawReader->Select("MUONTRK",iDDL,iDDL);
      if (rawReader->ReadHeader() )
      {
        if (rawReader->GetEquipmentSize() ) mchThere = kTRUE;
      }
    }
    
    if ( mchThere)
    {
      ++numberOfEventsWithMCH;
    }
    else
    {
      continue;
    }
    
    Int_t buspatchId;
    UShort_t  manuId;
    UChar_t manuChannel;
    UShort_t adc;
    
    stream.First();
    
    std::map<int,int> bpValues;
    
    while ( stream.Next(buspatchId,manuId,manuChannel,adc,kTRUE) )
    {
      bpValues[buspatchId]++;
    }
    
    for ( std::map<int,int>::const_iterator it = bpValues.begin(); it != bpValues.end(); ++it )
    {
      const int& buspatchId = it->first;
      const int& bpvalue = it->second;
      
      TString bpName = Form("BP%04d",buspatchId);
      
      for ( std::vector<int>::size_type is = 0; is < timeResolutions.size(); ++is )
      {
        TH1* h = hc->Histo(Form("/BUSPATCH/HITS/%ds/%s",timeResolutions[is],bpName.Data()));
        
        if (!h)
        {
          cout << "histogram not found" << endl;
          continue;
        }
        
        h->Fill(rawReader->GetTimestamp(),bpvalue);
      }
    }
    
    for ( std::vector<int>::size_type is = 0; is < timeResolutions.size(); ++is )
    {
      TH1* h = hc->Histo(Form("Nevents%ds",timeResolutions[is]));
      
      if (!h)
      {
        cout << "histogram not found" << endl;
        continue;
      }
      
      h->Fill(rawReader->GetTimestamp());
    }
    
  }
  
  // Group BP histograms per DE then DDL then Chamber then Station
  
  for ( std::vector<int>::size_type is = 0; is < timeResolutions.size(); ++is )
  {
    GroupByDE(*hc,timeResolutions[is]);
    GroupByDDL(*hc,timeResolutions[is]);
    GroupByChamber(*hc,timeResolutions[is]);
    GroupByStation(*hc,timeResolutions[is]);
  }
  
  // make normalized versions of the histograms
  Normalize(*hc);
  
  TFile* fout = new TFile(output,"RECREATE");
  hc->Write("occ");
  delete fout;
}
예제 #21
0
///
/// Main method
///
/// \param year: year to set geometry and run range
/// \param printAll: verbosity checks 
///
void SetOCDBFromRun1(Int_t year = 2010, Bool_t printAll = kFALSE)
{  
  TGrid::Connect("alien://");
  
  Int_t run = 182325; //2012
  if(year == 2010) run = 134908;
  if(year == 2011) run = 159582;
  
  AliCDBManager* man = AliCDBManager::Instance();
  man->SetDefaultStorage("raw://");
  man->SetRun(run);
  AliCDBStorage *storage = man->GetDefaultStorage();
  
  // Instantiate EMCAL geometry for the first time
  AliEMCALGeometry * geom;
  if     (year == 2010) geom = AliEMCALGeometry::GetInstance("EMCAL_FIRSTYEARV1"); // 2010
  else                  geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");  // 2011-2012-2013
//else                  geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1_DCAL_8SM"); // Run2

  const Int_t nSM = geom->GetNumberOfSuperModules();
  
  // Get the final OCDB object
  
  AliEMCALCalibData* cparam = (AliEMCALCalibData*) (storage->Get("EMCAL/Calib/Data", run)->GetObject());

  // Access OCDB file with the first version of the calibration
  TString        first = "Run177115_999999999_v2_s0.root";
  if(year==2010) first = "Run113461_999999999_v3_s0.root";
  if(year==2011) first = "Run144484_999999999_v3_s0.root";
  
  TFile * f = TFile::Open(Form("alien:///alice/data/%d/OCDB/EMCAL/Calib/Data/%s",year,first.Data()),"READ");
  AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
  AliEMCALCalibData* cparam1 = (AliEMCALCalibData*)  cdb->GetObject();
  
  // New OCDB container
  AliEMCALCalibData *cparamnew=new AliEMCALCalibData("EMCAL");
  
  // Do the comparison
  Float_t param  = -1;
  Float_t param1 = -1;
  Int_t iCol = -1, iRow = -1, iSM =-1, iMod = -1,iIphi =-1,iIeta = -1;
  for(Int_t i=0;i < nSM*24*48; i++)
  {
    //printf("AbsID %d\n",i);
    geom->GetCellIndex(i,iSM,iMod,iIphi,iIeta);
    geom->GetCellPhiEtaIndexInSModule(iSM,iMod, iIphi, iIeta,iRow,iCol);
    
    Float_t param = -1;
    if( cparam  ) param  = cparam ->GetADCchannel(iSM,iCol,iRow);
    
    Float_t param1 = -1;
    if( cparam1 ) param1 = cparam1->GetADCchannel(iSM,iCol,iRow);
    
    if    (printAll)
      printf("ID %d, col %d, row %d, sm %d  final %1.4f, first %1.4f\n",
             i,iCol,iRow,iSM,param, param1);
    cparamnew->SetADCchannel      (iSM,iCol,iRow,param );
    cparamnew->SetADCchannelOnline(iSM,iCol,iRow,param1);
  }
  
  // Create OCDB File
  AliCDBMetaData md;
  md.SetComment("Calibration after calibration with pi0, store also first online calibration");
  md.SetBeamPeriod(0);
  md.SetResponsible("Gustavo Conesa");
  md.SetAliRootVersion(gSystem->Getenv("ARVERSION"));
  
  // Careful, select here the first run where this calibration is valid
  Int_t            firstRun = 172439; // 2012-13
  if(year == 2010) firstRun = 113461;
  if(year == 2011) firstRun = 144484;
  
  AliCDBId id("EMCAL/Calib/Data",firstRun,AliCDBRunRange::Infinity()); // create in EMCAL/Calib/Data DBFolder
  
  AliCDBManager* man2 = AliCDBManager::Instance();
  AliCDBStorage* loc = man2->GetStorage(Form("local://%d",year));
  loc->Put(cparamnew, id, &md);
}
예제 #22
0
void MakeTRDFullMisAlignment(){
  // Create TClonesArray of full misalignment objects for TRD
  // Expects to read objects for FRAME
  // 
  TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
  const char* macroname = "MakeTRDFullMisAlignment.C";

  // Activate CDB storage and load geometry from CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  
  AliCDBStorage* storage;
  TString Storage;
  
  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
    Storage = gSystem->Getenv("STORAGE");
    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
      return;
    }
    storage = cdb->GetStorage(Storage.Data());
    if(!storage){
      Error(macroname,"Unable to open storage %s\n",Storage.Data());
      return;
    }
    AliCDBPath path("GRP","Geometry","Data");
    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
    entry->SetOwner(0);
    TGeoManager* geom = (TGeoManager*) entry->GetObject();
    AliGeomManager::SetGeometry(geom);
  }else{
    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
  }    
		  
  // load FRAME full misalignment objects (if needed, the macro
  // for FRAME has to be ran in advance) and apply them to geometry
  AliCDBPath fpath("GRP","Align","Data");
  AliCDBEntry *eFrame;
  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
    Info(macroname,"Loading FRAME alignment objects from CDB storage %s",
      Storage.Data());
    eFrame = storage->Get(fpath.GetPath(),cdb->GetRun());
  }else{
    eFrame = cdb->Get(fpath.GetPath());
  }
  if(!eFrame) Fatal(macroname,"Could not get the specified CDB entry!");
  TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject();
  arFrame->Sort();
  Int_t nvols = arFrame->GetEntriesFast();
  Bool_t flag = kTRUE;
  for(Int_t j=0; j<nvols; j++)
  {
    AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
    if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
  }
  if(!flag) Fatal(macroname,"Error in the application of FRAME objects");

  // Sigmas for the chambers
  Double_t smdx    = 0.3; // 3 mm
  Double_t smdy    = 0.3; // 3 mm
  Double_t smdz    = 0.3; // 3 mm
  Double_t smrx    = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
  Double_t smry    = 2.0 / 1000.0 / TMath::Pi()*180; // 2.0 mrad
  Double_t smrz    = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
  // Truncation for the chambers
  Double_t cutSmdx = 3.0 * smdx;
  Double_t cutSmdy = 3.0 * smdy;
  Double_t cutSmdz = 3.0 * smdz;

  // Sigmas for the chambers
  Double_t chdx    = 0.05;  // 0.5 mm
  Double_t chdy    = 0.1;   // 1.0 mm
  Double_t chdz    = 0.007; // 70  microns
  Double_t chrx    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chry    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chrz    = 0.3    / 1000.0 / TMath::Pi()*180; // 0.3 mrad
  // Truncation for the chambers
  Double_t cutChdx = 1.0  * chdx;
  Double_t cutChdy = 1.0  * chdy;
  Double_t cutChdz = 0.14 * chdz;

  Int_t sActive[18]={1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1};
  Double_t dx,dy,dz,rx,ry,rz;

  Int_t j=0;
  UShort_t volid;
  const char *symname;

  // create the supermodules' alignment objects
  for (int iSect; iSect<18; iSect++) {
    TString sm_symname(Form("TRD/sm%02d",iSect));
    dx = AliMathBase::TruncatedGaus(0.0,smdx,cutSmdx); 
    dy = AliMathBase::TruncatedGaus(0.0,smdy,cutSmdy); 
    dz = AliMathBase::TruncatedGaus(0.0,smdz,cutSmdz); 
    rx = gRandom->Rndm() * 2.0*smrx - smrx;
    ry = gRandom->Rndm() * 2.0*smry - smry;
    rz = gRandom->Rndm() * 2.0*smrz - smrz;
    if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
    new((*array)[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kFALSE);
  }
  // apply supermodules' alignment objects
  Int_t smCounter=0;
  for(Int_t iSect=0; iSect<18; iSect++){
    if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
    AliAlignObjParams* smobj =
      (AliAlignObjParams*)array->UncheckedAt(smCounter++);
    if(!smobj->ApplyToGeometry()){
      Fatal(macroname,Form("application of full misalignment object for sector %d failed!",iSect));
      return;
    }
  }

  // create the chambers' alignment objects
  ran = new TRandom(4357);
  Int_t chId;
  for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
    chId=-1;
    for (Int_t iSect = 0; iSect < 18; iSect++){
      for (Int_t iCh = 0; iCh < 5; iCh++) {
        dx = AliMathBase::TruncatedGaus(0.0,chdx,cutChdx); 
        dy = AliMathBase::TruncatedGaus(0.0,chdy,cutChdy); 
        dz = AliMathBase::TruncatedGaus(0.0,chdz,cutChdz); 
        rx = gRandom->Rndm() * 2.0*chrx - chrx;
        ry = gRandom->Rndm() * 2.0*chry - chry;
        rz = gRandom->Rndm() * 2.0*chrz - chrz;
        chId++;
        if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue;
        volid = AliGeomManager::LayerToVolUID(iLayer,chId);
        if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
        symname = AliGeomManager::SymName(volid);
        new((*array)[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
      }
    }
  }

  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
    // save on file
    const char* filename = "TRDfullMisalignment.root";
    TFile f(filename,"RECREATE");
    if(!f){
      Error(macroname,"cannot open file for output\n");
      return;
    }
    Info(macroname,"Saving alignment objects to the file %s", filename);
    f.cd();
    f.WriteObject(array,"TRDAlignObjs","kSingleKey");
    f.Close();
  }else{
    // save in CDB storage
    Info(macroname,"Saving alignment objects in CDB storage %s",
	 Storage.Data());
    AliCDBMetaData* md = new AliCDBMetaData();
    md->SetResponsible("Dariusz Miskowiec");
    md->SetComment("Full misalignment for TRD");
    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
    AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();
}
예제 #23
0
//_____________________________________________________________________________
void RunPerformanceTrain(Char_t *file="esd.root", Int_t runNumber = 2, const char* triggerClass ="CINT1B-ABCE-NOPF-ALL", Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t bGrid=kFALSE)
{
  //
  // Grid settings
  // use GSI::SE
  if(bGrid) {
    gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE");
    TGrid * alien = TGrid::Connect("alien://",0,0,"t");
    gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE");
  }

  //
  // Train Configuration
  //
  Int_t       iPWGPPperfTPC       = 1;      // Test TPC performance
  Int_t       iPWGPPperfTRD       = 0;      // Test TRD performance
  Int_t       iPWGPPperfITS       = 0;      // Test ITS performance
  Int_t       iPWGPPperfCalo      = 0;      // Test Calo performance
  Int_t       iPWGPPperfMuonTrig  = 0;      // Test Muon Trigger performance
  Int_t       iPWGPPperfMuonEff   = 0;      // Test Muon Efficiency performance
  Int_t       iPWGPPperfTOF       = 0;      // Test TOF-TPC matching performance
  Int_t       iPWGPPperfPrimVertex = 0;     // Test Primary Vertex performance
  Int_t       iPWGPPv0QA          = 0;      // V0 algorithm QA task

  //
  // Load Libraries
  //
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libTender");
  gSystem->Load("libCORRFW");

  gSystem->Load("libTPCcalib");
  gSystem->Load("libPWGPP");

  gSystem->Load("libPHOSUtils");
  gSystem->Load("libEMCALUtils");
  gSystem->Load("libPWG4PartCorrBase");
  gSystem->Load("libPWG4PartCorrDep");

  gSystem->Load("libPWGmuon"); // The class is here

  //
  // OCDB Configuration 
  //
  AliCDBManager *cdbManager = AliCDBManager::Instance();
  cdbManager->SetDefaultStorage("local:///lustre/alice/alien/alice/data/2009/OCDB");
  //cdbManager->SetDefaultStorage("local://$ALICE_PHYSICS/OCDB");
  //cdbManager->SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
  cdbManager->SetRun(runNumber);
  //cdbManager->SetCacheFlag(kFALSE);
  // initialize magnetic field from the GRP manager.
  //if(magField==0) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 0., 0., AliMagF::k2kG));
  //if(magField==1) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k2kG));
  //if(magField==2) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));

  /*
  AliGRPManager grpMan;
  grpMan.ReadGRPEntry();
  grpMan.SetMagField();
  AliRunInfo *runInfo = grpMan.GetRunInfo();
 
  //
  // Load geometry
  //
  */
  AliGeomManager::LoadGeometry();

  //
  // Swtich off all AliInfo (too much output!)
  //
  AliLog::SetGlobalLogLevel(AliLog::kError);

  //
  // Create input ESD chain
  //
  /*
  gROOT->LoadMacro("$ALICE_PHYSICS/PWG0/CreateESDChain.C");
  TChain* chain = CreateESDChain(list,nFiles,fistFile);
  if(!chain) { 
    Error("RunPerformanceTrain","ESD chain not created!");
    return;
  }
  */
  TChain  *chain = new TChain("esdTree");
  if(!chain) { 
    Error("RunPerformanceTrain","ESD chain not created!");
    return;
  }
  chain->Add(file);
  chain->Lookup();

  //
  // Create analysis manager
  //
  AliAnalysisManager *mgr = new AliAnalysisManager;
  if(!mgr) { 
    Error("RunPerformanceTrain","AliAnalysisManager not set!");
    return;
  }

  //
  // Set ESD input handler
  //
  AliESDInputHandler* esdH = new AliESDInputHandler;
  if(!esdH) { 
    Error("RunPerformanceTrain","AliESDInputHandler not created!");
    return;
  }
  if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(esdH);

  /*
  //
  // Set RecPoints and ESD input handler
  //
  AliESDInputHandlerRP* rpH = new AliESDInputHandlerRP;
  if(!rpH) { 
    Error("RunPerformanceTrain","AliESDInputHandlerRP not created!");
    return;
  }
  if(bUseESDfriend) rpH->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(rpH);
  */

  //
  // Set MC input handler
  //
  if(bUseMCInfo) {
    AliMCEventHandler* mcH = new AliMCEventHandler;
    if(!mcH) { 
      Error("RunPerformanceTrain","AliMCEventHandler not created!");
      return;
    }
    mcH->SetReadTR(kTRUE);
    mgr->SetMCtruthEventHandler(mcH);
  }


  //
  // Add task to AliAnalysisManager
  //

  //
  // TPC performance
  //
  if(iPWGPPperfTPC) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskPerformanceTPC.C");
    AliPerformanceTask *tpcQA = AddTaskPerformanceTPC(bUseMCInfo,bUseESDfriend,triggerClass);
    if(!tpcQA) { 
      Error("RunPerformanceTrain","AliPerformanceTask not created!");
      return;
    }
  } 
  else {
    Printf("RunPerformanceTrain: TPC Performance - EXCLUDED!");
  }
  //
  // TRD perormance
  //
  if(iPWGPPperfTRD) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTrainPerformanceTRD.C");
    if(!AddTrainPerformanceTRD(bUseMCInfo,bUseESDfriend)) { 
      Error("RunPerformanceTrain","TrainPerformanceTRD not created!");
      return;
    }
  } else {
    Printf("RunPerformanceTrain: TRD TrainPerformanceTRD - EXCLUDED!");
  }
  //
  // ITS performance
  //
  if(iPWGPPperfITS) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskPerformanceITS.C");
    AliAnalysisTaskITSTrackingCheck *itsQA = AddTaskPerformanceITS(bUseMCInfo);
    if(!itsQA) { 
      Error("RunPerformanceTrain","AliAnalysisTaskITSTrackingCheck not created!");
      return;
    }
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskITSTrackingCheck - EXCLUDED!");
  }
  //
  // Calorimeter Performance
  //
  if(iPWGPPperfCalo) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWG4/macros/AddTaskCalorimeterQA.C");
    AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD",bUseMCInfo,kFALSE);
    if(!taskCaloQA) { 
      Error("RunPerformanceTrain","AliAnalysisTaskParticleCorrelation not created!");
      return;
    }
    mgr->AddTask(taskCaloQA);
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskParticleCorrelation - EXCLUDED!");
  }
  //
  // Muon Trigger
  //
  if(iPWGPPperfMuonTrig) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
    AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
    if(!taskMuonTrig) { 
      Error("RunPerformanceTrain","AliAnalysisTaskTrigChEff not created!");
      return;
    }
    mgr->AddTask(taskMuonTrig);
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskTrigChEff - EXCLUDED!");
  }
  //
  // Muon Efficiency
  //
  if(iPWGPPperfMuonEff) {
  gROOT->LoadMacro("$ALICE_PHYSICS/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
  AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AliAnalysisTaskMuonTrackingEff();
  if(!taskMuonTrackEff) { 
     Error("RunPerformanceTrain","AliAnalysisTaskMuonTrackingEff not created!");
     return;
  }
  mgr->AddTask(taskMuonTrackEff);
  } 
  else {
    Printf("RunPerformanceTrain: Muon Efficiency - EXCLUDED!");
  }
  //
  // TOF performance
  //
  if(iPWGPPperfTOF) {
  //
  } 
  else {
    Printf("RunPerformanceTrain: TOF - EXCLUDED!");
  }
  //
  // PWGPP Primary Vertex
  //
  if(iPWGPPperfPrimVertex) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskVertexESD.C");
    AliAnalysisTaskVertexESD *taskPrimVertex = AddTaskVertexESD();
    if(!taskPrimVertex) { 
      Error("RunPerformanceTrain","AliAnalysisTaskVertexESD not created!");
      return;
    }
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskVertexESD - EXCLUDED!");
  }
  //
  // PWGPP V0 QA
  //
  if (iPWGPPv0QA) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskV0QA.C");
    AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(bUseMCInfo);
    if(!taskv0QA) {
      Error("RunPerformanceTrain","AliAnalysisTaskV0QA not created!");
      return;
    }    
  }
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskV0QA - EXCLUDED!");
  }

  //
  // Disable debug printouts
  //
  mgr->SetDebugLevel(0);

  if (!mgr->InitAnalysis())
    return;

  mgr->PrintStatus();
  //mgr->StartAnalysis("local",chain, nEvents, firstEvent);
  mgr->StartAnalysis("local",chain);
}
예제 #24
0
Int_t retreiveCalibrationData(Int_t fRunNumber)
{
    AliCDBManager * man = AliCDBManager::Instance() ;
    man->SetDefaultStorage("raw://") ;
    //man->SetDefaultStorage("local://$ALICE_ROOT/OCDB") ;
    man->SetRun(fRunNumber) ;
    AliCDBEntry * bmEntry =  man->Get("PHOS/Calib/EmcBadChannels/") ;

    // Get the BCM for PHOS
    phosBcm = (AliPHOSEmcBadChannelsMap*)bmEntry->GetObject();
    if (!phosBcm)
    {
        std::cerr << "ERROR: Could not get the bad channel map for PHOS" << std::endl;
    }
    else
    {
        Int_t *tmpList = new Int_t[phosBcm->GetNumOfBadChannels()];
        phosBcm->BadChannelIds(tmpList);
        badChannels.resize(0);
        for(Int_t n = 0; n < phosBcm->GetNumOfBadChannels(); n++)
        {
            badChannels.push_back(tmpList[n]);
        }
    }

    // Get the gains for PHOS
    AliCDBPath path("PHOS","Calib","EmcGainPedestals");
    if (path.GetPath())
    {
        AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);
        if (pEntry)
        {
            phosCalibData = (AliPHOSEmcCalibData*)pEntry->GetObject();

            if (!phosCalibData)
            {
                std::cerr << "ERROR: Could not get calibration data for PHOS" << std::endl;
                return -1;
            }
        }
        else
        {
            std::cerr << "ERROR:  Could not get CDB entry for PHOS calib data" << std::endl;
            return -1;
        }
    }
    AliCDBPath geompath("GRP","Geometry","Data");
    TGeoManager *geoManager = 0;
    if(path.GetPath())
    {
        //      HLTInfo("configure from entry %s", path.GetPath());
        AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(geompath/*,GetRunNo()*/);

        if (pEntry)
        {
            if(geoUtils)
            {
                delete geoUtils;
                geoUtils = 0;
            }
            if(!geoManager) geoManager = (TGeoManager*) pEntry->GetObject();

            if(geoManager)
            {
                geoUtils = new AliPHOSGeoUtils("PHOS", "noCPV");
                geom = new AliPHOSGeometry("PHOS", "noCPV");
            }
            else
            {
                std::cerr << "can not get gGeoManager from OCDB" << std::endl;
            }
        }
        else
        {
            std::cerr << "can not fetch object " <<  path.GetPath().Data() << " from OCDB" << std::endl;
        }
    }
    AliCDBPath recoPath("PHOS", "Calib", "RecoParam");

    if(recoPath.GetPath())
    {
//      HLTInfo("configure from entry %s", path.GetPath());
        AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(recoPath/*,GetRunNo()*/);
        if (pEntry)
        {

            TObjArray *paramArray = dynamic_cast<TObjArray*>(pEntry->GetObject());
            if(paramArray)
            {
                recoParam = dynamic_cast<AliPHOSRecoParam*>((paramArray)->At(0));
            }
            if(!recoParam)
            {
                std::cerr << "can not fetch object reconstruction parameters from " <<  recoPath.GetPath().Data() << std::endl;;
                return -1;
            }
        }
        else
        {
            std::cerr << "can not fetch object " << recoPath.GetPath().Data() <<  " from OCDB" << std::endl;
            return -1;
        }
    }
        createBadChannelMap();

    return 0;
}
예제 #25
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");
  
    

 
}
예제 #26
0
//______________________________________________________________________________
void CopyCDB(Int_t runnr, const char* fromURI, const char* toURI)
{
  TString allowedObjects;

//  allowedObjects += " HLT/ConfigMUON/DecisionComponent";
//  allowedObjects += " HLT/ConfigMUON/FieldIntegrals";
//  allowedObjects += " HLT/ConfigMUON/HitReconstructor";
//  allowedObjects += " HLT/ConfigMUON/MansoTrackerFSM";
//  allowedObjects += " HLT/ConfigMUON/TriggerReconstructor";
  
  /*
   
  allowedObjects += " GRP/Geometry/Data";
  allowedObjects += " GRP/CTP/Config";
  allowedObjects += " GRP/GRP/LHCData";
  allowedObjects += " GRP/CTP/Scalers";
  allowedObjects += " GRP/GRP/Data";
  allowedObjects += " GRP/Calib/MeanVertexSPD";
  allowedObjects += " GRP/CTP/Aliases";

  allowedObjects += " MUON/Calib/GlobalTriggerCrateConfig";
  allowedObjects += " MUON/Calib/LocalTriggerBoardMasks";
  allowedObjects += " MUON/Calib/MappingData";
  allowedObjects += " MUON/Calib/RegionalTriggerConfig";
  allowedObjects += " MUON/Calib/TriggerLut";
   
  allowedObjects += " MUON/Calib/Config";
  allowedObjects += " MUON/Calib/Gains";
  allowedObjects += " MUON/Calib/GlobalTriggerCrateConfig";
  allowedObjects += " MUON/Calib/HV";
  allowedObjects += " MUON/Calib/LocalTriggerBoardMasks";
  allowedObjects += " MUON/Calib/MappingRunData";
  allowedObjects += " MUON/Calib/Neighbours";
  allowedObjects += " MUON/Calib/OccupancyMap";
  allowedObjects += " MUON/Calib/Pedestals";
  allowedObjects += " MUON/Calib/RecoParam";
  allowedObjects += " MUON/Calib/RegionalTriggerConfig";
  allowedObjects += " MUON/Calib/RejectList";
  allowedObjects += " MUON/Calib/TriggerDCS";
  allowedObjects += " MUON/Calib/TriggerEfficiency";
  allowedObjects += " MUON/Calib/TriggerLut";
  allowedObjects += " MUON/Calib/MappingData";

  allowedObjects += " MUON/Align/Data";

  allowedObjects += " GRP/Align/Data";
  allowedObjects += " ITS/Align/Data";
  allowedObjects += " VZERO/Align/Data";
  allowedObjects += " FMD/Align/Data";  
  allowedObjects += " T0/Align/Data";
  allowedObjects += " TPC/Align/Data";
  allowedObjects += " TRD/Align/Data";
  allowedObjects += " TOF/Align/Data";
  allowedObjects += " ACORDE/Align/Data";

  allowedObjects += " HLT/Calib/esdLayout";
  allowedObjects += " HLT/Calib/RecoParam";
  allowedObjects += " HLT/Calib/StreamerInfo";
  allowedObjects += " PHOS/Align/Data";
  allowedObjects += " EMCAL/Align/Data";
  allowedObjects += " HMPID/Align/Data";
   allowedObjects += " ZDC/Align/Data";
   allowedObjects += " PMD/Align/Data";
   
   
  
  allowedObjects += " GRP/Calib/MeanVertexTPC";
  allowedObjects += " GRP/Calib/CosmicTriggers";
  allowedObjects += " GRP/Calib/LHCClockPhase";
  allowedObjects += " GRP/CTP/CTPtiming";
  allowedObjects += " GRP/CTP/TimeAlign";
  allowedObjects += " GRP/Calib/RecoParam";
  allowedObjects += " GRP/CTP/Aliases";

  allowedObjects += " ITS/Calib/RecoParam";
  allowedObjects += " ITS/Calib/SPDNoisy";
  allowedObjects += " ITS/Calib/SPDDead";
  allowedObjects += " ITS/Calib/SPDSparseDead";
  allowedObjects += " ITS/Calib/CalibSDD";
  allowedObjects += " ITS/Calib/RespSDD";
  allowedObjects += " ITS/Calib/DriftSpeedSDD";
  allowedObjects += " ITS/Calib/DDLMapSDD";
  allowedObjects += " ITS/Calib/MapsTimeSDD";
  allowedObjects += " ITS/Calib/NoiseSSD";
  allowedObjects += " ITS/Calib/GainSSD";
  allowedObjects += " ITS/Calib/BadChannelsSSD";
  allowedObjects += " ITS/Calib/SPDFOEfficiency";
  
  allowedObjects += " ITS/Calib/SPDFONoise";
  
  allowedObjects += " TRIGGER/SPD/PITConditions";
  
  allowedObjects += " AD/Align/Data";
  */
  
  AliCDBManager* cdb = AliCDBManager::Instance();
  // determine dynamically the current year
  TString fromUri(fromURI);
  cdb->SetDefaultStorage(fromUri.Data());
  cdb->SetRun(runnr);
  cdb->SetDrain(toURI);
  TString toUri(toURI);
  
  AliCDBStorage *defaultStorage = cdb->GetDefaultStorage();
  defaultStorage->QueryCDB(runnr);
  TObjArray* allIdsForRun = defaultStorage->GetQueryCDBList();
  TIter next(allIdsForRun);
  AliCDBId* id = 0;
  while ((id = dynamic_cast<AliCDBId*>(next())))
  {
    TString path(id->GetPath());
    if ( !allowedObjects.Contains(path.Data() ) ) continue;

    cdb->Get(path,cdb->GetRun());
  }
  
}
예제 #27
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]");
  //
}
예제 #28
0
void MakeACORDEZeroMisAlignment(){
  // Create TClonesArray of zero misalignment objects for ACORDE
  //
  const char* macroname = "MakeACORDEZeroMisAlignment.C";
  // Activate CDB storage and load geometry from CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  
  AliCDBStorage* storage;
  
  //load geom from local file till ACORDE is not switched on by default in standard config-files
  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
    TString Storage = gSystem->Getenv("STORAGE");
    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
      return;
    }
    storage = cdb->GetStorage(Storage.Data());
    if(!storage){
      Error(macroname,"Unable to open storage %s\n",Storage.Data());
      return;
    }
    
    AliCDBPath path("GRP","Geometry","Data");
    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
    entry->SetOwner(0);
    TGeoManager* geom = (TGeoManager*) entry->GetObject();
    AliGeomManager::SetGeometry(geom);
  }else{
    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
    
  }
  //  AliGeomManager::LoadGeometry("geometry.root");  

  TClonesArray *array = new TClonesArray("AliAlignObjParams",64);
  TClonesArray &alobj = *array;
  
  TRandom *rnd = new TRandom(4321);
  Int_t j = 0;
  Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;

  // RS = local
  // sigma translation 
  // sigma rotation 
  
  TString symname;
  TString basename = "ACORDE/Array";
  Int_t iIndex=0;
  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);

  for (Int_t imod=0; imod<60; imod++){
    symname = basename;
    symname += imod;    
    new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz,dpsi, dtheta, dphi, kFALSE);
  }

  if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
    // save on file
    const char* filename = "ACORDEZeroMisalignment.root";
    TFile f(filename,"RECREATE");
    if(!f){
      Error(macroname,"cannot open file for output\n");
      return;
    }
    Info(macroname,"Saving alignment objects to the file %s", filename);
    f.cd();
    f.WriteObject(array,"ACORDEAlignObjs","kSingleKey");
    f.Close();
  }else{
    // save in CDB storage
    AliCDBMetaData* md = new AliCDBMetaData();
    md->SetResponsible("E. Cuautle & M. Rodriguez");
    md->SetComment("Zero misalignment for ACORDE");
    md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
    AliCDBId id("ACORDE/Align/Data",0,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}
예제 #29
0
void MakeTRDResMisAlignment(){
  // Create TClonesArray of residual misalignment objects for TRD
  //
  const char* macroname = "MakeTRDResMisAlignment.C";
  TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
  TClonesArray &alobj = *array;
   
  // Activate CDB storage and load geometry from CDB
  AliCDBManager* cdb = AliCDBManager::Instance();
  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  cdb->SetRun(0);
  
  AliCDBStorage* storage;
  
  if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
    TString Storage = gSystem->Getenv("STORAGE");
    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
      return;
    }
    storage = cdb->GetStorage(Storage.Data());
    if(!storage){
      Error(macroname,"Unable to open storage %s\n",Storage.Data());
      return;
    }
    AliCDBPath path("GRP","Geometry","Data");
    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
    entry->SetOwner(0);
    TGeoManager* geom = (TGeoManager*) entry->GetObject();
    AliGeomManager::SetGeometry(geom);
  }
  else {
    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
  }    

  // sigmas for the chambers
  Double_t chdx    = 0.002; // 20 microns
  Double_t chdy    = 0.003; // 30 microns
  Double_t chdz    = 0.007; // 70 microns
  Double_t chrx    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chry    = 0.0005 / 1000.0 / TMath::Pi()*180; // 0 mrad
  Double_t chrz    = 0.1    / 1000.0 / TMath::Pi()*180; // 0.1 mrad
  // Truncation for the chambers
  Double_t cutChdx = 3.0  * chdx;
  Double_t cutChdy = 3.0  * chdy;
  Double_t cutChdz = 0.14 * chdz;

  Int_t sActive[18]={1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1};
  Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.;

  Int_t j=0;
  UShort_t volid;
  const char* symname; 

  // create the supermodules' alignment objects
  for (Int_t iSect=0; iSect<18; iSect++) {
    TString sm_symname(Form("TRD/sm%02d",iSect));
    if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
    new((*array)[j++])
      AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE);
  }
 
  // create the chambers' alignment objects
  Int_t chId;
  for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
    chId=-1;
    for (Int_t iSect = 0; iSect < 18; iSect++){
      for (Int_t iCh = 0; iCh < 5; iCh++) {
        dx = AliMathBase::TruncatedGaus(0.0,chdx,cutChdx); 
        dy = AliMathBase::TruncatedGaus(0.0,chdy,cutChdy); 
        dz = AliMathBase::TruncatedGaus(0.0,chdz,cutChdz); 
        rx = gRandom->Rndm() * 2.0*chrx - chrx;
        ry = gRandom->Rndm() * 2.0*chry - chry;
        rz = gRandom->Rndm() * 2.0*chrz - chrz;
        chId++;
        if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue;
        volid = AliGeomManager::LayerToVolUID(iLayer,chId);
        if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue;
        symname = AliGeomManager::SymName(volid);
        new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
      }
    }
  }

  if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
    // save on file
    const char* filename = "TRDresidualMisalignment.root";
    TFile f(filename,"RECREATE");
    if(!f){
      Error(macroname,"cannot open file for output\n");
      return;
    }
    Info(macroname,"Saving alignment objects to the file %s", filename);
    f.cd();
    f.WriteObject(array,"TRDAlignObjs","kSingleKey");
    f.Close();
  }
  else {
    // save in CDB storage
    AliCDBMetaData* md = new AliCDBMetaData();
    md->SetResponsible("Dariusz Miskowiec");
    md->SetComment("Residual misalignment for TRD");
    md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
    AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity());
    storage->Put(array,id,md);
  }

  array->Delete();

}
예제 #30
0
void
PatternCalib(const char* file="raw.root", const char* calib="$(HOME)/calib/", 
	     Int_t runno=0)
{
  // AliLog::SetModuleDebugLevel("FMD", 1);
  gSystem->Load("libFMDutil");

  AliCDBManager* cdb = AliCDBManager::Instance();
  const char* cdbUri = gSystem->Getenv("AMORE_CDB_URI");
  cdb->SetDefaultStorage(cdbUri);
  cdb->SetRun(runno);

  AliFMDCalibStripRange* range = new AliFMDCalibStripRange;
  AliFMDCalibSampleRate* rate  = new AliFMDCalibSampleRate;
  AliFMDCalibPedestal*   peds  = new AliFMDCalibPedestal;
  AliFMDCalibGain*       gains = new AliFMDCalibGain;
  Bool_t gotConds = kFALSE;
  Bool_t gotPeds  = kFALSE;
  Bool_t gotGains = kFALSE;
  for (Int_t i = 1; i <= 3; i++) { 
    TString f;
    if (CheckFile("conditions", calib, i, f)) {
      gotConds = kTRUE;
      std::cout << "Reading conditions for FMD" <<i<< " from " <<f<< std::endl;
      std::ifstream in(f.Data());
      range->ReadFromFile(in);
      rate->ReadFromFile(in);
    }
    if (CheckFile("peds", calib, i, f)) {
      gotPeds = kTRUE;
      std::cout << "Reading pedestals for FMD" <<i<< " from " <<f<< std::endl;
      std::ifstream in(f.Data());
      peds->ReadFromFile(in);
    }
    if (CheckFile("gains", calib, i, f)) {
      gotGains = kTRUE;
      std::cout << "Reading gains for FMD" <<i<< " from " <<f<< std::endl;
      std::ifstream in(f.Data());
      gains->ReadFromFile(in);
    }
  }

  Int_t mask = (AliFMDParameters::kDeadMap|
		AliFMDParameters::kZeroSuppression|
		AliFMDParameters::kAltroMap);


  if (!gotConds) mask |= AliFMDParameters::kStripRange;
  if (!gotConds) mask |= AliFMDParameters::kSampleRate;
  if (!gotPeds)  mask |= AliFMDParameters::kPedestal;
  if (!gotGains) mask |= AliFMDParameters::kPulseGain;

  AliFMDParameters* pars = AliFMDParameters::Instance();
  pars->Init(kFALSE, mask);

  if (gotConds) pars->SetStripRange(range);
  if (gotConds) pars->SetSampleRate(rate);
  if (gotPeds)  pars->SetPedestal(peds);
  if (gotGains) pars->SetGain(gains);
  
  // pars->Print("pedestal");

  AliFMDPattern* d = new AliFMDPattern;
  d->AddLoad(AliFMDInput::kRawCalib);
  d->SetRawFile(file);
  d->SetName("rawCalib");
  d->SetTitle("Calibrated Raw");
  d->SetFactor(5);
  d->SetCut(0.02, 1);
  d->Run();
}