]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
basic quality checks/plots (from Josh Hamblen/UT)
authordsilverm <dsilverm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Dec 2008 20:16:04 +0000 (20:16 +0000)
committerdsilverm <dsilverm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Dec 2008 20:16:04 +0000 (20:16 +0000)
EMCAL/SMcalib/QA/DrawLED.C [new file with mode: 0644]
EMCAL/SMcalib/QA/EMCALLEDda.C [new file with mode: 0644]
EMCAL/SMcalib/QA/EMCALPEDda.C [new file with mode: 0644]
EMCAL/SMcalib/QA/README [new file with mode: 0644]

diff --git a/EMCAL/SMcalib/QA/DrawLED.C b/EMCAL/SMcalib/QA/DrawLED.C
new file mode 100644 (file)
index 0000000..cc8a001
--- /dev/null
@@ -0,0 +1,21 @@
+void DrawLED(int runno=1890,int mod=0,int col=0,int row=0,int gain = 0){
+  
+  Char_t fname[256];
+  sprintf(fname,"LED_%09d.root",runno);
+  
+  TFile *f = new TFile(fname,"read");
+  TTree *tree = f->Get("fTreeAmpVsTime");
+  f.ls();
+  
+  AliCaloCalibSignal *calib = new AliCaloCalibSignal();
+       
+  int channo = calib->GetChannelNum(mod,col,row,gain);
+  char arg[64];
+  sprintf(arg,"fChannelNum==%d",channo);
+  cout<<arg<<endl;
+  tree->Draw("fAmp:fHour",arg);
+
+}
+
+
+
diff --git a/EMCAL/SMcalib/QA/EMCALLEDda.C b/EMCAL/SMcalib/QA/EMCALLEDda.C
new file mode 100644 (file)
index 0000000..e31eafc
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+  a very basic test macro for processing LED events with AliCaloCalibSignal
+  Josh Hamblen
+*/
+#define AliDebugLevel() -1
+
+void EMCALLEDda(const int runno = 476){
+  
+  int i, status;
+  
+  /* log start of process */
+  printf("EMCAL DA started - %s\n",__FILE__);
+  
+  AliCaloCalibSignal * calibSignal = new 
+    AliCaloCalibSignal(AliCaloCalibSignal::kEmCal); // pedestal and noise calibration
+  
+  int nevents=0;
+  // Assume we are just interested in the 1st segment, _0.root below for fname*
+  Char_t fname[256];
+  sprintf(fname, "/local/data/Run_%09d.Seq_1A.Stream_0.root",runno);
+    
+  AliRawReader *rawReader = NULL;
+  rawReader = new AliRawReaderRoot(fname);
+  AliCaloRawStream *in = NULL; 
+  in = new AliCaloRawStream(rawReader,"EMCAL");
+  //in->SetOldRCUFormat(kTRUE);
+  
+  AliRawEventHeaderBase *aliHeader=NULL;
+  int nev=0;
+  /* read until EOF */
+  while ( rawReader->NextEvent()) {
+    nev++;
+    
+    aliHeader = (AliRawEventHeaderBase*) rawReader->GetEventHeader();
+    calibSignal->SetRunNumber( aliHeader->Get("RunNb") ); // just for fun; keep info on last run looked at
+    
+    if ( aliHeader->Get("Type") == AliRawEventHeaderBase::kStartOfRun){
+      // set start time
+      calibSignal->SetStartTime(aliHeader->Get("Timestamp"));
+      int time = aliHeader->Get("Timestamp");
+    }
+    
+    // set parameters for led event checking
+    calibSignal->SetAmpCut(50);
+    // for now, fraction choice is set for testbeam files:
+    // 64 channels / (a total of 24 rows * 48 cols * 12 modules) = 0.00462962963
+    calibSignal->SetReqFractionAboveAmpCutVal(0.004);
+    calibSignal->SetReqFractionAboveAmp(kTRUE);
+    calibSignal->SetUseAverage(kTRUE);
+    calibSignal->SetSecInAverage(900);
+    
+    // select physics and calibration events now (only calibration in future)
+    if ( aliHeader->Get("Type") == AliRawEventHeaderBase::kPhysicsEvent || 
+        aliHeader->Get("Type") == AliRawEventHeaderBase::kCalibrationEvent  ) {
+      
+      nevents++;
+      if(nevents%1000==0)cout<<"Event "<<nevents<<endl;
+      //  Signal calibration
+      calibSignal->ProcessEvent(in,aliHeader);
+    }
+  } // loop over all events in file
+    /* cleanup the reading handles */
+  delete in;
+  delete rawReader;    
+  
+  //
+  // write results/histograms to rootfile
+  //
+  
+  printf ("%d physics/calibration events processed.\n",nevents);
+  Char_t outname[256];
+  sprintf(outname, "LED_%09d.root",runno);
+  
+  calibSignal->Save(outname);
+  printf("Wrote %s.\n",outname);
+  calibSignal->Analyze();
+  printf("NEvents Processed %d Accepted %d\n",calibSignal->GetNEvents(),calibSignal->GetNAcceptedEvents());
+  
+  // see if we can delete our analysis helper also
+  delete calibSignal;
+  
+}
diff --git a/EMCAL/SMcalib/QA/EMCALPEDda.C b/EMCAL/SMcalib/QA/EMCALPEDda.C
new file mode 100644 (file)
index 0000000..c48d2ef
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+  a very basic test macro for processing Pedestal events with AliCaloCalibPedestal
+  (adopted from EMCALLEDda.C macro)
+  Josh Hamblen
+*/
+#define AliDebugLevel() -1
+
+void EMCALPEDda(const int runno = 476){
+  
+  int i, status;
+  
+  /* log start of process */
+  printf("EMCAL DA started - %s\n",__FILE__);
+  
+  AliCaloCalibPedestal * calibPedestal = new 
+    AliCaloCalibPedestal(AliCaloCalibPedestal::kEmCal); // pedestal and noise calibration
+  
+  int nevents=0;
+  // Assume we are just interested in the 1st segment, _0.root below for fname*
+  Char_t fname[256];
+  sprintf(fname, "/local/data/Run_%09d.Seq_1A.Stream_0.root",runno);
+  
+  AliRawReader *rawReader = NULL;
+  rawReader = new AliRawReaderRoot(fname);
+  AliCaloRawStream *in = NULL; 
+  in = new AliCaloRawStream(rawReader,"EMCAL");
+  //in->SetOldRCUFormat(kTRUE);
+  
+  AliRawEventHeaderBase *aliHeader=NULL;
+  int nev=0;
+  /* read until EOF */
+  while ( rawReader->NextEvent()) {
+    nev++;
+    
+    aliHeader = (AliRawEventHeaderBase*) rawReader->GetEventHeader();
+    calibPedestal->SetRunNumber( aliHeader->Get("RunNb") ); // just for fun; keep info on last run looked at
+    
+    // select physics and calibration events now (only calibration in future)
+    if ( aliHeader->Get("Type") == AliRawEventHeaderBase::kPhysicsEvent || 
+        aliHeader->Get("Type") == AliRawEventHeaderBase::kCalibrationEvent  ) {
+      
+      nevents++;
+      if(nevents%1000==0)cout<<"Event "<<nevents<<endl;
+      //  Pedestal calibration
+      calibPedestal->ProcessEvent(in);
+    }
+  } // loop over all events in file
+    /* cleanup the reading handles */
+  delete in;
+  delete rawReader;    
+  
+  //
+  // write results/histograms to rootfile
+  //
+  
+  printf ("%d physics/calibration events processed.\n",nevents);
+  
+  // create output histograms and write to file
+  Char_t outname[256];
+  sprintf(outname, "PED_%09d.root",runno);
+  
+  calibPedestal->SaveHistograms(outname);
+
+  printf("Wrote %s.\n",outname);
+    
+  // see if we can delete our analysis helper also
+  delete calibPedestal;
+  
+  //
+  // reopen the file that was just made to make the RMS hists
+  //
+  
+  TFile *f=new TFile(outname,"update");
+  
+  // now take the profile histograms and plot the RMS from them 
+  int ncols = hPedlowgain0->GetNbinsX();
+  int nrows = hPedlowgain0->GetNbinsY();
+  Double_t rms;
+  
+  TH2F *hPedRMSlowgain0 = new TH2F("hPedRMSlowgain0","Pedestal RMS, low gain, module 0",ncols,0,ncols,nrows,0,nrows); 
+  TH2F *hPedRMShighgain0 = new TH2F("hPedRMShighgain0","Pedestal RMS, high gain, module 0",ncols,0,ncols,nrows,0,nrows);   
+  TH2F *hSampleRMSlowgain0 = new TH2F("hSampleRMSlowgain0","All Samples RMS, low gain, module 0",ncols,0,ncols,nrows,0,nrows); 
+  TH2F *hSampleRMShighgain0 = new TH2F("hSampleRMShighgain0","All Samples RMS, high gain, module 0",ncols,0,ncols,nrows,0,nrows);  
+
+  for (int i=0; i < ncols; i++){
+    for (int j=0; j < nrows; j++){
+      
+      rms = hPedlowgain0->GetBinError(i+1,j+1);
+      hPedRMSlowgain0->Fill(i,j,rms);
+      
+      rms = hPedhighgain0->GetBinError(i+1,j+1);
+      hPedRMShighgain0->Fill(i,j,rms);
+      
+      rms = hSamplelowgain0->GetBinError(i+1,j+1);
+      hSampleRMSlowgain0->Fill(i,j,rms);
+      
+      rms = hSamplehighgain0->GetBinError(i+1,j+1);
+      hSampleRMShighgain0->Fill(i,j,rms);
+   }
+  }
+   
+  // write the RMS hists to the file
+  hPedRMSlowgain0->Write();
+  hPedRMShighgain0->Write();
+  hSampleRMSlowgain0->Write();
+  hSampleRMShighgain0->Write();
+  f->ls();
+
+  // now draw the results
+  gStyle->SetOptStat(0);
+  gStyle->SetPalette(1);
+  
+  TCanvas *c1 = new TCanvas("c1","",800,600);
+  c1->Divide(2,2);
+  c1->cd(1);
+  hPedlowgain0->Draw("colz");
+  c1->cd(2);
+  hPedRMSlowgain0->Draw("colz");
+  c1->cd(3);
+  hPedhighgain0->Draw("colz");
+  c1->cd(4);
+  hPedRMShighgain0->Draw("colz");
+  c1->cd();
+
+  TCanvas *c2 = new TCanvas("c2","",800,600);
+  c2->Divide(2,2);
+  c2->cd(1);
+  hSamplelowgain0->Draw("colz");
+  c2->cd(2);
+  hSampleRMSlowgain0->Draw("colz");
+  c2->cd(3);
+  hSamplehighgain0->Draw("colz");
+  c2->cd(4);
+  hSampleRMShighgain0->Draw("colz");
+  c2->cd();
+
+
+}
diff --git a/EMCAL/SMcalib/QA/README b/EMCAL/SMcalib/QA/README
new file mode 100644 (file)
index 0000000..6d41d96
--- /dev/null
@@ -0,0 +1,7 @@
+Description of macros at /home/emcaldaq/hamblen on pcemcal002
+
+EMCALPEDda.C: Analyzes a run and makes a file of the form PED_000000476.root containing pedestal histograms. Run it like this, e.g. run 476: aliroot -l 'EMCALPEDda.C(476)' and it will also draw a pedestal plot on the screen.
+
+EMCALLEDda.C: Also analyzes a run and makes a file of the form LED_000000476.root that stores the LED amplitude vs. time information in a tree.  It does not draw the information, though. DrawLED.C is an attempt to draw amplitude vs. time from the saved tree, but it isn't working exactly right at the moment.
+
+The pedestal analysis required changes to AliCaloCalibPedestal.cxx/h on the aliroot version at /home/emcaldaq/alice/pro/AliRoot/, which should be committed if we find them useful.