]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/ITSSDDGAINda.cxx
Upgraded possibility of DCS data size reduction (V. Pospisil)
[u/mrichter/AliRoot.git] / ITS / ITSSDDGAINda.cxx
index c083a8570a259cd72857704935bf3adda4a041c1..132cfc90e954f2c6d861c741c2952ea675664fb9 100644 (file)
@@ -1,3 +1,14 @@
+/*
+- Contact: - prino@to.infn.it
+- Link: - http://www.to.infn.it/~prino/alice/RawData/run11173.date
+- Run Type: - PULSER_RUN
+- DA Type: - LDC
+- Number of events needed: 100
+- Input Files: - SDDbase_step1_ddl*c*_sid*.data
+- Output Files: - SDDbase_ddl*c*_sid*.data
+- Trigger types used: 
+*/
+
 //////////////////////////////////////////////////////////////////////////////
 // Detector Algorithm for analysis of SDD test pulse runs.                  //
 //                                                                          //
@@ -31,6 +42,8 @@ extern "C" {
 #include <TH1F.h>
 #include <TH2F.h>
 #include <TSystem.h>
+#include <TROOT.h>
+#include <TPluginManager.h>
 
 // AliRoot includes
 #include "AliRawReaderDate.h"
@@ -43,9 +56,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 TEST-PULSE algorithm program started\n");  
 
 
   /* check that we got some arguments = list of files */
@@ -57,24 +76,30 @@ int main(int argc, char **argv) {
 
   Int_t eqOffset = 256;
   Int_t DDLrange = 24;
-  Int_t maxNEvents=10; // maximum number of events to be analyzed
-  const Int_t nSDDmodules=12;  // temp for test raw data
-  AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[2*nSDDmodules];
-  TH2F **histo=new TH2F*[2*nSDDmodules];
-
+  Int_t maxNEvents=15; // maximum number of events to be analyzed
+  const Int_t kTotDDL=24;
+  const Int_t kModPerDDL=12;
+  const Int_t kSides=2;
+
+  AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[kTotDDL*kModPerDDL*kSides];
+  TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
+  Bool_t isFilled[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;
-      tpan[index]=new AliITSOnlineSDDTP(imod,isid,411.);
-      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;
+       tpan[index]=new AliITSOnlineSDDTP(iddl,imod,isid,100.);
+       sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
+       histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+       isFilled[index]=0;
+      }
     }
   }
   
   /* report progress */
   daqDA_progressReport(10);
-  Int_t iev=0;
+  Int_t iev=0,iAnalyzedEv=0;
   /* read the data files */
   int n;
   for (n=1;n<argc;n++) {
@@ -108,8 +133,8 @@ int main(int argc, char **argv) {
        break;
       }
 
+      if(iAnalyzedEv>=maxNEvents) break;
       iev++; 
-      if(iev>maxNEvents) break;
       
       /* use event - here, just write event id to result file */
       eventT=event->eventType;
@@ -131,7 +156,6 @@ int main(int argc, char **argv) {
       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);
 
        Int_t evtyp=0;
@@ -141,34 +165,37 @@ 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);
        
        while(s.Next()){
-         Int_t iddl=rawReader->GetDDLID();
-         iddl=0; // temporary for test raw data
-         Int_t isddmod=s.GetModuleNumber(iddl,s.GetCarlosId()); 
-         isddmod-=240;  // to have SDD modules from 0 to 259
-         isddmod=s.GetCarlosId(); // temporary for test raw data
-         if(isddmod<nSDDmodules&&s.IsCompletedModule()==kFALSE){ 
-           Int_t index=2*isddmod+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());
+           isFilled[index]=1;
          }
        }
        delete rawReader;
-       for(Int_t imod=0; imod<nSDDmodules;imod++){
-         for(Int_t isid=0; isid<2;isid++){
-           Int_t index=2*imod+isid;
-           tpan[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(isFilled[index]) tpan[index]->AddEvent(histo[index]);    
+           }
          }
        }
        
        /* free resources */
+       iAnalyzedEv++;
        free(event);
       }
     }
@@ -177,21 +204,25 @@ int main(int argc, char **argv) {
     
   TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
   Char_t filnam[100],command[120];
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0; isid<2;isid++){
-      Int_t index=2*imod+isid;
-      tpan[index]->ValidateAnodes();
-      tpan[index]->WriteToASCII();
-      tpan[index]->WriteToROOT(fh);
-      sprintf(filnam,"SDDbase_mod%03d_sid%d.data",imod,isid);
-      sprintf(command,"tar -rf SDDbase_LDC1.tar %s",filnam);
-      gSystem->Exec(command);
+  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(isFilled[index]){
+         tpan[index]->ValidateAnodes();
+         tpan[index]->WriteToASCII();
+         tpan[index]->WriteToROOT(fh);
+         sprintf(filnam,"SDDbase_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
+         sprintf(command,"tar -rf SDDbase_LDC.tar %s",filnam);
+         gSystem->Exec(command);
+       }
+      }
     }  
   }
   fh->Close();
 
   /* write report */
-  printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iev);
+  printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv);
 
   /* report progress */
   daqDA_progressReport(90);
@@ -202,7 +233,7 @@ int main(int argc, char **argv) {
 
 
 
-  status=daqDA_FES_storeFile("./SDDbase_LDC1.tar","SDD_Calib");
+  status=daqDA_FES_storeFile("./SDDbase_LDC.tar","SDD_Calib");
 
   /* report progress */
   daqDA_progressReport(100);