]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
cpass0 code update (see README for more info)
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Dec 2011 09:33:09 +0000 (09:33 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 15 Dec 2011 09:33:09 +0000 (09:33 +0000)
PWG1/CalibMacros/Pass0/AddTaskT0Calib.C
PWG1/CalibMacros/Pass0/ConfigCalibTrain.C
PWG1/CalibMacros/Pass0/README
PWG1/CalibMacros/Pass0/makeOCDB.C
PWG1/CalibMacros/Pass0/merge.C
PWG1/CalibMacros/Pass0/mergeMakeOCDB.sh
PWG1/CalibMacros/Pass0/recPass0.C
PWG1/CalibMacros/Pass0/runPass0.sh

index 8b6e642f47052b38c5b2a8f9b1054d77be6e1708..3b139fa88b48c92b6d42c9f34c5218e13f511280 100755 (executable)
@@ -1,5 +1,4 @@
 
 
-
 void    readCDB (TObject *task1);
 //_____________________________________________________________________________
 AliAnalysisTask  *AddTaskT0Calib(Int_t runNumber)
 void    readCDB (TObject *task1);
 //_____________________________________________________________________________
 AliAnalysisTask  *AddTaskT0Calib(Int_t runNumber)
index 843ed19736bf95f2a02517721efac6a4feca14f2..a7c64de41841849b723801ad3ed06b0302eb5c06 100644 (file)
@@ -17,6 +17,7 @@ void ConfigCalibTrain(Int_t run, const char *ocdb="raw://"){
   printf("setting run to %d\n",run);
   AliCDBManager::Instance()->SetDefaultStorage(ocdb);
   AliCDBManager::Instance()->SetRun(run); 
   printf("setting run to %d\n",run);
   AliCDBManager::Instance()->SetDefaultStorage(ocdb);
   AliCDBManager::Instance()->SetRun(run); 
+  AliCDBManager::Instance()->InitFromSnapshot("OCDB.root");
 
   // magnetic field
   if ( !TGeoGlobalMagField::Instance()->GetField() ) {
 
   // magnetic field
   if ( !TGeoGlobalMagField::Instance()->GetField() ) {
index 74e20db7697e41587ef1f85520761198788948fd..59c5e8780467cfb65df6f8ba8cfa568bc9869607 100644 (file)
@@ -27,3 +27,52 @@ History:
 25/10/2011 - new AddTaskT0Calib.C as per http://savannah.cern.ch/bugs/?87877 and again after a quickie debugging session
 
 02/11/2011 - update from current production code (from AliEn) + adding SDD calibration task
 25/10/2011 - new AddTaskT0Calib.C as per http://savannah.cern.ch/bugs/?87877 and again after a quickie debugging session
 
 02/11/2011 - update from current production code (from AliEn) + adding SDD calibration task
+
+10/11/2011 - Update of makeOCDB.C as per https://savannah.cern.ch/task/?23987#comment10
+
+11/11/2011 - updated AddTOFAnalysisTaskCalibPass0.C as requested in https://savannah.cern.ch/task/?23987#comment23
+
+12/11/2011 - updated AddTaskTPCCalib.C as requested in http://savannah.cern.ch/bugs/?88792 (active after run 167713)
+
+13/11/2011 - updated AddTaskTPCCalib.C as requested in https://savannah.cern.ch/bugs/?88812 (active after run 167713)
+
+13/11/2011 - Disable TRD CPass0, see https://savannah.cern.ch/bugs/?88813 (disable active after run 167713 to run 167988)
+
+15/11/2011 - Modified merge.C as per https://savannah.cern.ch/task/?23160#comment86
+
+16/11/2011 - Modified merge.C as per https://savannah.cern.ch/task/?23160#comment94
+
+17/11/2011 - Update makeOCDB.C and AddTaskTRDCalib.C as per https://savannah.cern.ch/bugs/?88813#comment21. Active from run 168068.
+
+18/11/2011 - updated mergeMakeOCDB.sh and merge.C as per https://savannah.cern.ch/task/?23987#comment42. Acrive for runs >= 168066
+
+18/11/2011 - reverted changes to mergeMakeOCDB.sh (from previous comment) and updated merge.C as per https://savannah.cern.ch/task/index.php?23987#comment43 No runs were processed with the macros from https://savannah.cern.ch/task/?23987#comment42
+
+18/11/2011 - modified merge.C as per https://savannah.cern.ch/task/?23987#comment52
+
+19/11/2011 - modified merge.C as per https://savannah.cern.ch/task/?23987#comment57
+
+19/11/2011 - Reverting to AliRoot v5-01-Rev-12 and disabling the TRD task - line 'calibTask->SetMaxEvent(-1); ' in AddTaskTRDcalib.C
+
+19/11/2011 - reducing the nubmer of input files im merge.C as per https://savannah.cern.ch/task/?23987#comment64
+
+20/11/2011 - In macro makeOCDB.C commented out SetAlternativeDriftVelocityFit(kTRUE) as per https://savannah.cern.ch/bugs/index.php?88813#comment30 (related to the revert to Rev-12)
+
+22/11/2011 - Reverting back to Rev-13:
+
+a) makeOCDB.C un-commented out SetAlternativeDriftVelocityFit(kTRUE) - TRD
+b) AddTaskTRDcalib.C - commented out calibTask->SetMaxEvent(-1) - TRD
+c) AddTaskTRDcalib.C - modified 
+
+22/11/2011 - Modified AddTaskTRDCalib.C as per https://savannah.cern.ch/bugs/?88813#comment33 
+
+23/11/2011 - Modified recPass0.C MB trigger selection CPBI2WU_B1-B-NOPF-ALL to CPBI2_B1-B-NOPF-ALLNOTRD as per https://savannah.cern.ch/task/index.php?23987#comment122  
+
+
+14/12/2011 - recPass0.C - Added removal of recpoints for TPC/ITS/TRD to avoid filling up of the local disk
+
+14/12/2011 - recPass0.C, ConfigCalibTrain.C - Added OCDB snapshot for CPass0 reco and calibration train
+
+14/12/2011 - recPass0.C - switch off V0 finder, as per https://savannah.cern.ch/task/?23987#comment163
+
+15/12/2011 - sync trunk with code used for PbPb production 2011
\ No newline at end of file
index 4451fb45581cc08b39154365ca52149b5afe7307..62c48f56a1842fd3589e918e73ea72455cf2c68a 100644 (file)
@@ -95,4 +95,3 @@ void makeOCDB(TString runNumberString, TString  ocdbStorage="")
        
   return;
 }
        
   return;
 }
