]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/ITSSDDGAINda.cxx
Fixing a memory leak
[u/mrichter/AliRoot.git] / ITS / ITSSDDGAINda.cxx
index b69e9ddda80a74e7abcdc4a8f730117eee0cefb8..279f07c8a8005c44d1ad3767e63cc3c153d858bc 100644 (file)
@@ -1,10 +1,10 @@
 /*
 - Contact: - prino@to.infn.it
-- Link: - http://www.to.infn.it/~prino/alice/RawData/run11173.date
+- Link: - alien:///alice/data/2009/LHC09c_SDD/000079095/raw/09000079095024.10.root
 - Run Type: - PULSER_RUN
 - DA Type: - LDC
 - Number of events needed: >15
-- Input Files: - SDDbase_step1_ddl*c*_sid*.data
+- Input Files: - SDDbase_step1_ddl*c*_sid*.data (output of previous PEDESTAL run)
 - Output Files: - SDDbase_ddl*c*_sid*.data
 - Trigger types used: 
 */
@@ -61,7 +61,7 @@ extern "C" {
       Arguments: list of DATE raw data files
 */
 int main(int argc, char **argv) {
-
+  // main -  Arguments: list of DATE raw data files
   int status = 0;
 
   // line added to solve IO problems
@@ -110,7 +110,12 @@ int main(int argc, char **argv) {
   
   /* report progress */
   daqDA_progressReport(10);
-  Int_t iev=0,iAnalyzedEv=0;
+
+  Int_t iev=0;
+  Int_t ievPul=0;
+  Int_t ievUsed=0;
+  Int_t nEvToBeSkipped=5;
+
   /* read the data files */
   int n;
   for (n=1;n<argc;n++) {
@@ -144,7 +149,6 @@ int main(int argc, char **argv) {
        break;
       }
 
-      if(iAnalyzedEv>=maxNEvents) break;
       iev++; 
       
       /* use event - here, just write event id to result file */
@@ -165,7 +169,15 @@ int main(int argc, char **argv) {
       case CALIBRATION_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);
+       printf(" Event number = %i ",iev);
+       ievPul++;
+       if(ievPul<=nEvToBeSkipped){
+         printf(" -> SKIP\n");
+         break;
+       }
+       printf("  -> Analyze\n");
+       ievUsed++;
+
        AliRawReader *rawReader = new AliRawReaderDate((void*)event);
        rawReader->Reset();
        cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rawReader);
@@ -210,17 +222,16 @@ int main(int argc, char **argv) {
        }
        
        /* free resources */
-       iAnalyzedEv++;
        free(event);
       }
-    }
-    
+      if(ievUsed>=maxNEvents) break;
+    }    
   }
     
   /* write report */
   TDatime time;
   TObjString timeinfo(Form("%02d%02d%02d%02d%02d%02d",time.GetYear()-2000,time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()));
-  printf("Run #%s, received %d calibration events, time %s\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv,timeinfo.GetString().Data());
+  printf("Run #%s, received %d calibration events, time %s\n",getenv("DATE_RUN_NUMBER"),ievUsed,timeinfo.GetString().Data());
 
   /* report progress */
   daqDA_progressReport(90);
@@ -258,9 +269,8 @@ int main(int argc, char **argv) {
 #ifdef ALI_AMORE
   amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
   Int_t statusamore =0;
-  statusamore += amoreDA.Send("TimeInfo",&timeinfo);
+  statusamore += amoreDA.Send("TimeInfoPulser",&timeinfo);
   statusamore += amoreDA.Send("Gain",gainHistos);
-  statusamore += amoreDA.Send("BadChannels",corrnHistos);
   if ( statusamore )
     printf("Warning: Failed to write Arrays in the AMORE database\n");
   else