]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/ITSSDDBASda.cxx
Removing extra line, adding EINCLUDE
[u/mrichter/AliRoot.git] / ITS / ITSSDDBASda.cxx
index 644222e63b87bd225b1d0d32ed60b5efba0865c8..67016265d58c01eb1516efb5bc9ddce3611ec563 100644 (file)
@@ -1,3 +1,15 @@
+/*
+- Contact: - prino@to.infn.it
+- Link: - http://www.to.infn.it/~prino/alice/RawData/run11161.date
+- Run Type: - PEDESTAL_RUN
+- DA Type: - LDC
+- Number of events needed: 100
+- Input Files: - 
+- Output Files: - SDDbase_step1_ddl*c*_sid*.data SDDbase_step2_ddl*c*_sid*.data
+- Trigger types used: 
+*/
+
+
 //////////////////////////////////////////////////////////////////////////////
 // Detector Algorithm for analysis of SDD baseline runs.                    //
 //                                                                          //
@@ -30,6 +42,8 @@ extern "C" {
 #include <TFile.h>
 #include <TH1F.h>
 #include <TH2F.h>
+#include <TROOT.h>
+#include <TPluginManager.h>
 
 // AliRoot includes
 #include "AliRawReaderDate.h"
@@ -43,9 +57,15 @@ int main(int argc, char **argv) {
 
   int status = 0;
 
+  // line added to solve IO problems
+  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+                                        "*",
+                                        "TStreamerInfo",
+                                        "RIO",
+                                        "TStreamerInfo()");
 
   /* log start of process */
-  printf("ITS SDD TP algorithm program started\n");  
+  printf("ITS SDD BASELINE+NOISE algorithm program started\n");  
 
 
   /* check that we got some arguments = list of files */
@@ -55,35 +75,41 @@ int main(int argc, char **argv) {
   }
 
 
-  // Loop over modules has to be added
-  const Int_t nSDDmodules=12;
-  AliITSOnlineSDDBase **base=new AliITSOnlineSDDBase*[2*nSDDmodules];
-  AliITSOnlineSDDCMN **corr=new AliITSOnlineSDDCMN*[2*nSDDmodules];
-  TH2F **histo=new TH2F*[2*nSDDmodules];
+  Int_t eqOffset = 256;
+  Int_t DDLrange = 24;
+  Int_t maxNEvents=18; // maximum number of events to be analyzed
+  const Int_t kTotDDL=24;
+  const Int_t kModPerDDL=12;
+  const Int_t kSides=2;
+  AliITSOnlineSDDBase **base=new AliITSOnlineSDDBase*[kTotDDL*kModPerDDL*kSides];
+  AliITSOnlineSDDCMN **corr=new AliITSOnlineSDDCMN*[kTotDDL*kModPerDDL*kSides];
+  TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
 
   Char_t hisnam[20];
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0;isid<2;isid++){
-      Int_t index=2*imod+isid;
-      base[index]=new AliITSOnlineSDDBase(imod,isid);
-      corr[index]=new AliITSOnlineSDDCMN(imod,isid);
-      sprintf(hisnam,"his%03ds%d",imod,isid);
-      histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       base[index]=new AliITSOnlineSDDBase(iddl,imod,isid);
+       sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
+       histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+      }
     }
   }
   
   /* report progress */
