]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- adding a macro with the full CALO chain + tracking from TPC
authorodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 15 May 2010 12:53:03 +0000 (12:53 +0000)
committerodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 15 May 2010 12:53:03 +0000 (12:53 +0000)
- updating simulation configuration files to include TPC and EMCAL
- adding a macro to run them all
- updating the functionality of the run_test.py script
- adding options to the sim.C macro to exclude detectors from the simulations

HLT/CALO/macros/ConfigPi0.C
HLT/CALO/macros/ConfigSingle.C
HLT/CALO/macros/rec_hlt_calo.C [new file with mode: 0644]
HLT/CALO/macros/runAll.C [new file with mode: 0644]
HLT/CALO/macros/run_tests.py
HLT/CALO/macros/sim.C

index 1fa49b3a7955abc488667c5dd8ee8cc63a1f2481..e1f6dcffffa673c4a27b69090e5b55367345a0bf 100644 (file)
@@ -206,7 +206,7 @@ void Config()
     Int_t   iTPC   =  0;
     Int_t   iTRD   =  0;
     Int_t   iZDC   =  0;
-    Int_t   iEMCAL =  0;
+    Int_t   iEMCAL =  1;
     Int_t   iACORDE   =  0;
     Int_t   iVZERO =  0;
     rl->CdGAFile();
index bd2c794c2259c58cfa1901b0b13d9c4fdceaca9f..7b8bdcf0eb001cf971736baf8388d1a71d54bddb 100644 (file)
@@ -174,7 +174,7 @@ void Config()
     gemcal->SetMomentumRange(10.,10.);
     gemcal->SetPhiRange(95.,100.);
     gemcal->SetThetaRange(EtaToTheta(0.10),EtaToTheta(0.20));
-    gemcal->SetPart(kGamma);
+    gemcal->SetPart(kElectron);
     gener->AddGenerator(gemcal,"GENBOX GAMMA for EMCAL",1);
     
     gener->Init();
@@ -203,7 +203,7 @@ void Config()
     Int_t   iSHIL  =  0;
     Int_t   iT0 =  0;
     Int_t   iTOF   =  0;
-    Int_t   iTPC   =  0;
+    Int_t   iTPC   =  1;
     Int_t   iTRD   =  0;
     Int_t   iZDC   =  0;
     Int_t   iEMCAL =  1;
