예제 #1
0
파일: vzero_raw.C 프로젝트: alisw/AliRoot
void vzero_raw()
{
    printf("*** RAW VZero ***");
    
  gStyle->SetPalette(1, 0);

  AliRawReader *reader = AliEveEventManager::AssertRawReader();
  reader->Reset();

  gEve->DisableRedraw();

  AliEveVZEROModule* rawA = new AliEveVZEROModule("VZERO_RAW_A", kTRUE);
  rawA->LoadRaw(reader);


  AliEveVZEROModule* rawC = new AliEveVZEROModule("VZERO_RAW_C", kFALSE);
  rawC->LoadRaw(reader);

  gEve->EnableRedraw();
}
예제 #2
0
파일: tpc_raw.C 프로젝트: alisw/AliRoot
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();
    
}
예제 #3
0
void ITSSDDQAMaker(char *iFile, Int_t MaxEvts=1000000, Int_t FirstEvt=0) {

  //To have Baseline Histos uncomment parts with " // BL!!! " comment

cout << "SDD Quality Assurance Prototype Macro" << endl; 

const Int_t nSDDmodules= 260;
const Int_t imodoffset = 240;
const Int_t modtotSDD  = nSDDmodules*2;
const Int_t anode = 256;

Float_t xi = -0.5;
Float_t xf = xi + nSDDmodules;
TH1F *hModulePattern = new TH1F("hModulePattern","Modules pattern",nSDDmodules,xi,xf);
xf = xi + modtotSDD;
TH1F *hModuleSidePattern = new TH1F("hModuleSidePattern","Modules/Side pattern",modtotSDD,xi,xf);

TH2F *hModuleChargeMap[modtotSDD];  //260 dx e 260 sx  with A, T, Q
TH2F *hModuleCountsMap[modtotSDD];  //260 dx e 260 sx  with A, T, Ncounts
TH2I *hModuleCarlos = new TH2I("hModuleCarlos","hModuleCarlos",modtotSDD,xi,xf,101,-0.5,100.5);
/*
  TH1F *hModuleSideBL[modtotSDD][anode];                                // BL!!!
*/ 


//-------histograms definition 
Char_t *hisnam = new Char_t[50];
Char_t *histit = new Char_t[50];  
Char_t *hisnam2 = new Char_t[50];
Char_t *histit2 = new Char_t[50];    
Char_t *hisnam3 = new Char_t[50];
 for(Int_t imod=0; imod<nSDDmodules;imod++){
   for(Int_t isid=0;isid<2;isid++){
     Int_t index=2*imod+isid;       //260*2 position

     sprintf(hisnam,"chargeMap%d",index);
     sprintf(histit,"Total Charge, module number %d",index);
     hModuleChargeMap[index]=new TH2F(hisnam,histit,256,-0.5,255.5,256,-0.5,255.5);  

     sprintf(hisnam2,"countsMap%d",index);
     sprintf(histit2,"Number of Counts, module number %d",index);
     hModuleCountsMap[index] = new TH2F(hisnam2,histit2,256,-0.5,255.5,256,-0.5,255.5);
     /*
       for(Int_t ianode=0; ianode<anode; ianode++){                         // BL!!!
       sprintf(hisnam3,"BL_module_%d_%d",index,ianode); 
       //cout<<hisnam3 <<endl;
       hModuleSideBL[index][ianode] = new TH1F(hisnam3,hisnam3,256,0.,1024.);
     }
     */
   }
 }

  TString strFile = iFile;
  strFile += "?EventType=7";
  AliRawReader *rd = new AliRawReaderDate(strFile.Data(),FirstEvt);  // open run
  Int_t evCounter = 0;
  do{                       // start loop on events
    if(++evCounter > MaxEvts) { cout << MaxEvts << " events read, stop" << endl; evCounter--; break; }  
    cout << "Read Event: " << evCounter+FirstEvt-1 << endl;

    rd->RequireHeader(kFALSE);             
    rd->Reset();                           // reset the current position to the beginning of the event
 
    Int_t nSkip = 0;                     // number of skipped signals
    AliITSRawStreamSDD s(rd);            //This class provides access to ITS SDD digits in raw data.
    Int_t iddl;
    Int_t isddmod;
    Int_t moduleSDD;
    gStyle->SetPalette(1);
    while(s.Next()){                     //read the next raw digit; returns kFALSE if there is no digit left
      if(s.IsCompletedModule()) continue;
      if(s.IsCompletedDDL()) continue;
      iddl=rd->GetDDLID()-2; // -2 is temporary for test raw data

	isddmod=s.GetModuleNumber(iddl,s.GetCarlosId());        //this is the FEE Carlos
       	//cout<<"DDLID= "<<iddl <<"; Module number= " <<isddmod  <<endl;
	if(isddmod >= imodoffset) { 
	  hModulePattern->Fill(isddmod-imodoffset);             // 0 to 259    so  240 to 499
	  moduleSDD=2*(isddmod-imodoffset)+s.GetChannel();
          hModuleSidePattern->Fill(moduleSDD);                  // 0 to 519
	  hModuleCarlos->Fill(isddmod-imodoffset,s.GetCarlosId());
          //cout << "anode " << s.GetCoord1() << ", time bin: " << s.GetCoord2() << ", charge: " << s.GetSignal() << endl;	  
	  Int_t coord1 = s.GetCoord1();
 	  Int_t coord2 = s.GetCoord2();
 	  Int_t signal = s.GetSignal();
	  hModuleChargeMap[moduleSDD]->Fill(coord2, coord1,signal);
          hModuleCountsMap[moduleSDD]->Fill(coord2, coord1 );   
	  //hModuleSideBL[moduleSDD][coord1]->Fill(signal);             // BL  !!!
	} else {
	  nSkip++;
	}
    }    
    cout << "End of Event " << evCounter+FirstEvt-1 << ", " << nSkip << " wrong module numbers" << endl;
  } while(rd->NextEvent()); // end loop on events
  delete rd;

  cout << "end after " << evCounter << " events" << endl;
  /*
  TNtuple *Baseline = new TNtuple("Baseline","Baseline","HalfModule:Anode:Mean:RMS");      // BL!!!
  Float_t meanBL;
  Float_t rmsBL;  
  */
  for(Int_t i=0; i<modtotSDD; i++){   
    if(hModuleSidePattern->GetBinContent(i+1)){              //check if they're not empty
      hModuleChargeMap[i]->GetXaxis()->SetTitle("Time Bin");
      hModuleChargeMap[i]->GetYaxis()->SetTitle("Anode"); 
      hModuleCountsMap[i]->GetXaxis()->SetTitle("Time Bin");
      hModuleCountsMap[i]->GetYaxis()->SetTitle("Anode");  
      /*
      for(Int_t ianode=0; ianode<anode; ianode++ ){                                      // BL!!!
	hModuleSideBL[i][ianode]->GetXaxis()->SetTitle("ADC counts");
	hModuleSideBL[i][ianode]->GetYaxis()->SetTitle("#"); 
	meanBL = hModuleSideBL[i][ianode]->GetMean();
	rmsBL = hModuleSideBL[i][ianode]->GetRMS();
	gaussfitBL = hModuleSideBL[i][ianode]->Fit("gaus");	
	Baseline->Fill(i,ianode,meanBL,rmsBL);
      }
      */
    }
  }  
  
  hModuleSidePattern->GetXaxis()->SetTitle("2*(Module Number-1)+Side");
  hModuleSidePattern->GetYaxis()->SetTitle("Counts");  
  hModulePattern->GetXaxis()->SetTitle("Module Number");  
  hModulePattern->GetYaxis()->SetTitle("Counts");  


  //-------store Histograms
  cout << "Store Histograms" << endl;
  TString oFileName(iFile);
  oFileName.Append(".root");
  TFile *oFile = TFile::Open(oFileName,"recreate");
  hModulePattern->Write();
  hModuleSidePattern->Write();
  hModuleCarlos->Write();
  for(Int_t i=0; i<modtotSDD; i++){ 
      if(hModuleSidePattern->GetBinContent(i+1)){            //check if they're not empty
	hModuleChargeMap[i]->Write();
	hModuleCountsMap[i]->Write();     
	/* 
	for(Int_t ianode=0; ianode<anode; ianode++ ){                           // BL!!!
 	  hModuleSideBL[i][ianode]->Write();
	  Baseline->Write();
 	}
	*/
      }
  }
  
  oFile->Close();
  cout << "Clear memory" << endl;
  for(Int_t imod=0; imod<nSDDmodules;imod++){
    for(Int_t isid=0;isid<2;isid++){
      Int_t index=2*imod+isid;       //260*2 position
      delete hModuleChargeMap[index];
      delete hModuleCountsMap[index];       
      /*
      for(Int_t ianode=0; ianode<anode; ianode++ ){                              // BL!!!
	delete hModuleSideBL[index][ianode]; 
	delete Baseline;
      }
      */
    }
  }
  delete hModulePattern;
  delete hModuleSidePattern;
  delete hModuleCarlos;

}
예제 #4
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;
}
예제 #5
0
void DisplaySDDRawData(TString filename, Int_t firstEv=0, Int_t lastEv=5){


  Bool_t writtenoutput=kFALSE;
  AliITSDDLModuleMapSDD* ddlmap=new AliITSDDLModuleMapSDD();
  ddlmap->SetJun09Map();

  TH2F* hzphi3=new TH2F("hzphi3","Layer 3",1536,-0.5,1535.5,3584,-0.5,3584.5);
  TH2F* hzphi4=new TH2F("hzphi4","Layer 4",2048,-0.5,2047.5,5632,-0.5,5631.5);

  TLine** lA3=new TLine*[5];
  for(Int_t ilin=0;ilin<5;ilin++){
    lA3[ilin]=new TLine((ilin+1)*256,0,(ilin+1)*256,3584.5);
    lA3[ilin]->SetLineColor(kGray);
    lA3[ilin]->SetLineStyle(2);
  }
  TLine** lT3=new TLine*[13];
  for(Int_t ilin=0;ilin<13;ilin++){
    lT3[ilin]=new TLine(0,(ilin+1)*256,1535.5,(ilin+1)*256);
    lT3[ilin]->SetLineColor(kGray);
    lT3[ilin]->SetLineStyle(2);
  }

  TLine** lA4=new TLine*[7];
  for(Int_t ilin=0;ilin<7;ilin++){
    lA4[ilin]=new TLine((ilin+1)*256,0,(ilin+1)*256,5631.5);
    lA4[ilin]->SetLineColor(kGray);
    lA4[ilin]->SetLineStyle(2);
  }
  TLine** lT4=new TLine*[21];
  for(Int_t ilin=0;ilin<21;ilin++){
    lT4[ilin]=new TLine(0,(ilin+1)*256,2047.5,(ilin+1)*256);
    lT4[ilin]->SetLineColor(kGray);
    lT4[ilin]->SetLineStyle(2);
  }

  hzphi3->SetStats(0);
  hzphi4->SetStats(0);

  Int_t iev=firstEv;
  AliRawReader *rd; 
  if(filename.Contains(".root")){
    rd=new AliRawReaderRoot(filename.Data(),iev);
  }else{
    rd=new AliRawReaderDate(filename.Data(),iev);
  }

  TStopwatch *evtime=new TStopwatch();
  TCanvas* c0 = new TCanvas("cd0","c0",800,800);
  gStyle->SetPalette(1);
  do{
    c0->Clear();				
    c0->Divide(1,2,0.001,0.001);

    evtime->Start();
    printf("Event # %d\n",iev);
    rd->Reset();
    hzphi3->Reset();
    hzphi4->Reset();

    UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd);
    UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
    AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr);
    if(!writtenoutput){
      printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
      writtenoutput=kTRUE;

    }

    while(s->Next()){
      
      if(s->IsCompletedModule()==kFALSE && s->IsCompletedDDL()==kFALSE){
	Int_t lay,lad,det;
	Int_t modID=ddlmap->GetModuleNumber(rd->GetDDLID(),s->GetCarlosId());
	AliITSgeomTGeo::GetModuleId(modID,lay,lad,det);
	Int_t iz=s->GetCoord1()+256*(det-1);
	Int_t iphi=s->GetCoord2()+256*(lad-1)+128*s->GetChannel();
	if(lay==3){
	  hzphi3->SetBinContent(iz+1,iphi+1,s->GetSignal());
	}else if(lay==4){
	  hzphi4->SetBinContent(iz+1,iphi+1,s->GetSignal());
	}
      }
    }
    evtime->Stop();
    printf("**** Event=%d \n",iev);
    evtime->Print("u");
    evtime->Reset();
    iev++;
    
    c0->cd(1);
    hzphi3->Draw("colz");
    for(Int_t ilin=0;ilin<5;ilin++) lA3[ilin]->Draw("same");
    for(Int_t ilin=0;ilin<13;ilin++) lT3[ilin]->Draw("same");
    hzphi3->GetXaxis()->SetTitle("Z (anode)");
    hzphi3->GetYaxis()->SetTitle("PHI (time bin)");
      
    c0->cd(2);
    hzphi4->Draw("colz");
    for(Int_t ilin=0;ilin<7;ilin++) lA4[ilin]->Draw("same");
    for(Int_t ilin=0;ilin<21;ilin++) lT4[ilin]->Draw("same");
    hzphi4->GetXaxis()->SetTitle("Z (anode)");
    hzphi4->GetYaxis()->SetTitle("PHI (time bin)");
    c0->Update();
  }while(rd->NextEvent()&&iev<=lastEv);

}