-
index 3df49bcaf433a407ace10a527934243bbe73d190..856aa0b6e02b8dc00a68b035677f4ce2529af0d7 100644 (file)
   .L $ALICE_ROOT/ANALYSIS/CalibMacros/MergeCalibration/merge.C
   merge("alien:///alice/cern.ch/user/j/jotwinow/CalibTrain/output","AliESDfriends_v1.root");
 */
   .L $ALICE_ROOT/ANALYSIS/CalibMacros/MergeCalibration/merge.C
   merge("alien:///alice/cern.ch/user/j/jotwinow/CalibTrain/output","AliESDfriends_v1.root");
 */
+void mergeInChunksTXT(const char* mlist, const char* dest, int maxFiles=700);
 
 
-void merge(const char* outputDir, const char* pattern)
+
+void merge(const char* outputDir, const char* pattern, Bool_t copyLocal=kFALSE)
 {
   //
   // load libraries
   //
 {
   //
   // load libraries
   //
+  printf("Merging with chunks copying turned %s\n",copyLocal ? "ON":"OFF");
   gROOT->Macro("LoadLibraries.C");
   //
   gROOT->Macro("LoadLibraries.C");
   //
-  TH1::AddDirectory(0);
-
+  cpTimeOut(outputDir, pattern,10, copyLocal);
   //
   //
-  AliFileMerger merger;
-  merger.AddReject("esdFriend"); // do not merge
-  cpTimeOut(outputDir, pattern,10);
-
   // local
   // local
-   merger.IterTXT("calib.list","CalibObjects.root",kFALSE);
+  mergeInChunksTXT("calib.list","CalibObjects.root");
+  //  AliFileMerger merger;
+  //  merger.AddReject("esdFriend"); // do not merge
+  //  merger.SetMaxFilesOpen(700);
+  //  merger.IterTXT("calib.list","CalibObjects.root",kFALSE);
 
   // alien
   //merger.IterAlien(outputDir, "CalibObjects.root", pattern);
 
 
   // alien
   //merger.IterAlien(outputDir, "CalibObjects.root", pattern);
 
-return;
+  return;
 }
 
 }
 
