M CalibFileMerger.C - write calibration components one by one
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 17:02:42 +0000 (17:02 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 17:02:42 +0000 (17:02 +0000)
M      RunAliTPCCalibKrTask.C  - edding more examples in commented code
M      AliXRDPROOFtoolkit.cxx  - bug fix
M      filterESD.C             - do not check friends
M      CalibrateTPC.C          - force CloseSE to be used

TPC/macros/AliXRDPROOFtoolkit.cxx
TPC/macros/CalibFileMerger.C
TPC/macros/CalibrateTPC.C
TPC/macros/RunAliTPCCalibKrTask.C
TPC/macros/filterESD.C

index 7e54e81..e7661f6 100644 (file)
@@ -683,6 +683,9 @@ Bool_t  AliXRDPROOFtoolkit::FilterList(const char*inputList, const char*fileList
       char fname[1000];
       if (!isZip){
        sprintf(fname, "%s/%s",dirname,array->At(i)->GetName());
+        if (((TObjString*)array->At(i))->String().Contains("*")){
+         sprintf(fname, "%s", currentFile.Data());
+       }
       }
       if (isZip) {
        const char * fileName   =  gSystem->BaseName(currentFile.Data());
@@ -692,7 +695,7 @@ Bool_t  AliXRDPROOFtoolkit::FilterList(const char*inputList, const char*fileList
        printf(fname, "To check %s%s#%s\n",dirname,fstring.Data(),array->At(i)->GetName());
       }
 
-      printf("\nFile to be checked %s",fname);
+      printf("\nFile to be checked %s\n",fname);
       //cout <<"\n arguments: "<< array->At(i+1)->GetName()<<" "<<checkLevel<<endl;
       Int_t cstatus = CheckTreeInFile(fname, array->At(i+1)->GetName(), checkLevel,0);
       //printf("  CheckTreeInFile returns %d",cstatus);
index 9bf3366..070da96 100644 (file)
@@ -1,29 +1,32 @@
 /*
-  Macro for merging of the calibration classes:
-  marain.ivanov@cern.ch
-  //
-  //
-  Example usage:
-  1. Make a list of the calibration files
-  2. Load libraries
-  3. Merge - the output is stored in the current directory
-  //
-  .x ~/rootlogon.C
-  gSystem->Load("libANALYSIS");
-  gSystem->Load("libTPCcalib");
-  .L $ALICE_ROOT/TPC/macros/CalibFileMerger.C+
-  CalibFileMerger();
+  // Macro for merging of the calibration classes:
+//   marain.ivanov@cern.ch
+//   //
+//   //
+//   Example usage:
+//   1. Make a list of the calibration files
+//   2. Load libraries
+//   3. Merge - the output is stored in the current directory
+//   //
+//   
+   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC")
+   gSystem->Load("libANALYSIS");
+   gSystem->Load("libTPCcalib");
+   .L $ALICE_ROOT/TPC/macros/CalibFileMerger.C+g 
+//   CalibFileMerger();
 */
 
 #include <fstream>
+#include "TSystem.h"
 #include "TFile.h"
 #include "TObjArray.h"
 #include "AliSysInfo.h"
 #include "AliTPCcalibBase.h"
 
-void CalibFileMerger(Int_t nmax=200,const char* filename = "mergelist.txt") {
-
+void CalibFileMerger(const char *oname, Int_t nmax=1000,const char* filename = "mergelist.txt") {
 
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libTPCcalib");
   TObjArray * mergeArray= 0;
   //
   // Open the input stream
@@ -39,14 +42,37 @@ void CalibFileMerger(Int_t nmax=200,const char* filename = "mergelist.txt") {
     TFile currentFile(objfile.Data());
     printf("Open file:Counter\t%d\tMerging file %s\n",counter,objfile.Data());
     TObjArray * carray =  (TObjArray*)currentFile.Get("TPCCalib");
-    if (!carray) continue;
+    if (!carray) {
+      carray = new TObjArray;
+      TList *farr = currentFile.GetListOfKeys();
+      if (!farr) continue;
+      for (Int_t ical=0; ical<farr->GetEntries(); ical++){
+       if (!farr->At(ical)) continue;
+       TObject *obj = currentFile.Get(farr->At(ical)->GetName());
+       if (obj) carray->AddLast(obj);
+       AliSysInfo::AddStamp(farr->At(ical)->GetName(),1,ical,counter);
+       // reading entries
+      }
+      if (carray->GetEntries()==0) continue;
+    }
+   
     if (!mergeArray) { mergeArray = carray; continue;}
     printf("Counter\t%d\tMerging file %s\n",counter,objfile.Data());
     for (Int_t icalib=0; icalib<mergeArray->GetEntries(); icalib++){
       AliTPCcalibBase *calib = ( AliTPCcalibBase *)mergeArray->At(icalib);
       //disable calib align
-      if (calib->InheritsFrom("AliTPCcalibUnlinearity")) continue;
-      //if (calib->InheritsFrom("AliTPCcalibCosmic")) continue;
+      if (!calib->InheritsFrom("AliTPCcalibBase")) continue;
+      if (calib->InheritsFrom("AliTPCcalibTrigger")) continue;  // too big
+      //
+    //   if (counter>50&&counter%2>0){
+//     if (calib->InheritsFrom("AliTPCcalibCosmic")) continue;  // too big
+//       }
+//       if (counter>100&&counter%4>0){
+//     if (calib->InheritsFrom("AliTPCcalibCosmic")) continue;  // too big
+//       }
+//       if (counter>200&&counter%8>0){
+//     if (calib->InheritsFrom("AliTPCcalibCosmic")) continue;  // too big
+//       }
       if (!calib) continue;
       printf("Merging\t%s\n",calib->GetName());
       TObjArray toMerge(1);
@@ -58,23 +84,46 @@ void CalibFileMerger(Int_t nmax=200,const char* filename = "mergelist.txt") {
       toMerge.AddAt(objectMerge,0);
       toMerge.SetOwner(kFALSE);
       calib->Merge(&toMerge);
+      AliSysInfo::AddStamp(calib->GetName(),2,icalib,counter);
     }
     AliSysInfo::AddStamp(objfile.Data(),counter,counter,counter);
-    carray->SetOwner(kTRUE);
-    carray->Delete();
-    delete carray;
+    if (carray){
+      carray->SetOwner(kTRUE);
+      carray->Delete();
+      // for (Int_t i=0; i<carray->GetEntriesFast(); i++){
+//     TObject *o = carray->At(i);
+//     if (!o) continue;
+//     printf("Delete %s\n",o->GetName());
+//     AliSysInfo::AddStamp(o->GetName(),3,i,counter);
+//     delete o;
+//       }
+      delete carray;
+    }
     counter++;
     currentFile.Close();
     if (counter>nmax) break;
   }
 
   in.close();
-  TFile * output = new TFile("CalibObjects.root", "RECREATE");
-  mergeArray->Write("TPCCalib",TObject::kSingleKey);
-  output->Close();
-
+  if (mergeArray){
+    for (Int_t icalib=0; icalib<mergeArray->GetEntries(); icalib++){
+      TFile * output = new TFile(oname, "UPDATE");
+      TObject * obj = mergeArray->At(icalib); 
+      if (!obj) continue;
+      obj->Write();
+      delete obj;
+      output->Close();
+    }
+  }
   //
-
+  // problem to stop root
+  // Make suicide
+  //
+  printf("Kill ourself\n");
+  printf("Kill ourself\n");
+  printf("Kill ourself\n");
+  printf("Kill ourself\n");
+  gSystem->Exec(Form("kill -9 %d",gSystem->GetPid()));
 }
 
 
index b1858d4..c96a4bd 100644 (file)
@@ -5,7 +5,15 @@
   //
   TMemStat *memstat = new TMemStat("new,gnubuildin");
   AliSysInfo::AddCallBack(TMemStatManager::GetInstance()->fStampCallBack);
-  AliSysInfo::AddStamp("Start");  
+  AliSysInfo::AddStamp("Start"); 
+
+  gSystem->Load("$ROOTSYS/lib/libXrdClient.so");
+  gSystem->Load("libNetx.so");
+
+  gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE") 
+  TGrid * alien =     TGrid::Connect("alien://",0,0,"t"); 
+  gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE") 
   //1. Load needed libraries
   gSystem->Load("libANALYSIS");
   gSystem->Load("libTPCcalib");
@@ -20,7 +28,8 @@
 
   //
   // Process data - chain
-  //
+  // 
+  //gEnv->SetValue("TFile.Recover", 0);  // dont try to recover anything
   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
   AliXRDPROOFtoolkit tool; 
@@ -51,7 +60,7 @@ void SetupCalibTaskTrain2(TObject * task2);
 char * prefix = "/V6/";
 // Global parameters to set
 TTimeStamp startTime(2009,8,7,0,0,0);
-TTimeStamp stopTime(2009,9,15,0,0,0);
+TTimeStamp stopTime(2009,12,31,0,0,0);
 Int_t debugLevel  = 2;
 Int_t streamLevel = 20;
 
@@ -122,7 +131,7 @@ void AddCalibCalib(TObject* task){
   AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
   AliTPCcalibCalib *calibCalib = new AliTPCcalibCalib("calibTPC","calibTPC");
   calibCalib->SetDebugLevel(debugLevel);
-  calibCalib->SetStreamLevel(streamLevel);
+  calibCalib->SetStreamLevel(0);
   calibCalib->SetTriggerMask(-1,-1,kFALSE);        //accept everything 
   myTask->AddJob(calibCalib);
 
@@ -140,7 +149,7 @@ void AddCalibTimeGain(TObject* task){
   calibTimeGain->SetUseMax(kFALSE);
   calibTimeGain->SetDebugLevel(debugLevel);
   calibTimeGain->SetStreamLevel(streamLevel);
-  calibTimeGain->SetTriggerMask(-1,-1,kTRUE);        //accept everything 
+  calibTimeGain->SetTriggerMask(-1,-1,kTRUE);        //reject laser
   myTask->AddJob(calibTimeGain);
 }
 
@@ -184,6 +193,38 @@ void AddCalibCosmic(TObject* task){
   myTask->AddJob(calibCosmic);
 }
 
+void AddCalibLaser(TObject* task){
+  //
+  // Responsible: Marian Ivanov
+  // Description:
+  // 
+  AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
+  AliTPCcalibLaser *calibLaser = new AliTPCcalibLaser("laserTPC","laserTPC");
+  calibLaser->SetDebugLevel(debugLevel);
+  calibLaser->SetStreamLevel(streamLevel);
+  calibLaser->SetTriggerMask(-1,-1,kFALSE);        //accept everything 
+  myTask->AddJob(calibLaser);
+}
+
+
+void AddCalibAlign(TObject* task){
+  //
+  // Responsible: Marian Ivanov
+  // Description:
+  // 
+  AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
+  AliTPCcalibAlign *calibAlign = new AliTPCcalibAlign("alignTPC","Alignment of the TPC sectors");
+  calibAlign->SetDebugLevel(debugLevel);
+  calibAlign->SetStreamLevel(streamLevel);
+  calibAlign->SetTriggerMask(-1,-1,kTRUE);        //accept everything 
+  myTask->AddJob(calibAlign);
+}
+
+
+
+
+
+
 void AddCalibPID(TObject* task){
   //
   // Responsible: Marian Ivanov, Alexander Kalweit
@@ -193,6 +234,9 @@ void AddCalibPID(TObject* task){
   AliTPCcalibPID *calibPID06 = new AliTPCcalibPID("calibPID06","calibPID06");
   AliTPCcalibPID *calibPID08 = new AliTPCcalibPID("calibPID08","calibPID08");
   AliTPCcalibPID *calibPID10 = new AliTPCcalibPID("calibPID10","calibPID10");
+  calibPID06->SetTriggerMask(-1,-1,kTRUE);        //reject laser
+  calibPID08->SetTriggerMask(-1,-1,kTRUE);        //reject laser
+  calibPID10->SetTriggerMask(-1,-1,kTRUE);        //reject laser
   calibPID06->SetUpperTrunc(0.6);
   calibPID08->SetUpperTrunc(0.8);
   calibPID10->SetUpperTrunc(0.99);
@@ -208,9 +252,9 @@ void AddCalibPID(TObject* task){
   calibPID06->SetPadNorm(0);
   calibPID08->SetPadNorm(0);
   calibPID10->SetPadNorm(0);
-  calibPID06->SetMIPvalue(50*3);
-  calibPID08->SetMIPvalue(50*3);
-  calibPID08->SetMIPvalue(50*3);
+  calibPID06->SetMIPvalue(50);
+  calibPID08->SetMIPvalue(50);
+  calibPID08->SetMIPvalue(50);
   //
   //
   //
@@ -229,6 +273,8 @@ void AddCalibPID(TObject* task){
 }
 
 
+
+
 //
 //
 
@@ -242,8 +288,7 @@ void SetupCalibTaskTrain1(TObject* task){
   AddCalibTimeGain(task);
   AddCalibTime(task);
   AddCalibCosmic(task);
-  AddCalibTrigger(task);
-  AddCalibPID(task);
+  //AddCalibTrigger(task);
   //
   TString path=gSystem->pwd();
   path+=prefix;
@@ -259,7 +304,8 @@ void SetupCalibTaskTrain2(TObject* task){
   AliTPCClusterParam * clusterParam = AliTPCcalibDB::Instance()->GetClusterParam(); 
   AliTPCAnalysisTaskcalib* myTask = (AliTPCAnalysisTaskcalib*) task;
   // AddCalibCalib(task);
-  // AddCalibAlign()
+  //AddCalibAlign(task);
+  AddCalibLaser(task);
   // AddCalibTracks()
   AddCalibPID(task);
   //
@@ -410,11 +456,15 @@ void SetupCalibTask(TObject* task1){
 
 
 void CalibrateTPC(Int_t first, Int_t last, Int_t run, const char*closeSE="ALICE::GSI::SE"){
+  gSystem->Load("$ROOTSYS/lib/libXrdClient.so");
+  gSystem->Load("libNetx.so");
   gSystem->Load("libANALYSIS");
   gSystem->Load("libTPCcalib");
-  gEnv->SetValue("TFile.Recover", 0);  // dont try to recover anything
+  //gEnv->SetValue("TFile.Recover", 0);  // dont try to recover anything
   gSystem->Setenv("alien_CLOSE_SE",closeSE);
   TGrid * alien =     TGrid::Connect("alien://",0,0,"t"); 
+  gSystem->Setenv("alien_CLOSE_SE",closeSE);
+
   gSystem->Exec("touch nonOK");
   gSystem->Exec("rm -f isOK");
   gROOT->Macro(Form("ConfigOCDB.C\(%d\)",run));
@@ -429,13 +479,18 @@ void CalibrateTPC(Int_t first, Int_t last, Int_t run, const char*closeSE="ALICE:
   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
   AliXRDPROOFtoolkit tool; 
-  TChain * chain = tool.MakeChain("esd.txt","esdTree",0,last-first,last);
+  TChain * chain = tool.MakeChain("esd.txt","esdTree",0,last-first,first);
   chain->Lookup();
   // memory
-  mgr->SetNSysInfo(5000); 
+  mgr->SetNSysInfo(100); 
   //
-  mgr->SetDebugLevel(1);
+  mgr->SetDebugLevel(0);
   mgr->StartAnalysis("local",chain);
   gSystem->Exec("touch isOK");
   gSystem->Exec("rm -f nonOK");
+  printf("Kill ourself\n");
+  printf("Kill ourself\n");
+  printf("Kill ourself\n");
+  printf("Kill ourself\n");
+  gSystem->Exec(Form("kill -9 %d",gSystem->GetPid()));
 }
index 815e27c..4dfea2f 100644 (file)
@@ -25,7 +25,7 @@
 
   //
   // 2. Initialization of proof
-  //
+  // 
   TProofMgr * proofmgr = TProof::Mgr("lxgrid5.gsi.de");
   TProof * proof = proofmgr->CreateSession();
   proof->SetParameter("PROOF_MaxSlavesPerNode", (Long_t)1000);
@@ -34,6 +34,7 @@
   gProof->Exec("gSystem->Load(\"libANALYSIS.so\")",kTRUE);
   gProof->Exec("gSystem->Load(\"libSTAT.so\")",kTRUE);
   gProof->Exec("gSystem->Load(\"libTPCcalib.so\")",kTRUE);
+  gProof->Exec(".x $ALICE_ROOT/TPC/macros/ConfigOCDB.C");
 
   //
   // 3 Run analysis on PROOF
   RunAliTPCCalibKrTask(kTRUE);
   
   
+  //
+  // Check the cuts for clusters
+  //
+  AliXRDPROOFtoolkit tool; 
+  TChain * chain = tool.MakeChain("list.txt","Kr",0,1000);
+  chain->Lookup();
+  chain->SetProof(kTRUE);
+
+  TCut cutR0("cutR0","fADCcluster/fSize<200");        // adjust it according v seetings - 
+  TCut cutR1("cutR1","fADCcluster/fSize>7");          // cosmic tracks and noise removal
+  TCut cutR2("cutR2","fMax.fAdc/fADCcluster<0.4");    // digital noise removal
+  TCut cutR3("cutR3","fMax.fAdc/fADCcluster>0.01");   // noise removal
+  TCut cutR4("cutR4","fMax.fTime>200");   // noise removal
+  TCut cutR5("cutR5","fMax.fTime<600");   // noise removal
+  TCut cutS1("cutS1","fSize<200");    // adjust it according v seetings - cosmic tracks
+  TCut cutAll = cutR0+cutR1+cutR2+cutR3+cutR4+cutR5+cutS1;
+
+
+
+
   //..
   //
   //
index f070274..cc8abe4 100644 (file)
@@ -8,5 +8,6 @@ void filterESD(){
   printf("Filtering esd.C\n");
   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
-  AliXRDPROOFtoolkit::FilterList("esd.txt","AliESDs.root esdTree AliESDfriends.root *",0);
+  //  AliXRDPROOFtoolkit::FilterList("esd.txt","AliESDs.root esdTree AliESDfriends.root *",0);
+  AliXRDPROOFtoolkit::FilterList("esd.txt","AliESDs.root esdTree",0);
 }