Beispiel #1
0
void tpc_raw(Int_t mode = 3)
{
    printf("*** RAW TPC ***");
    
    gStyle->SetPalette(1, 0);
    
    cout<<"1"<<endl;
    
//    AliCDBManager::Instance()->SetSpecificStorage("GRP/CTP/Config","local:///local/cdb/");
//    AliCDBManager::Instance()->SetSpecificStorage("GRP/GRP/Data","local:///local/cdb/");
    
    AliEveEventManager *eventManager = AliEveEventManager::Instance();
    
    cout<<"2"<<endl;
    eventManager->AssertGeometry();
    cout<<"3"<<endl;
    AliEveEventManager::AssertMagField();
    cout<<"4"<<endl;
    AliRawReader *reader = eventManager->GetRawReader();
    
    if(!reader){
        cout<"tpc_raw -- no raw reader"<<endl;
        return;
    }
    
    cout<<"5"<<endl;
    reader->Reset();
    
    AliTPCRawStreamV3 input(reader);
    reader->Select("TPC"); // ("TPC", firstRCU, lastRCU);
    
    AliEveTPCData *x = new AliEveTPCData;
    // x->SetLoadPedestal(5);
    x->SetLoadThreshold(5);
    x->SetAutoPedestal(kTRUE);
    
    x->LoadRaw(input, kTRUE, kTRUE);
    
    gEve->DisableRedraw();
    
    TEveElementList* sec2d = new TEveElementList("TPC 2D");
    gEve->AddElement(sec2d);
    
    TEveElementList* sec3d = new TEveElementList("TPC 3D");
    gEve->AddElement(sec3d);
    
    AliEveTPCSector2D *s;
    AliEveTPCSector3D *t;
    
    for (Int_t i=0; i<=35; ++i) {
        if (mode & 1) {
            s = new AliEveTPCSector2D(Form("2D sector %d",i));
            s->SetSectorID(i);
            s->SetAutoTrans(kTRUE); // place on proper 3D coordinates
            s->SetDataSource(x);
            s->SetFrameColor(36);
            sec2d->AddElement(s);
            s->IncRTS();
        }
        if (mode & 2) {
            t = new AliEveTPCSector3D(Form("3D sector %d",i));
            t->SetSectorID(i);
            t->SetAutoTrans(kTRUE);
            t->SetDataSource(x);
            sec3d->AddElement(t);
            t->IncRTS();
        }
    }
    
    cout<<"Reading HLT clusters"<<endl;
    // Display TPC clusters compressed by HLT
    TTree* hltClustersTree = readHLTClusters(reader); // read HLT compressed clusters from TPC from raw reader and output them in hltClustersTree
    
    if(!hltClustersTree){
        cout<<"HLT clusters tree couldn't be created"<<endl;
        return;
    }
    
    cout<<"HLT clusters read"<<endl;
    
    if(hltClustersTree) renderHLTClusters(hltClustersTree);
    
    cout<<"HLT clusters rendered"<<endl;
    
    gEve->EnableRedraw();
    gEve->Redraw3D();
    
}
Beispiel #2
0
// read TPC Clusters compressed by HLT from a raw filename
TTree* readHLTClusters(AliRawReader *fRawReader)
{
    /*************************
     *  Raw IO Stuff
     **************************/
    
    cout<<"reader:"<<fRawReader<<endl;
    
    AliRawReader* rawReader = AliRawHLTManager::CreateRawReaderHLT(fRawReader, "TPC");
    cout<<"rawReader:"<<rawReader<<endl;
    
    rawReader->Select("TPC");
    
    /*************************
     *  HLT IO Stuff
     **************************/
    AliHLTSystem* hltSystem=AliHLTPluginBase::GetInstance();
    
    cout<<"hltSystem:"<<hltSystem<<endl;
    
    AliHLTOUT* hltOut = AliHLTOUT::New(rawReader);
    
    cout<<"hltOut:"<<hltOut<<endl;
    
    hltOut->Init();
    hltSystem->InitHLTOUT(hltOut);
    
    /*************************
     *  GRP Stuff
     **************************/
    AliGRPManager *manGRP = new AliGRPManager();
    cout<<"manGRP:"<<manGRP<<endl;
    
    AliRecoParam* recoParam = InitRecoParam();
    
    cout<<"recoParam:"<<recoParam<<endl;
    
    if(!recoParam){
        cout<<"No reco param"<<endl;
    }
    
    AliEveEventManager* curEventMan = (AliEveEventManager*)gEve->GetCurrentEvent();
    
    cout<<"a"<<endl;
    const AliRunInfo* runInfo = manGRP->GetRunInfo();
    cout<<"a.1:"<<runInfo<<endl;
    const THashTable* cosmicTriggers = manGRP->GetCosmicTriggers();
    cout<<"a.2:"<<cosmicTriggers<<endl;
    const AliEventInfo *eventinfo = GetEventInfo();
    
    if(!eventinfo){
        cout<<"Event info couldn't be retrived."<<endl;
        return 0;
    }
    
    recoParam->SetEventSpecie(runInfo,*eventinfo,cosmicTriggers);
    
    cout<<"aaa"<<endl;
    
    AliTPCRecoParam *tpcRecoParam = (AliTPCRecoParam*)recoParam->GetDetRecoParam(1); // TPC has index 1
    tpcRecoParam->SetUseHLTClusters(3); // reconstruct only HLT clusters
    
    cout<<"aaaa"<<endl;
    
    /**************************
     *  Reconstruction of Clusters
     **************************/
    
    
    TTree* outputClustersTree = new TTree();
    cout<<"a1"<<endl;
    AliTPCReconstructor *reconstructor = new AliTPCReconstructor();
    
    cout<<"a1.1"<<endl;
    reconstructor->SetOption("useHLT");
    cout<<"a1.2"<<endl;
    reconstructor->CreateTracker(); // this will set the option to reconstruct for only HLT clusters
    cout<<"a2"<<endl;
    
    reconstructor->SetRecoParam(tpcRecoParam);
    
    reconstructor->SetRunInfo((AliRunInfo*)runInfo);
    reconstructor->SetEventInfo((AliEventInfo*)eventinfo);
    cout<<"a3"<<endl;
    
    if(!rawReader){
        cout<<"No raw reader"<<endl;
    }
    
    reconstructor->Reconstruct(rawReader, outputClustersTree);
    
    if(reconstructor){
//        delete reconstructor;
        reconstructor=0;
    }
    cout<<"aaaaa"<<endl;
    
    hltSystem->ReleaseHLTOUT(hltOut);
    
    cout<<"aaaaaa"<<endl;
    
    return outputClustersTree;
    
}
Beispiel #3
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;
}