-void cpTimeOut(const char * searchdir, const char* pattern, Int_t timeOut=10)
+void cpTimeOut(const char * searchdir, const char* pattern, Int_t timeOut=10, Bool_t copyLocal)
 {
 
   gSystem->Setenv("XRDCLIENTMAXWAIT",Form("%d",timeOut));
 {
 
   gSystem->Setenv("XRDCLIENTMAXWAIT",Form("%d",timeOut));
@@ -51,6 +53,7 @@ void cpTimeOut(const char * searchdir, const char* pattern, Int_t timeOut=10)
   cerr<<"command: "<<command<<endl;
   TGridResult *res = gGrid->Command(command);
   if (!res) return;
   cerr<<"command: "<<command<<endl;
   TGridResult *res = gGrid->Command(command);
   if (!res) return;
+  res->Print();
   TIter nextmap(res);
   TMap *map = 0;
 
   TIter nextmap(res);
   TMap *map = 0;
 
@@ -58,7 +61,7 @@ void cpTimeOut(const char * searchdir, const char* pattern, Int_t timeOut=10)
   outputFile.open(Form("calib.list"));
   Int_t counter=0;
 
   outputFile.open(Form("calib.list"));
   Int_t counter=0;
 
-  while((map=(TMap*)nextmap()))
+  while((map=(TMap*)nextmap())) 
   {
     TObjString *objs = dynamic_cast<TObjString*>(map->GetValue("turl"));
     if (!objs || !objs->GetString().Length())
   {
     TObjString *objs = dynamic_cast<TObjString*>(map->GetValue("turl"));
     if (!objs || !objs->GetString().Length())
@@ -69,22 +72,75 @@ void cpTimeOut(const char * searchdir, const char* pattern, Int_t timeOut=10)
 
     TString src=Form("%s",objs->GetString().Data());
     TString dst=src;
 
     TString src=Form("%s",objs->GetString().Data());
     TString dst=src;
-    dst.ReplaceAll("alien:///","");
-    dst.ReplaceAll("/","_");
-    TTimeStamp s1;
-    Bool_t result = TFile::Cp(src.Data(),dst.Data(),kTRUE);
-    TTimeStamp s2;
-    AliSysInfo::AddStamp(dst.Data(),counter, result);
-    if (result)
-    {
+    Bool_t result = kTRUE;
+    if (copyLocal) {
+      dst.ReplaceAll("alien:///","");
+      dst.ReplaceAll("/","_");
+      TTimeStamp s1;
+      result = TFile::Cp(src.Data(),dst.Data(),kTRUE);
+      TTimeStamp s2;
+      AliSysInfo::AddStamp(dst.Data(),counter, result);
+    }
+    if (result) {
       counter++;
       outputFile << dst.Data()<< endl;
     }
   }
       counter++;
       outputFile << dst.Data()<< endl;
     }
   }
-  cout<<counter<<" files copied!"<<endl;
-
+  if (copyLocal) cout<<counter<<" files copied!"<<endl;
+  else           cout<<counter<<" files registerd!"<<endl;
   outputFile.close();
   gSystem->Exec("mv syswatch.log syswatch_copy.log");
   return;
 }
 
   outputFile.close();
   gSystem->Exec("mv syswatch.log syswatch_copy.log");
   return;
 }
 
