]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/WriteAOD.C
Implement comparison of sim and rec CDB's, by default for the TPC/RecoParam only
[u/mrichter/AliRoot.git] / ANALYSIS / WriteAOD.C
index be01e60ea61354a3f59154cf751196895cde4465..b10ea063e4df959f16e75ab4dbf2f783a3215cec 100644 (file)
@@ -2,6 +2,7 @@
   #include "$(ALICE_ROOT)/TPC/alles.h"
   #include "AliReader.h"
   #include "AliReaderKineTree.h"
+  #include "AliReaderESDTree.h"
   #include "AliAODParticleCut.h"
   #include "AliAOD.h"
   #include "AliAODPairCut.h"
@@ -34,6 +35,8 @@ void WriteAOD(Option_t* datatype, Int_t first = -1,Int_t last = -1,
 //
 //these names I use when analysis is done directly from CASTOR files via RFIO
 
+  Bool_t multcheck = kTRUE;
+
   const char* basedir=".";
   const char* serie="";
   const char* field = "";
@@ -44,12 +47,38 @@ void WriteAOD(Option_t* datatype, Int_t first = -1,Int_t last = -1,
   gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
   cout<<"WriteAOD.C: ..... Loaded\n";
   
-  Bool_t multcheck = kTRUE;
+  Int_t PID[11];
+
+  PID[0]=kProton;
+  PID[1]=kProtonBar;
+  PID[2]=kKPlus;
+  PID[3]=kKMinus;
+  PID[4]=kPiPlus;
+  PID[5]=kPiMinus;
+  PID[6]=kElectron;
+  PID[7]=kPositron;
+  PID[8]=kMuonMinus;
+  PID[9]=kMuonPlus;
+  PID[10]=0;//Last must be 0!!!!!!!!!!!!!!!!!!
+  
+  Float_t PIDprob[11];
+  PIDprob[0] = 0.5;
+  PIDprob[1] = 0.5;
+  PIDprob[2] = 0.5;
+  PIDprob[3] = 0.5;
+  PIDprob[4] = 0.5;
+  PIDprob[5] = 0.5;
+  PIDprob[6] = 0.5;
+  PIDprob[7] = 0.5;
+  PIDprob[8] = 0.5;
+  PIDprob[9] = 0.5;
+  PIDprob[10] = 0.5;
   /***********************************************************/
    
   AliReader* reader;
   Int_t kine = strcmp(datatype,"Kine");
   Int_t ESD = strcmp(datatype,"ESD");
+  Int_t ESDMuon = strcmp(datatype,"ESDMuon");
   Int_t intern = strcmp(datatype,"AOD");
 
   if(!kine)
@@ -62,15 +91,41 @@ void WriteAOD(Option_t* datatype, Int_t first = -1,Int_t last = -1,
    {
     AliReaderESD* esdreader = new AliReaderESD();
     esdreader->ReadSimulatedData(kTRUE);
+    esdreader->SetNumberOfTrackPoints(5,30.);//5 points every 30 cm
+    esdreader->SetITSTrackPoints(kTRUE);
+    esdreader->SetClusterMap(kTRUE);
+    
     reader = esdreader;
     multcheck = kTRUE;
    }
 
   else if(!intern)
    {
-    reader = new AliHBTReaderAOD("AOD.root");
+    AliReaderAOD* aodreader = new AliReaderAOD("AOD.root");
+    if (strstr(processopt,"Particles"))
+      aodreader->ReadSimulatedData(kTRUE);
+    else
+      aodreader->ReadSimulatedData(kFALSE);
+    
+    reader = aodreader;
+    
     multcheck = kTRUE;
    }
+
+  else if (!ESDMuon)
+   {
+     // set reader for ESD
+     AliReaderESDTree* muonreader = new AliReaderESDTree("AliESDs.root");
+     // active muon ESD reader
+     muonreader->SetReadMuon(kTRUE);
+     // disable central barrel (default = kTRUE)
+     muonreader->SetReadCentralBarrel(kFALSE);
+     // disable simulated data (not implemented yet)
+     muonreader->ReadSimulatedData(kFALSE);
+
+     reader = muonreader;
+     multcheck = kFALSE;
+   }
   else
    {
     cerr<<"Option "<<datatype<<"  not recognized. Exiting"<<endl;
@@ -92,15 +147,24 @@ void WriteAOD(Option_t* datatype, Int_t first = -1,Int_t last = -1,
       }
     }
 
-   reader->SetDirs(dirs);
-    
-   AliAODParticleCut* readerpartcut= new AliAODParticleCut();
-   readerpartcut->SetPtRange(0.4,1.2);
-   readerpartcut->SetPID(kPiPlus);
-   AliAODPIDCut* pidcut = new AliAODPIDCut(kPiPlus,0.5);
-   readerpartcut->AddBasePartCut(pidcut);
-   
-   reader->AddParticleCut(readerpartcut);//read this particle type with this cut
+  reader->SetDirs(dirs);
+
+  AliAODParticleCut* readerpartcut= new AliAODParticleCut();
+
+  Int_t l = 0;
+  while (PID[l] != 0)
+   {
+     cout<<"WriteAOD.C: Adding PID  = "<<PID[l]<<" l = "<<l<<endl;
+     readerpartcut->SetPID(PID[l]);
+     AliAODParticleCut * pcut = (AliAODParticleCut*)readerpartcut->Clone();
+     AliAODPIDCut* pidcut = new AliAODPIDCut(PID[l],PIDprob[l]);
+     pcut->AddBasePartCut(pidcut);
+     reader->AddParticleCut(pcut);//read this particle type with this cut
+     delete pcut;
+     l++;
+   }
+  
+//   readerpartcut->SetPtRange(0.0,1.2);
 
    cout<<"WriteAOD.C:   P R O C S E S S I N G .....\n\n";
    AliReaderAOD::WriteAOD(reader,outfile,"AliAODParticle",multcheck);