-  daqDA_progressReport(10);
+  daqDA_progressReport(8);
   Int_t iev;
   for(Int_t iStep=0;iStep<2;iStep++){
-    /* init some counters */
     printf("Start Analysis Step %d\n",iStep);
     iev=0;
     if(iStep==1){
-      for(Int_t imod=0; imod<nSDDmodules;imod++){
-       for(Int_t isid=0;isid<2;isid++){
-         Int_t index=2*imod+isid;
-         corr[index]->Reset();
+      for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+       for(Int_t imod=0; imod<kModPerDDL;imod++){
+         for(Int_t isid=0;isid<kSides;isid++){
+           Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+           corr[index]=new AliITSOnlineSDDCMN(iddl,imod,isid);
+         }
        }
       }
     }
@@ -101,7 +127,7 @@ int main(int argc, char **argv) {
       /* report progress */
       /* in this example, indexed on the number of files */
       // Progress report inside the event loop as well?
-      daqDA_progressReport(10+80*n/argc);
+      daqDA_progressReport(10+40*iStep*n/argc);
 
       /* read the file */
       for(;;) {
@@ -122,7 +148,7 @@ int main(int argc, char **argv) {
        }
 
        iev++; 
-       if(iev>10) break;
+       if(iev>maxNEvents) break;
 
        /* use event - here, just write event id to result file */
        eventT=event->eventType;
@@ -136,18 +162,17 @@ int main(int argc, char **argv) {
        case END_OF_RUN:
          break;
 
-         //      case PHYSICS_EVENT:
-         //    break;
+         //      case PHYSICS_EVENT:  // comment this line for test raw data
+         //    break;               // comment this line for test raw data
+
 
        case CALIBRATION_EVENT:
-         // for test raw data
-       case PHYSICS_EVENT:
+         break;  // uncomment this line for test raw data
+       case PHYSICS_EVENT: // uncomment this line for test raw data
          printf(" event number = %i \n",iev);
          AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-         rawReader->RequireHeader(kFALSE);
+         rawReader->SelectEquipment(17,eqOffset+1,eqOffset+DDLrange);
 
-         // temp for test raw data
-         rawReader->SelectEquipment(17,101,101);
 
          Int_t evtyp=0;
          while(rawReader->ReadHeader()){
@@ -156,29 +181,32 @@ int main(int argc, char **argv) {
          }
 
          rawReader->Reset();
-         for(Int_t imod=0; imod<nSDDmodules;imod++){
-           for(Int_t isid=0; isid<2;isid++){
-             Int_t index=2*imod+isid;
-             histo[index]->Reset();
+         for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+           for(Int_t imod=0; imod<kModPerDDL;imod++){
+             for(Int_t isid=0;isid<kSides;isid++){
+               Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+               histo[index]->Reset();
+             }
            }
          }
          AliITSRawStreamSDD s(rawReader);
-         // temp for test raw data
-         rawReader->SelectEquipment(17,101,101);
 
          while(s.Next()){
-           // calculation of module etc.
-           if(s.GetCarlosId()<nSDDmodules){
-             Int_t index=2*s.GetCarlosId()+s.GetChannel();
+           Int_t iDDL=rawReader->GetDDLID();
+           Int_t iCarlos=s.GetCarlosId();
+           if(iDDL>=0 && iDDL<kTotDDL && s.IsCompletedModule()==kFALSE){ 
+             Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel(); 
              histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
            }
          }
          delete rawReader;
-         for(Int_t imod=0; imod<nSDDmodules;imod++){
-           for(Int_t isid=0; isid<2;isid++){
-             Int_t index=2*imod+isid;
-             if(iStep==0) base[index]->AddEvent(histo[index]);    
-             if(iStep==1) corr[index]->AddEvent(histo[index]);    
+         for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+           for(Int_t imod=0; imod<kModPerDDL;imod++){
+             for(Int_t isid=0;isid<kSides;isid++){
+               Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+               if(iStep==0) base[index]->AddEvent(histo[index]);
+               if(iStep==1) corr[index]->AddEvent(histo[index]);
+             }
            }
          }
 
@@ -186,22 +214,19 @@ int main(int argc, char **argv) {
          free(event);
        }
       }
-    
     }
-    
-    for(Int_t imod=0; imod<nSDDmodules;imod++){
-      for(Int_t isid=0; isid<2;isid++){
-       Int_t index=2*imod+isid;
-       if(iStep==0){
-         base[index]->ValidateAnodes();
-         base[index]->WriteToASCII();
-       }
-       if(iStep==1){
-         corr[index]->ValidateAnodes();
-         corr[index]->WriteToASCII();
+
+    if(iStep==0){
+      for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+       for(Int_t imod=0; imod<kModPerDDL;imod++){
+         for(Int_t isid=0;isid<kSides;isid++){
+           Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+           base[index]->ValidateAnodes();
+           base[index]->WriteToASCII();
+         }
        }
-      }
-    }  
+      }  
+    }
   }
 
   /* write report */
@@ -212,20 +237,20 @@ int main(int argc, char **argv) {
 
 
 
-  TFile *fh=new TFile("histos.root","RECREATE");
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0; isid<2;isid++){
-      Int_t index=2*imod+isid;
-      corr[index]->WriteToROOT(fh);
+  TFile *fh=new TFile("SDDbaseHistos.root","RECREATE");
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       corr[index]->ValidateAnodes();
+       corr[index]->WriteToASCII();
+       corr[index]->WriteToROOT(fh);
+      }
     }
   }
   fh->Close();
 
 
-
-  // Example how to store the output file ot DAQ FXS
-  //  status=daqDA_FES_storeFile("./result.txt","DAcase1_results");
-
   /* report progress */
   daqDA_progressReport(100);