+void mergeInChunksTXT(const char* mlist, const char* dest, int maxFiles)
+{
+  TH1::AddDirectory(0);
+  AliFileMerger merger;
+  //  merger.SetMaxFilesOpen(999);
+  merger.AddReject("esdFriend"); // do not merge
+  //
+  if (maxFiles<2) maxFiles = 2;
+  TString filesToMerge = mlist, fileDest = dest;
+  if (filesToMerge.IsNull()) {printf("List to merge is not provided\n"); return;}
+  if (fileDest.IsNull())     {printf("Merging destination is not provided\n"); return;}
+  const char* tmpMerge[3]={"__merge_part0.root","__merge_part1.root","__part_of_calib.list"};
+  //
+  gSystem->ExpandPathName(filesToMerge);
+  ofstream outfile;
+  ifstream infile(filesToMerge.Data());
+  if (!infile) {printf("No %s file\n",filesToMerge.Data()); return;}
+  //
+  int currTmp = 0, nfiles = 0, nparts = 0; // counter for number of merging operations
+  string line;
+  TString lineS;
+  while ( !infile.eof() ) {
+    getline(infile, line); 
+    lineS = line;
+    if (lineS.IsNull() || lineS.BeginsWith("#")) continue;
+    int st = nfiles%maxFiles;
+    if (st==0) { // new chunk should be started
+      if (nfiles) { // merge prev. chunk
+       outfile.close();
+       merger.IterTXT(tmpMerge[2], tmpMerge[currTmp] ,kFALSE);
+       printf("Merging to %s | %d files at step %d\n",tmpMerge[currTmp], nfiles,nparts);
+      }
+      outfile.open(tmpMerge[2], ios::out); // start list for new chunk  
+      if (nparts++) {
+       printf("Adding previous result %s | %d files %d at part\n",tmpMerge[currTmp], nfiles,nparts);
+       outfile << tmpMerge[currTmp] << endl; // result of previous merge goes 1st
+      }
+      currTmp = (currTmp==0) ? 1:0;         // swap tmp files
+    }
+    outfile << line << endl;
+    nfiles++;
+  }
+  // merge the rest
+  merger.IterTXT(tmpMerge[2], dest ,kFALSE);
+  outfile.close();
+  infile.close();
+  for (int i=0;i<3;i++) gSystem->Exec(Form("if [ -e %s ]; then \nrm %s\nfi",tmpMerge[i],tmpMerge[i]));
+  printf("Merged %d files in %d steps\n",nfiles, nparts);
+  //
+}
+
index 97cd66c0f8192672a59d0a4affa21b4ca2c5ec26..e818ae023b11053caafd176bd99c1b40ff5ad7b9 100755 (executable)
@@ -3,7 +3,7 @@
 # Script to merge objects coming out of the calibration train:
 # Arguments:
 #    1 - directory on which to look for the files to be merged 
 # Script to merge objects coming out of the calibration train:
 # Arguments:
 #    1 - directory on which to look for the files to be merged 
-#    2 - run number
+#    2 - pattern
 #    3 - OCDB output path
 
 # example:
 #    3 - OCDB output path
 
 # example:
 
 #ALIEN setting
 # $1 = directory where to perform the find 
 
 #ALIEN setting
 # $1 = directory where to perform the find 
-# $2 = run number
+# $2 = pattern
 # $3 = OCDB path
 
 # $3 = OCDB path
 