diff --git a/HLT/CALO/macros/rec_hlt_calo.C b/HLT/CALO/macros/rec_hlt_calo.C
new file mode 100644 (file)
index 0000000..49ec499
--- /dev/null
@@ -0,0 +1,256 @@
+
+void rec_hlt_calo(const char *input = "./", const char *grp = "./", bool doPhos = true, bool doEmcal = true, bool doTM = true)
+{
+
+    AliCDBManager::Instance()->SetRun(0);
+
+    if (!gSystem->AccessPathName("galice.root")) {
+        cerr << "please delete the galice.root or run at different place." << endl;
+        return;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////////////////////////////
+    //
+    // init the HLT system in order to define the analysis chain below
+    //
+    AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
+
+    // Input to the ESD converter
+    TString ecInput;
+    TString option="libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so libAliHLTCalo.so libAliHLTPHOS.so libAliHLTEMCAL.so libAliHLTGlobal.so loglevel=0x7f chains=ESD-CONVERTER";
+
+
+    if (doTM)
+    {
+
+        ///////////////////////////////////////
+        // The TPC part of the chain
+        //////////////////////////////////////
+
+        int clusterFinderType=0; // 0 = v3; 1 = decoder; 2 = packed (offline v1)
+        bool bUseCA=true;   // use the CA tracker and merger
+
+        int iMinSlice=0;
+        int iMaxSlice=35;
+        int iMinPart=0;
+        int iMaxPart=5;
+        TString writerInput;
+        TString mergerInput;
+        TString histoInput;
+        TString histogramHandlerInputClusterFinder;
+        TString cdumpInput;
+        for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
+            TString trackerInput;
+            for (int part=iMinPart; part<=iMaxPart; part++) {
+                TString arg, publisher, cf;
+                TString clusterHistoOutput;
+                // raw data publisher components
+                int ddlno=768;
+                if (part>1) ddlno+=72+4*slice+(part-2);
+                else ddlno+=2*slice+part;
+                arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x -verbose", ddlno, slice, slice, part, part);
+                publisher.Form("DP_%02d_%d", slice, part);
+                AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+
+                // cluster finder components
+                cf.Form("CF_%02d_%d", slice, part);
+                if (clusterFinderType==1) {
+                    AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), "-timebins 1001");
+                } else if (clusterFinderType==2) {
+                    AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinderPacked", publisher.Data(), "-timebins 1001 -sorted");
+                } else {
+                    AliHLTConfiguration cfconf(cf.Data(), "TPCClusterFinder32Bit", publisher.Data(), "");
+                }
+                if (trackerInput.Length()>0) trackerInput+=" ";
+                trackerInput+=cf;
+                if (writerInput.Length()>0) writerInput+=" ";
+                writerInput+=cf;
+                if (histoInput.Length()>0) histoInput+=" ";
+                histoInput+=cf;
+                if (cdumpInput.Length()>0) cdumpInput+=" ";
+                cdumpInput+=cf;
+
+                if (0) {
+                    clusterHistoOutput.Form("CH_%02d_%d", slice, part);
+                    AliHLTConfiguration cfconf(clusterHistoOutput.Data(), "TPCClusterHisto", cf.Data(), "");
+                    if (histogramHandlerInputClusterFinder.Length()>0) histogramHandlerInputClusterFinder+=" ";
+                    histogramHandlerInputClusterFinder+=clusterHistoOutput;
+                }
+            }
+            TString tracker;
+            // tracker components
+            tracker.Form("TR_%02d", slice);
+            if (bUseCA) {
+                AliHLTConfiguration trackerconf(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
+            } else {
+                AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run");
+            }
+
+            if (writerInput.Length()>0) writerInput+=" ";
+            writerInput+=tracker;
+            if (mergerInput.Length()>0) mergerInput+=" ";
+            mergerInput+=tracker;
+            //add all slice tracks to histo input
+            //if (histoInput.Length()>0) histoInput+=" ";
+            //histoInput+=tracker;
+        }
+
+        // GlobalMerger component
+        if (bUseCA) {
+            AliHLTConfiguration mergerconf("globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
+        } else {
+            AliHLTConfiguration mergerconf("globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
+        }
+
+
+
+        //add all global tracks to histo input
+        if (histoInput.Length()>0) histoInput+=" ";
+        histoInput+="globalmerger";
+
+        ecInput += " globalmerger";
+
+        // END OF TPC
+    }
+
+    if (doPhos)
+    {
+        ///////////////////////////////////////
+        // The PHOS part of the chain
+        //////////////////////////////////////
+
+        int moduleStart = 2;
+        int moduleEnd = 4;
+        int rcuStart = 0;
+        int rcuEnd = 3;
+        int rcusPerModule = 4;
+        int ddlOffset = 1792;
+
+        for (int module = moduleStart; module <= moduleEnd; module++)
+        {
+            TString clInput;
+
+            for (int rcu = rcuStart; rcu <= rcuEnd; rcu++)
+            {
+                TString arg, publisher, ra, dm;
+                // raw data publisher components
+                publisher.Form("PHS-RP_%02d_%d", module, rcu);
+                arg.Form("-minid %d -datatype 'DDL_RAW ' 'PHOS'  -dataspec 0x%x ", ddlOffset + module*(rcusPerModule) + rcu, 0x1 << (module*rcusPerModule + rcu));
+                AliHLTConfiguration pubConf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+
+                // Raw analyzer
+                arg = "";
+                ra.Form("PHS-RA_%02d_%d", module, rcu);
+                AliHLTConfiguration rawConf(ra.Data(), "PhosRawCrude", publisher.Data(), arg.Data());
+
+                // digit maker components
+                dm.Form("PHS-DM_%02d_%d", module, rcu);
+                arg="";
+                AliHLTConfiguration dmConf(dm.Data(), "PhosDigitMaker", ra.Data(), arg.Data());
+
+                if (clInput.Length() > 0) clInput += " ";
+                clInput+=dm;
+            }
+            TString arg, cl;
+
+            // Clusterizer
+            cl.Form("PHS-CL_%02d", module);
+            arg = "";
+            AliHLTConfiguration clConf(cl.Data(), "PhosClusterizer", clInput.Data(), arg.Data());
+
+            if (ecInput.Length() > 0) ecInput += " ";
+            ecInput += cl;
+        }
+
+        // END OF PHOS
+    }
+
+    if (doEmcal)
+    {
+        int moduleStart = 0;
+        int moduleEnd = 0;
+        int rcuStart = 0;
+        int rcuEnd = 1;
+        int rcusPerModule = 2;
+        int ddlOffset = 4608;
+
+        histoInput = "";
+
+        for (int module = moduleStart; module <= moduleEnd; module++)
+        {
+            TString clInput;
+
+            for (int rcu = rcuStart; rcu <= rcuEnd; rcu++)
+            {
+                TString arg, publisher, ra, dm;
+                // raw data publisher components
+                publisher.Form("EMC-RP_%02d_%d", module, rcu);
+                arg.Form("-minid %d -datatype 'DDL_RAW ' 'EMCA'  -dataspec 0x%x ", ddlOffset + module*(rcusPerModule) + rcu, 0x1 << (module*rcusPerModule + rcu));
+                AliHLTConfiguration pubConf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+
+                // Raw analyzer
+                arg = "";
+                ra.Form("EMC-RA_%02d_%d", module, rcu);
+                AliHLTConfiguration rawConf(ra.Data(), "EmcalRawCrude", publisher.Data(), arg.Data());
+
+                // digit maker components
+                dm.Form("EMC-DM_%02d_%d", module, rcu);
+                arg="";
+                AliHLTConfiguration dmConf(dm.Data(), "EmcalDigitMaker", ra.Data(), arg.Data());
+
+                if (clInput.Length() > 0) clInput += " ";
+                clInput+=dm;
+            }
+            TString arg, cl, ca;
+
+            // Clusterizer
+            cl.Form("EMC-CL_%02d", module);
+            arg = "";
+            AliHLTConfiguration clConf(cl.Data(), "EmcalClusterizer", clInput.Data(), arg.Data());
+
+            if (ecInput.Length() > 0) ecInput += " ";
+            ecInput += cl;
+        }
+
+
+        // END OF EMCAL
+    }
+
+    // If there are no tracks it shouldn't do anything...
+    AliHLTConfiguration tmconf("track-matcher", "TrackMatcher", ecInput.Data(), "");
+
+    if (doEmcal)
+    {
+        // EMCAL Histograms
+        AliHLTConfiguration hconf("emcalHistocomp", "CaloPhysicsHistos", "track-matcher", "-emcal -invariantmass -clusterenergy -matchedtracks");
+        AliHLTConfiguration fwconf("emcalHist", "ROOTFileWriter"   , "emcalHistocomp", "-datafile emcalHistograms -concatenate-events -overwrite");
+    }
+
+    if (doPhos)
+    {
+        // PHOS Histograms
+        AliHLTConfiguration hconf("phosHistocomp", "CaloPhysicsHistos", "track-matcher", "-phos -invariantmass -clusterenergy -matchedtracks");
+        AliHLTConfiguration fwconf("phosHist", "ROOTFileWriter"   , "phosHistocomp", "-datafile phosHistograms -concatenate-events -overwrite");
+    }
+    
+    TString arg, ec;
+
+
+    ec.Form("ESD-CONVERTER");
+    arg = "";
+
+    AliHLTConfiguration esdcconf(ec.Data(), "GlobalEsdConverter"   , "track-matcher", "");
+
+    AliReconstruction rec;
+
+    rec.SetInput(input);
+    rec.SetRunVertexFinder(kFALSE);
+    rec.SetRunReconstruction("HLT");
+    rec.SetRunTracking(":");
+    rec.SetLoadAlignFromCDB(0);
+    rec.SetRunQA(":");
+    //  rec.SetRunLocalReconstruction("PHOS") ;
+    rec.SetOption("HLT", option);
+    rec.SetSpecificStorage("GRP/GRP/Data", Form("local://%s", grp));
+    rec.Run();
+}
diff --git a/HLT/CALO/macros/runAll.C b/HLT/CALO/macros/runAll.C
new file mode 100644 (file)
index 0000000..5358d81
--- /dev/null
@@ -0,0 +1,9 @@
+
+int runAll(const char *data="./", const char *grp="./", bool runPhos = true, bool runEmcal = true, bool runTM = true)
+{
+  gSystem->Load("libAliHLTCalo");
+  gROOT->LoadMacro("rec_hlt_calo.C");
+  gROOT->LoadMacro("read_HLT_ESDs.C");
+  rec_hlt_calo("./", "./", runPhos, runEmcal, runTM);
+  read_HLT_ESDs();
+}
index f645f999519ea6056ac7586f927fd2fa159c45a8..44b9086e853fb343b6fb50a58318fe2634f55f54 100755 (executable)
@@ -7,6 +7,7 @@ class Simulator():
    
    def __init__(self):
       self.pwd = os.getenv("PWD")
+      print "SIMULATOR"
       
    def mkDirStructure(self):
         os.system("mkdir -p simulations/single")
@@ -15,81 +16,71 @@ class Simulator():
    def copyFiles(self):
         os.system("cp ConfigSingle.C simulations/single/Config.C")
         os.system("cp ConfigPi0.C simulations/pi0/Config.C")
-        os.system("cp sim.C simulations/single/.")
-        os.system("cp sim.C simulations/pi0/.")
+        os.system("cp sim.C simulations/single/sim.C")
+        os.system("cp sim.C simulations/pi0/sim.C")
    
    def cleanFiles(self):
         os.system("rm simulations/single/ -rf")
         os.system("rm simulations/pi0/ -rf")
    
    def initSimulation(self):
-
       self.cleanFiles()
       self.mkDirStructure()
       self.copyFiles()
 
-   def runSimulation(self):
-      
-      os.system("cd simulations/single/ && aliroot -b -q sim.C\(100\)")
+   def runSimulation(self, nevents, dophos, doemcal, dotm):
+      simargs = str(nevents) + ", " + str(int(dophos)) + ", " + str(int(doemcal)) + ", " + str(int(dotm))
+      command = "cd simulations/single/ && aliroot -b -q sim.C\'(" + simargs + ")\'"
+      os.system(command)
       os.system("cd " + self.pwd)
-   
-
-class Test(object):
-   def __init__(self):
-      print "Test"
 
-class PhosTest(Test):
+class Tester():
    def __init__(self):
-      super(PhosTest, self).__init__()
+      print "TESTER"
 
    def initTest(self):
-      
       self.pwd = os.getenv("PWD")
-      os.system("rm -rf tests/phos/")
-      os.system("mkdir -p tests/phos/single")
-      os.system("cp rec_hlt_calo_phos.C tests/phos/single/.")
-      os.system("cp runPhos.C tests/phos/single/.")
-      os.system("cp read_HLT_ESDs.C tests/phos/single/.")
-      
-   def run(self):
+      os.system("rm -rf tests/all/")
+      os.system("mkdir -p tests/all/single")
+      os.system("cp rec_hlt_calo.C tests/all/single/.")
+      os.system("cp runAll.C tests/all/single/.")
+      os.system("cp read_HLT_ESDs.C tests/all/single/.")
+
+   def run(self, dophos, doemcal, dotm):
       
+      runargs = "\"./\", \"./\", " + str(int(dophos)) + ", " + str(int(doemcal)) + ", " + str(int(dotm))
       path = self.pwd + "/simulations/single/."
-      os.system("cd tests/phos/single/;  ln -s " + path + "/raw* .; ln -s " + path + "/GRP . ; aliroot runPhos.C;")
-      
+      command = "cd tests/all/single/;  ln -s " + path + "/raw* .; ln -s " + path + "/GRP . ; aliroot runAll.C\'(" + runargs + ")\'"
+      os.system(command)
       os.system("cd " + self.pwd)
-      
-
 
-class EmcalTest(Test):
-   def __init__(self):
-      super(EmcalTest, self).__init__()
-      print "EmcalTest"
-      
 from optparse import OptionParser
 
 parser = OptionParser()
 
 parser.add_option("-s", "--simulatedata", action="store_true", dest="simulatedata",
                                 default=False, help="Simulate data for the tests")
-parser.add_option("", "--nophos", action="store_false", dest="runphos", 
-                                default=True, help="Don't run PHOS tests")
-parser.add_option("", "--noemcal", action="store_false", dest="runemcal",
-                                default=True, help="Don't run EMCAL tests")
+parser.add_option("-n", "--nevents", dest="nevents",
+                                default=100, help="Specify the number of events to simulate. If you change this the reference histograms will be useless")
+parser.add_option("", "--no-phos", action="store_false", dest="runphos", 
+                                default=True, help="Testing: Don't run PHOS tests. Simulation: Don't simulate for PHOS")
+parser.add_option("", "--no-emcal", action="store_false", dest="runemcal",
+                                default=True, help="Testing: Don't run EMCAL tests. Simulation: Don't simulate for EMCAL")
+parser.add_option("", "--no-trackmatching", action="store_false", dest="runtm",
+                                default=True, help="Testing: Don't run the track matcher, Simulation: Don't simulate TPC")
 
 (options, args) = parser.parse_args()
 
 if options.simulatedata:
    simulator = Simulator()
    simulator.initSimulation()
-   simulator.runSimulation()
-   
-if options.runphos:
-   phostest = PhosTest()
-   phostest.initTest()
-   phostest.run()
-   
-if options.runemcal:
-   emcalTest = EmcalTest()
-   #emcalTest.run()
-   
+   simulator.runSimulation(options.nevents, options.runphos, options.runemcal, options.runtm)
+   exit(0)
+
+else:
+   tester = Tester()
+   tester.initTest()
+   tester.run(options.runphos, options.runemcal, options.runtm)
+   exit(0)
+    
    
\ No newline at end of file
index dc372bd4354c398ab3e1c0defac16a5327105855..dee4d88b6adc0f03a7a4cd437070d656eccfb2dc 100644 (file)
@@ -1,9 +1,14 @@
-void sim(Int_t nev=1) {
+void sim(Int_t nev=1, bool dophos = true, bool doemcal = true, bool dotm = true) {
   
   AliSimulation simulator;
-  simulator.SetMakeSDigits("PHOS EMCAL");
-  //  simulator.SetMakeDigitsFromHits("ITS TPC");
+  TString sdigits; 
+  if(dophos) sdigits += " PHOS";
+  if(doemcal) sdigits += " EMCAL";
+  simulator.SetMakeSDigits(sdigits);
+  
+  if(dotm) simulator.SetMakeDigitsFromHits("TPC");
   //  simulator.SetWriteRawData("ALL","raw.root",kTRUE);
+  
   simulator.SetWriteRawData("ALL");
   simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
   simulator.SetSpecificStorage("GRP/GRP/Data",