--- /dev/null
+
+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();
+}
def __init__(self):
self.pwd = os.getenv("PWD")
+ print "SIMULATOR"
def mkDirStructure(self):
os.system("mkdir -p simulations/single")
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