+if [ -f Run0_999999999_v3_s0.root ]; then
+    mkdir -p TPC/Calib/Correction
+    mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
+fi
+
 echo ">>>>>>> Running AliRoot to merge calib objects found in $1 with pattern AliESDfriends_v1.root"
 aliroot -l -b -q merge.C\(\"$1\",\"AliESDfriends_v1.root\"\) 2>&1 | tee merge.log
 mv syswatch.log syswatch_merge.log
 echo ">>>>>>> Running AliRoot to merge calib objects found in $1 with pattern AliESDfriends_v1.root"
 aliroot -l -b -q merge.C\(\"$1\",\"AliESDfriends_v1.root\"\) 2>&1 | tee merge.log
 mv syswatch.log syswatch_merge.log
index 9b115c2a823f485cdc4f97fc2345381b27f4074b..a60f6cf49cb17dcdd3f745fc08835ef585f725e2 100644 (file)
@@ -1,6 +1,6 @@
 /*
    rec.C to be used for pass0
 /*
    rec.C to be used for pass0
-   - reconstruction of raw data  
+   - reconstruction of raw data
    - QA information switched off
    - store all friends
    - default OCDB storage set to "raw://"
    - QA information switched off
    - store all friends
    - default OCDB storage set to "raw://"
@@ -15,16 +15,31 @@ void recPass0(const char *filename="raw.root",Int_t nevents=-1, const char *ocdb
   // Set the CDB storage location
   AliCDBManager * man = AliCDBManager::Instance();
   man->SetDefaultStorage(ocdb);
   // Set the CDB storage location
   AliCDBManager * man = AliCDBManager::Instance();
   man->SetDefaultStorage(ocdb);
+
   // Reconstruction settings
   AliReconstruction rec;
   // Reconstruction settings
   AliReconstruction rec;
+  // Upload CDB entries from the snapshot (local root file)                                                                        
+  rec.SetFromCDBSnapshot("OCDB.root");
 
   // All friends
   rec.SetFractionFriends(1.0);
 
 
   // All friends
   rec.SetFractionFriends(1.0);
 
+ // AliReconstruction settings - hardwired MB trigger for calibration
+
+  TString newfilename = filename;
+//  newfilename += "?Trigger=CPBI2_B1-B-NOPF-ALLNOTRD";
+  rec.SetInput(newfilename.Data());
+
   // Set protection against too many events in a chunk (should not happen)
   if (nevents>0) rec.SetEventRange(0,nevents);
 
   // Set protection against too many events in a chunk (should not happen)
   if (nevents>0) rec.SetEventRange(0,nevents);
 
+  // Remove recpoints after each event
+  rec.SetDeleteRecPoints("TPC TRD ITS");
+
+  // Switch off the V0 finder - saves time!
+  rec.SetRunMultFinder(kFALSE);
+  rec.SetRunV0Finder(kFALSE); 
+
   //
   // QA options - all QA is off
   //
   //
   // QA options - all QA is off
   //
@@ -34,12 +49,14 @@ void recPass0(const char *filename="raw.root",Int_t nevents=-1, const char *ocdb
   // AliReconstruction settings
   rec.SetWriteESDfriend(kTRUE);
   rec.SetWriteAlignmentData();
   // AliReconstruction settings
   rec.SetWriteESDfriend(kTRUE);
   rec.SetWriteAlignmentData();
-  rec.SetInput(filename);
   rec.SetUseTrackingErrorsForAlignment("ITS");
   rec.SetRunReconstruction("ALL");
   rec.SetFillESD("ALL");
   rec.SetCleanESD(kFALSE);
 
   rec.SetUseTrackingErrorsForAlignment("ITS");
   rec.SetRunReconstruction("ALL");
   rec.SetFillESD("ALL");
   rec.SetCleanESD(kFALSE);
 
+  // Specific reco params for ZDC (why isn't this automatic?)
+//  rec.SetRecoParam("ZDC",AliZDCRecoParamPbPb::GetHighFluxParam(2760));
+
   //Ignore SetStopOnError
   rec.SetStopOnError(kFALSE);
 
   //Ignore SetStopOnError
   rec.SetStopOnError(kFALSE);
 
@@ -47,4 +64,3 @@ void recPass0(const char *filename="raw.root",Int_t nevents=-1, const char *ocdb
   rec.Run();
 }
 
   rec.Run();
 }
 
-
index a35cadffd4d996ebc33ba3c88e99cee369bb3ae4..39c89e6574bd17eca85df8c651d6b481c03a5a86 100644 (file)
 # $1 = raw input filename
 runnum=`echo $1 | cut -d "/" -f 6`
 
 # $1 = raw input filename
 runnum=`echo $1 | cut -d "/" -f 6`
 
+if [ -f Run0_999999999_v3_s0.root ]; then
+    mkdir -p TPC/Calib/Correction
+    mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
+fi
+
+
 #Local setting
 #entries=$2
 #runnum=$3
 #Local setting
 #entries=$2
 #runnum=$3
@@ -41,4 +47,3 @@ mv syswatch.log syswatch_rec.log
 echo ">>>>>>> Running AliRoot to make calibration..."
 aliroot -l -b -q  runCalibTrain.C\(\"$runnum\"\)   2>&1 | tee calib.log
 mv syswatch.log syswatch_calib.log
 echo ">>>>>>> Running AliRoot to make calibration..."
 aliroot -l -b -q  runCalibTrain.C\(\"$runnum\"\)   2>&1 | tee calib.log
 mv syswatch.log syswatch_calib.log
-