diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..4f197fbf6 --- /dev/null +++ b/.clang-format @@ -0,0 +1,90 @@ +--- +Language: Cpp +# BasedOnStyle: sphenix +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: true +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: true +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeCategories: + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: false +IndentWidth: 2 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Right +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +TabWidth: 8 +UseTab: Never +... + diff --git a/.gitignore b/.gitignore index 056828149..99a83f379 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,11 @@ tmtags # For rubinius: *.rbc + +# root/G4 output files +*.root +*.macro + +# valgrind +*.valgrind +*.log diff --git a/CDBTest/CDBUtils.C b/CDBTest/CDBUtils.C new file mode 100644 index 000000000..149de83f1 --- /dev/null +++ b/CDBTest/CDBUtils.C @@ -0,0 +1,153 @@ +#ifndef TESTCDBGLOBALTAGS_C +#define TESTCDBGLOBALTAGS_C + +#include +#include + +#include + +R__LOAD_LIBRARY(libsphenixnpc.so) +R__LOAD_LIBRARY(libphool.so) + +CDBUtils *uti = nullptr; + +CDBUtils *getCDBUtils() +{ + return uti; +} + +void listGlobalTags() +{ + if (!uti) uti = new CDBUtils(); + uti->listGlobalTags(); + return; +} + +void listPayloadTypes() +{ + if (!uti) uti = new CDBUtils(); + uti->listPayloadTypes(); + return; +} + +void listPayloadIOVs(uint64_t iov) +{ + if (!uti) uti = new CDBUtils(); + uti->listPayloadIOVs(iov); + return; +} + +void createGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->createGlobalTag(tagname); + return; +} + +void deleteGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->deleteGlobalTag(tagname); + return; +} + +void lockGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->lockGlobalTag(tagname); + return; +} + +void unlockGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->unlockGlobalTag(tagname); + return; +} + +int setGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + int iret = uti->setGlobalTag(tagname); + return iret; +} + +int cloneGlobalTag(const std::string &source, const std::string &target) +{ + if (!uti) uti = new CDBUtils(); + int iret = uti->cloneGlobalTag(source, target); + return iret; +} + + +int createPayloadType(const std::string &pt) +{ + if (!uti) uti = new CDBUtils(); + int iret = uti->createPayloadType(pt); + return iret; +} + +int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start) +{ + if (!uti) uti = new CDBUtils(); + if (uti->isGlobalTagSet()) + { + uti->insertPayload(pl_type,file_url,iov_start); + } + return 0; +} + +int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start, uint64_t iov_end) +{ + if (!uti) uti = new CDBUtils(); + if (uti->isGlobalTagSet()) + { + uti->insertPayload(pl_type,file_url,iov_start,iov_end); + } + return 0; +} + +std::string getCalibration(const std::string &pl_type, uint64_t iov) +{ + if (!uti) uti = new CDBUtils(); + return uti->getUrl(pl_type,iov); +} + +void clearCache() +{ + if (!uti) uti = new CDBUtils(); + return uti->clearCache(); +} + +void Verbosity(int verb) +{ + if (!uti) uti = new CDBUtils(); + return uti->Verbosity(verb); +} + +int deletePayloadIOV(const std::string& pl_type, uint64_t iov_start) +{ + if (!uti) uti = new CDBUtils(); + return uti->deletePayloadIOV(pl_type,iov_start); +} + +int deletePayloadIOV(const std::string& pl_type, uint64_t iov_start, uint64_t iov_end) +{ + if (!uti) uti = new CDBUtils(); + return uti->deletePayloadIOV(pl_type,iov_start, iov_end); +} + +void TestCDBInsert() +{ + recoConsts *rc = recoConsts::instance(); +// please choose a unique name, if it is your username it's easier to see who created it + rc->set_StringFlag("CDB_GLOBALTAG","pinkenbu"); + SphenixClient *cdb = new SphenixClient(rc->get_StringFlag("CDB_GLOBALTAG")); + cdb->createPayloadType("TestBeginValidity"); + cout << cdb->insertPayload("TestBeginValidity","test.root",10) << endl; + cdb->createPayloadType("TestBeingEndValidity"); + cdb->insertPayload("TestBeingEndValidity","test.root",10,20); + return; +} + +#endif diff --git a/CDBTest/README b/CDBTest/README new file mode 100644 index 000000000..222f0567c --- /dev/null +++ b/CDBTest/README @@ -0,0 +1,23 @@ +Setup: + +modify mycdb.json, replace /sphenix/user/pinkenbu/cdbtest/ by an area you can write to (make sure it exists). Leave the other fields in the read_dir_list unchanged - in case your tests need other existing calibrations. The master copy of this is $NOPAYLOADCLIENT_CONF in case there are updates I forgot to merge with mycdb.json + +set NOPAYLOADCLIENT_CONF to this file (if you stay in this dir you don't need the full path): + +setenv NOPAYLOADCLIENT_CONF mycdb.json +or when using bash +export NOPAYLOADCLIENT_CONF=mycdb.json + +TestCDBTTree.C creates a small CDBTTree object and writes it to test.root + +TestCDBHistos.C creates a few histograms and writes them to test.root + +Do not mix CDBTTree and CDBHistos, you can only save only one or the other (likely, have't tried that) + + +TestCDBInsert.C inserts test.root into the cdb using your configuration. Modify this macro to use your own global tag. The macro will give errors when you run it multiple times because the global tag and the payload type exist now. Don't worry about those. + +TestCDBRead.C reads the file back from the cdb trying different time stamps. The limited validity range does not work yet + +CDBUtils.C gives you some utilities to interact with the CDB (create global tags and payloads, set global tags, list tags and payloads etc.) + diff --git a/CDBTest/TestCDBHistos.C b/CDBTest/TestCDBHistos.C new file mode 100644 index 000000000..76d373ffa --- /dev/null +++ b/CDBTest/TestCDBHistos.C @@ -0,0 +1,40 @@ +#include + +R__LOAD_LIBRARY(libcdbobjects.so) + +void TestCDBHistos(const std::string &fname = "testhistos.root") +{ + CDBHistos *cdbhistos = new CDBHistos(fname); + TH1 *h1 = new TH1F("h1","best 1d ever",100,0,1); + cdbhistos->registerHisto(h1); + TH2 *h2 = new TH2F("h2","best 2d ever",100,0,1,100,1,2); + cdbhistos->registerHisto(h2); + TH3 *h3 = new TH3F("h3","best 3d ever",100,0,1,100,1,2,100,2,3); + cdbhistos->registerHisto(h3); + TProfile *tp = new TProfile("tp","best tprofile ever",100,0,1,-10,10); + cdbhistos->registerHisto(tp); + for (int i = 0; i<100; i++) + { + h1->Fill(i/100.); + h2->Fill(i/100.,1+i/100.); + h3->Fill(i/100.,1+i/100.,2+i/100.,1.); + tp->Fill(i/100.,1+i/100.); + } + cdbhistos->WriteCDBHistos(); + delete cdbhistos; +} + +CDBHistos *TestWrite(const std::string &fname = "testhistos.root") +{ + CDBHistos *cdbhistos = new CDBHistos(fname); + return cdbhistos; +} + +CDBHistos *Read(const std::string &fname = "testhistos.root") +{ + CDBHistos *cdbhistos = new CDBHistos(fname); + cdbhistos->LoadCalibrations(); + cdbhistos->Print(); + cdbhistos->getHisto("h1")->Draw(); + return cdbhistos; +} diff --git a/CDBTest/TestCDBInsert.C b/CDBTest/TestCDBInsert.C new file mode 100644 index 000000000..fef90dd79 --- /dev/null +++ b/CDBTest/TestCDBInsert.C @@ -0,0 +1,28 @@ +#ifndef TESTCDBINSERT_C +#define TESTCDBINSERT_C + +#include + +#include + +R__LOAD_LIBRARY(libsphenixnpc.so) +R__LOAD_LIBRARY(libphool.so) + +// if you get errors like +// Error inserting payload test.root, msg: "DataBaseException: Global Tag is locked." +// use CDBUtils to unlock your global tag (unlockGlobalTag("") + +void TestCDBInsert() +{ + recoConsts *rc = recoConsts::instance(); +// please choose a unique name, if it is your username it's easier to see who created it + rc->set_StringFlag("CDB_GLOBALTAG","pinkenbu"); + CDBUtils *cdb = new CDBUtils(rc->get_StringFlag("CDB_GLOBALTAG")); + cdb->createPayloadType("TestBeginValidity"); + cdb->insertPayload("TestBeginValidity","test.root",10); + cdb->createPayloadType("TestBeginEndValidity"); + cdb->insertPayload("TestBeginEndValidity","test.root",10,20); + return; +} + +#endif diff --git a/CDBTest/TestCDBRead.C b/CDBTest/TestCDBRead.C new file mode 100644 index 000000000..86c6150b6 --- /dev/null +++ b/CDBTest/TestCDBRead.C @@ -0,0 +1,40 @@ +#ifndef TESTCDBREAD_C +#define TESTCDBREAD_C + +#include + +#include + +R__LOAD_LIBRARY(libffamodules.so) +R__LOAD_LIBRARY(libphool.so) + +void TestCDBRead() +{ + recoConsts *rc = recoConsts::instance(); +// please choose a unique name, if it is your username it's easier to see who created it + rc->set_StringFlag("CDB_GLOBALTAG","pinkenbu"); + rc->set_uint64Flag("TIMESTAMP",6); +// 1000000 is the insert timestamp. Higher timestamps work, lower time stamps do not + CDBInterface *cdb = CDBInterface::instance(); + cout << "using insert timestamp to retrieve no end time payload" << endl; + rc->set_uint64Flag("TIMESTAMP",10); + cout << cdb->getUrl("TestBeginValidity") << endl; + cout << "using larger timestamp to retrieve no end time payload" << endl; + rc->set_uint64Flag("TIMESTAMP",100); + cout << cdb->getUrl("TestBeginValidity") << endl; + cout << "using smaller timestamp to retrieve no end time payload" << endl; + rc->set_uint64Flag("TIMESTAMP",1); + cout << cdb->getUrl("TestBeginValidity") << endl; + + cout << "using timestamp in range to retrieve calibration with end time" << endl; + rc->set_uint64Flag("TIMESTAMP",15); + cout << cdb->getUrl("TestBeginEndValidity") << endl; + cout << "using timestamp outside range to retrieve calibration with end time" << endl; + rc->set_uint64Flag("TIMESTAMP",25); + cout << cdb->getUrl("TestBeginEndValidity") << endl; + gSystem->Exit(0); + return; +} + +#endif + diff --git a/CDBTest/TestCDBSubsysReco.C b/CDBTest/TestCDBSubsysReco.C new file mode 100644 index 000000000..21aec652a --- /dev/null +++ b/CDBTest/TestCDBSubsysReco.C @@ -0,0 +1,60 @@ +// This example runs the CDBInterface like in the real reconstruction +// once the CDBInterface instance is created it registers itself with the +// Fun4AllServer and creates (or adds to) the CdbUrl Node which contains a +// record of the files and timestamps which were used +#ifndef TESTCDBREAD_C +#define TESTCDBREAD_C + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libffamodules.so) +R__LOAD_LIBRARY(libphool.so) + +void TestCDBSubsysReco() +{ + recoConsts *rc = recoConsts::instance(); +// please choose a unique name, if it is your username it's easier to see who created it + rc->set_StringFlag("CDB_GLOBALTAG","pinkenbu"); + rc->set_uint64Flag("TIMESTAMP",6); + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); + + CDBInterface *cdb = CDBInterface::instance(); + cout << "using insert timestamp to retrieve" << endl; + rc->set_uint64Flag("TIMESTAMP",10); + cout << cdb->getUrl("TestBeginValidity") << endl; + cout << "using larger timestamp to retrieve" << endl; + rc->set_uint64Flag("TIMESTAMP",100); + cout << cdb->getUrl("TestBeginValidity") << endl; + cout << "using smaller timestamp to retrieve" << endl; + rc->set_uint64Flag("TIMESTAMP",1); + cout << cdb->getUrl("TestBeginValidity") << endl; + + cout << "using timestamp in range to retrieve calibration" << endl; + rc->set_uint64Flag("TIMESTAMP",15); + cout << cdb->getUrl("TestBeginEndValidity") << endl; + cout << "using timestamp outside range to retrieve calibration" << endl; + rc->set_uint64Flag("TIMESTAMP",25); + cout << cdb->getUrl("TestBeginEndValidity") << endl; + + Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); + in->Verbosity(1); + se->registerInputManager(in); + se->run(1); + CDBInterface::instance()->Print(); // print used DB files + se->End(); + se->Print("NODETREE"); + std::cout << "All done" << std::endl; + delete se; + + gSystem->Exit(0); + return; +} + +#endif + diff --git a/CDBTest/TestCDBTTree.C b/CDBTest/TestCDBTTree.C new file mode 100644 index 000000000..d2195141f --- /dev/null +++ b/CDBTest/TestCDBTTree.C @@ -0,0 +1,89 @@ +#include + +R__LOAD_LIBRARY(libcdbobjects.so) + +void TestCDBTTree(const std::string &fname = "test.root") +{ + CDBTTree *cdbttree = new CDBTTree(fname); + cdbttree->SetSingleFloatValue("Test",25); + cdbttree->SetSingleFloatValue("Test2",22); + cdbttree->SetSingleFloatValue("Test3",23); + cdbttree->SetSingleFloatValue("Test4",24); + cdbttree->SetSingleIntValue("Tes2",24); + cdbttree->SetSingleDoubleValue("Tes2",TMath::Pi()); + cdbttree->SetSingleUInt64Value("Tes2",12486346984672562); + cdbttree->CommitSingle(); + cdbttree->SetFloatValue(2,"Tst",25); + cdbttree->SetFloatValue(2,"Tt2",22); + cdbttree->SetFloatValue(2,"Tes",23); + cdbttree->SetFloatValue(2,"gaga",24); + cdbttree->SetFloatValue(4,"Tst",5); + cdbttree->SetFloatValue(4,"Tt2",2); + cdbttree->SetFloatValue(4,"Tes",3); + cdbttree->SetFloatValue(4,"Tara",7); + cdbttree->SetIntValue(10,"blar",2864); + cdbttree->SetUInt64Value(10,"blatr",28); + for (int i=0; i<10; i++) + { + string varname = "dvar" + to_string(i); + cdbttree->SetDoubleValue(23,varname,28875342.867); + } + cdbttree->Commit(); + cdbttree->Print(); + cdbttree->WriteCDBTTree(); + delete cdbttree; + gSystem->Exit(0); +} + +CDBTTree *TestWrite(const std::string &fname = "test.root") +{ + CDBTTree *cdbttree = new CDBTTree(fname); + cdbttree->SetSingleFloatValue("Test",25); + cdbttree->SetSingleFloatValue("Test2",22); + cdbttree->SetSingleFloatValue("Test3",23); + cdbttree->SetSingleFloatValue("Test4",24); + cdbttree->SetSingleIntValue("Tes2",24); + cdbttree->SetSingleDoubleValue("Tes2",TMath::Pi()); + cdbttree->SetSingleUInt64Value("Tes2",12486346984672562); + cdbttree->CommitSingle(); + cdbttree->SetFloatValue(2,"Tst",25); + cdbttree->SetFloatValue(2,"Tt2",22); + cdbttree->SetFloatValue(2,"Tes",23); + cdbttree->SetFloatValue(2,"gaga",24); + cdbttree->SetFloatValue(4,"Tst",5); + cdbttree->SetFloatValue(4,"Tt2",2); + cdbttree->SetFloatValue(4,"Tes",3); + cdbttree->SetFloatValue(4,"Tara",7); + cdbttree->SetIntValue(10,"blar",2864); + cdbttree->SetUInt64Value(10,"blatr",28); + for (int i=0; i<100; i++) + { + string varname = "dvar"; + string varname2 = "dvar2"; + string varname3 = "dvar3"; + string varname4 = "dvar4"; + for (int j=0; j<25; j++) + { + cdbttree->SetDoubleValue(j,varname,28875342.867*j); + cdbttree->SetDoubleValue(j,varname2,2.867*j); + cdbttree->SetDoubleValue(j,varname3,28875.8*j); + cdbttree->SetDoubleValue(j,varname4,28875342*j); + } + } + return cdbttree; +} + +void Read(const std::string &fname = "test.root") +{ + CDBTTree *cdbttree = new CDBTTree(fname); + cdbttree->LoadCalibrations(); + cout << "Test2: " << cdbttree->GetSingleFloatValue("Test2") << endl; + cout << "Tt2(2): " << cdbttree->GetFloatValue(2,"Tt2") << endl; + cout << "Tt2(4): " << cdbttree->GetFloatValue(4,"Tt2") << endl; + cout << "blar: " << cdbttree->GetIntValue(10,"blar") << endl; + cout << "int Tt2(4): " << cdbttree->GetIntValue(4,"Tt2") << endl; + cout << "dvar5: " << cdbttree->GetDoubleValue(23,"dvar5"); + cdbttree->Print(); + delete cdbttree; + gSystem->Exit(0); +} diff --git a/CDBTest/mycdb.json b/CDBTest/mycdb.json new file mode 100644 index 000000000..6d787673b --- /dev/null +++ b/CDBTest/mycdb.json @@ -0,0 +1,13 @@ +{ + "base_url": "nopayloaddb.apps.rcf.bnl.gov", + "api_res": "/api/cdb_rest/", + "write_dir": "/sphenix/user/pinkenbu/cdbtest/", + "read_dir_list": ["/cvmfs/sphenix.sdcc.bnl.gov/calibrations/sphnxpro/cdb/", "/sphenix/cvmfscalib/sphnxpro/cdb/","/sphenix/user/pinkenbu/cdbtest/" ], + "n_retries": 5, + "print_time_stamps": false, + "cache_life_time": 10, + "cache_max_mb": 1, + "use_fake_backend": false, + "logger": "terminal", + "log_level": "INFO" +} diff --git a/CaloProduction/Fun4All_CaloProduction.C b/CaloProduction/Fun4All_CaloProduction.C new file mode 100644 index 000000000..8f0861ec0 --- /dev/null +++ b/CaloProduction/Fun4All_CaloProduction.C @@ -0,0 +1,94 @@ +#ifndef FUN4ALL_CALOPRODUCTION_C +#define FUN4ALL_CALOPRODUCTION_C + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + + +#include + + + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libffamodules.so) + +void Fun4All_CaloProduction(const std::string &fname = "/sphenix/user/trinn/combined_event_prdfs/calib-00007377-0000.prdf", const std::string &outfile = "testfile.root", int nskip = 0, int nevents = 0) +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + recoConsts *rc = recoConsts::instance(); + + //=============== + // conditions DB flags + //=============== + rc->set_StringFlag("CDB_GLOBALTAG","MDC2"); + rc->set_uint64Flag("TIMESTAMP",6); + + CaloTowerBuilder *ca = new CaloTowerBuilder(); + ca->set_detector_type(CaloTowerBuilder::CEMC); + ca->set_nsamples(31); + ca->set_processing_type(CaloWaveformProcessing::TEMPLATE); + se->registerSubsystem(ca); + + CaloTowerBuilder *ca1 = new CaloTowerBuilder(); + ca1->set_detector_type(CaloTowerBuilder::HCALIN); + ca1->set_nsamples(31); + ca1->set_processing_type(CaloWaveformProcessing::TEMPLATE); + se->registerSubsystem(ca1); + + CaloTowerBuilder *ca2 = new CaloTowerBuilder(); + ca2->set_detector_type(CaloTowerBuilder::HCALOUT); + ca2->set_nsamples(31); + ca2->set_processing_type(CaloWaveformProcessing::TEMPLATE); + se->registerSubsystem(ca2); + + //default is FAST + CaloTowerBuilder *ca3 = new CaloTowerBuilder(); + ca3->set_detector_type(CaloTowerBuilder::ZDC); + ca3->set_nsamples(31); + se->registerSubsystem(ca3); + + CaloGeomMapping *cgm = new CaloGeomMapping(); + cgm->set_detector_name("CEMC"); + se->registerSubsystem(cgm); + + CaloGeomMapping *cgm1 = new CaloGeomMapping(); + cgm1->set_detector_name("HCALIN"); + se->registerSubsystem(cgm1); + + CaloGeomMapping *cgm2 = new CaloGeomMapping(); + cgm2->set_detector_name("HCALOUT"); + se->registerSubsystem(cgm2); + + Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in"); + in->fileopen(fname); + se->registerInputManager(in); + + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfile); + se->registerOutputManager(out); + + + se->skip(nskip); + se->run(nevents); + CDBInterface::instance()->Print(); // print used DB files + se->End(); + se->PrintTimer(); + gSystem->Exit(0); +} + +#endif diff --git a/CaloProduction/Fun4All_CaloProduction_PreQM23.C b/CaloProduction/Fun4All_CaloProduction_PreQM23.C new file mode 100644 index 000000000..e3f78fb5d --- /dev/null +++ b/CaloProduction/Fun4All_CaloProduction_PreQM23.C @@ -0,0 +1,154 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +#include + + +// #include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libffamodules.so) + + +#endif +void Fun4All_CaloProduction_PreQM23(string fname = "full-00007359-0000.prdf", const char *outfile = "testfile.root", int nEvents = 2) +{ + + gSystem->Load("libg4dst"); + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + recoConsts *rc = recoConsts::instance(); + + //=============== + // conditions DB flags + //=============== + // ENABLE::CDB = true; + // global tag + rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023"); + // // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP",stoi(fname.substr(fname.length()-15,5))); + + Fun4AllInputManager *dstIn = new Fun4AllDstInputManager("DSTIN"); + dstIn -> AddFile(fname.c_str()); + se -> registerInputManager(dstIn); + + std::cout << "Calibrating EMCal" << std::endl; + CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB"); + calibEMC -> set_detector_type(CaloTowerCalib::CEMC); + se -> registerSubsystem(calibEMC); + + std::cout << "Calibrating OHcal" << std::endl; + + CaloTowerCalib *calibOHCal = new CaloTowerCalib("HCALOUT"); + calibOHCal -> set_detector_type(CaloTowerCalib::HCALOUT); + se -> registerSubsystem(calibOHCal); + + std::cout << "Calibrating IHcal" << std::endl; + + CaloTowerCalib *calibIHCal = new CaloTowerCalib("HCALIN"); + calibIHCal -> set_detector_type(CaloTowerCalib::HCALIN); + se -> registerSubsystem(calibIHCal); + + std::cout << "Calibrating ZDC" << std::endl; + + CaloTowerCalib *calibZDC = new CaloTowerCalib("ZDC"); + calibZDC -> set_detector_type(CaloTowerCalib::ZDC); + se -> registerSubsystem(calibZDC); + + std::cout << "Loading EMCal deadmap" << std::endl; + + DeadHotMapLoader *towerMapCemc = new DeadHotMapLoader("CEMC"); + towerMapCemc -> detector("CEMC"); + se->registerSubsystem(towerMapCemc); + + std::cout << "Loading ihcal deadmap" << std::endl; + + DeadHotMapLoader *towerMapHCalin = new DeadHotMapLoader("HCALIN"); + towerMapHCalin -> detector("HCALIN"); + se->registerSubsystem(towerMapHCalin); + + std::cout << "Loading ohcal deadmap" << std::endl; + + DeadHotMapLoader *towerMapHCalout = new DeadHotMapLoader("HCALOUT"); + towerMapHCalout -> detector("HCALOUT"); + se->registerSubsystem(towerMapHCalout); + + std::cout << "Loading cemc masker" << std::endl; + + TowerInfoDeadHotMask *towerMaskCemc = new TowerInfoDeadHotMask("CEMC"); + towerMaskCemc -> detector("CEMC"); + se->registerSubsystem(towerMaskCemc); + + std::cout << "Loading hcal maskers" << std::endl; + + TowerInfoDeadHotMask *towerMaskHCalin = new TowerInfoDeadHotMask("HCALIN"); + towerMaskHCalin -> detector("HCALIN"); + se->registerSubsystem(towerMaskHCalin); + + TowerInfoDeadHotMask *towerMaskHCalout = new TowerInfoDeadHotMask("HCALOUT"); + towerMaskHCalout -> detector("HCALOUT"); + se->registerSubsystem(towerMaskHCalout); + + std::cout << "Adding Geometry file" << std::endl; + + Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO"); + CDBInterface *cdb = CDBInterface::instance(); + std::string geoLocation = cdb->getUrl("calo_geo"); + intrue2->AddFile(geoLocation); + se->registerInputManager(intrue2); + + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->set_threshold_energy(0.030);//for when using basic calibration + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(ClusterBuilder); + + RawClusterDeadHotMask *clusterMask = new RawClusterDeadHotMask("clusterMask"); + clusterMask->detector("CEMC"); + se->registerSubsystem(clusterMask); + + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + clusterCorrection->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(clusterCorrection); + + //removing unofficial vertex code + // MBD_VertexReco *ca = new MBD_VertexReco("name"); + // se->registerSubsystem(ca); + + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfile); + out->StripNode("dud"); + se->registerOutputManager(out); + + se->run(nEvents); + se->End(); + se->PrintTimer(); + std::cout << "All done!" << std::endl; + gSystem->Exit(0); +} diff --git a/CaloProduction/Fun4All_Year1.C b/CaloProduction/Fun4All_Year1.C new file mode 100644 index 000000000..530f3124c --- /dev/null +++ b/CaloProduction/Fun4All_Year1.C @@ -0,0 +1,315 @@ +#ifndef FUN4ALL_YEAR1_C +#define FUN4ALL_YEAR1_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libcalotrigger.so) +R__LOAD_LIBRARY(libcentrality.so) +R__LOAD_LIBRARY(libffamodules.so) +R__LOAD_LIBRARY(libmbd.so) +R__LOAD_LIBRARY(libglobalvertex.so) +R__LOAD_LIBRARY(libcalovalid.so) + +void Fun4All_Year1(const std::string &fname = "/sphenix/lustre01/sphnxpro/commissioning/aligned_prdf/beam-00021774-0000.prdf", int nEvents = 10) +{ + bool enableMasking = 0; + bool addZeroSupCaloNodes = 1; + // v1 uncomment: + // CaloTowerDefs::BuilderType buildertype = CaloTowerDefs:::kPRDFTowerv1; + // v2 uncomment: + CaloTowerDefs::BuilderType buildertype = CaloTowerDefs::kWaveformTowerv2; + // v3 uncomment: + // CaloTowerDefs::BuilderType buildertype = CaloTowerDefs::kPRDFWaveform; + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + recoConsts *rc = recoConsts::instance(); + + pair runseg = Fun4AllUtils::GetRunSegment(fname); + int runnumber = runseg.first; + int segment = runseg.second; + char outfile[100]; + char outfile_hist[100]; + sprintf(outfile, "DST_CALOR-%08d-%04d.root", runnumber, segment); + sprintf(outfile_hist, "HIST_CALOR-%08d-%04d.root", runnumber, segment); + string fulloutfile = string("./") + outfile; + string fulloutfile_hist = string("./") + outfile_hist; + //=============== + // conditions DB flags + //=============== + // ENABLE::CDB = true; + // global tag + rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2023"); + // // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP", runnumber); + CDBInterface::instance()->Verbosity(1); + + // Sync Headers and Flags + SyncReco *sync = new SyncReco(); + se->registerSubsystem(sync); + + HeadReco *head = new HeadReco(); + se->registerSubsystem(head); + + FlagHandler *flag = new FlagHandler(); + se->registerSubsystem(flag); + + // MBD/BBC Reconstruction + MbdReco *mbdreco = new MbdReco(); + se->registerSubsystem(mbdreco); + + // Official vertex storage + GlobalVertexReco *gvertex = new GlobalVertexReco(); + se->registerSubsystem(gvertex); + + ///////////////// + // build towers + CaloTowerBuilder *ctbEMCal = new CaloTowerBuilder("EMCalBUILDER"); + ctbEMCal->set_detector_type(CaloTowerDefs::CEMC); + ctbEMCal->set_processing_type(CaloWaveformProcessing::TEMPLATE); + ctbEMCal->set_builder_type(buildertype); + ctbEMCal->set_nsamples(16); + se->registerSubsystem(ctbEMCal); + + CaloTowerBuilder *ctbIHCal = new CaloTowerBuilder("HCALINBUILDER"); + ctbIHCal->set_detector_type(CaloTowerDefs::HCALIN); + ctbIHCal->set_processing_type(CaloWaveformProcessing::TEMPLATE); + ctbIHCal->set_builder_type(buildertype); + ctbIHCal->set_nsamples(31); + se->registerSubsystem(ctbIHCal); + + CaloTowerBuilder *ctbOHCal = new CaloTowerBuilder("HCALOUTBUILDER"); + ctbOHCal->set_detector_type(CaloTowerDefs::HCALOUT); + ctbOHCal->set_processing_type(CaloWaveformProcessing::TEMPLATE); + ctbOHCal->set_builder_type(buildertype); + ctbOHCal->set_nsamples(31); + se->registerSubsystem(ctbOHCal); + + CaloTowerBuilder *ca4 = new CaloTowerBuilder("zdc"); + ca4->set_detector_type(CaloTowerDefs::ZDC); + ca4->set_nsamples(31); + ca4->set_builder_type(CaloTowerDefs::kPRDFWaveform); + ca4->set_processing_type(CaloWaveformProcessing::FAST); + se->registerSubsystem(ca4); + + ////////////////////////////// + // set statuses on raw towers + std::cout << "status setters" << std::endl; + CaloTowerStatus *statusEMC = new CaloTowerStatus("CEMCSTATUS"); + statusEMC->set_detector_type(CaloTowerDefs::CEMC); + statusEMC->set_time_cut(1); + se->registerSubsystem(statusEMC); + + CaloTowerStatus *statusHCalIn = new CaloTowerStatus("HCALINSTATUS"); + statusHCalIn->set_detector_type(CaloTowerDefs::HCALIN); + statusHCalIn->set_time_cut(2); + se->registerSubsystem(statusHCalIn); + + CaloTowerStatus *statusHCALOUT = new CaloTowerStatus("HCALOUTSTATUS"); + statusHCALOUT->set_detector_type(CaloTowerDefs::HCALOUT); + statusHCALOUT->set_time_cut(2); + se->registerSubsystem(statusHCALOUT); + + //////////////////// + // Calibrate towers + std::cout << "Calibrating EMCal" << std::endl; + CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB"); + calibEMC->set_detector_type(CaloTowerDefs::CEMC); + se->registerSubsystem(calibEMC); + + std::cout << "Calibrating OHcal" << std::endl; + CaloTowerCalib *calibOHCal = new CaloTowerCalib("HCALOUT"); + calibOHCal->set_detector_type(CaloTowerDefs::HCALOUT); + se->registerSubsystem(calibOHCal); + + std::cout << "Calibrating IHcal" << std::endl; + CaloTowerCalib *calibIHCal = new CaloTowerCalib("HCALIN"); + calibIHCal->set_detector_type(CaloTowerDefs::HCALIN); + se->registerSubsystem(calibIHCal); + + std::cout << "Calibrating ZDC" << std::endl; + CaloTowerCalib *calibZDC = new CaloTowerCalib("ZDC"); + calibZDC->set_detector_type(CaloTowerDefs::ZDC); + se->registerSubsystem(calibZDC); + + ///////////// + // masking + if (enableMasking) + { + std::cout << "Loading EMCal deadmap" << std::endl; + DeadHotMapLoader *towerMapCemc = new DeadHotMapLoader("CEMC"); + towerMapCemc->detector("CEMC"); + se->registerSubsystem(towerMapCemc); + + std::cout << "Loading ihcal deadmap" << std::endl; + DeadHotMapLoader *towerMapHCalin = new DeadHotMapLoader("HCALIN"); + towerMapHCalin->detector("HCALIN"); + se->registerSubsystem(towerMapHCalin); + + std::cout << "Loading ohcal deadmap" << std::endl; + DeadHotMapLoader *towerMapHCalout = new DeadHotMapLoader("HCALOUT"); + towerMapHCalout->detector("HCALOUT"); + se->registerSubsystem(towerMapHCalout); + + std::cout << "Loading cemc masker" << std::endl; + TowerInfoDeadHotMask *towerMaskCemc = new TowerInfoDeadHotMask("CEMC"); + towerMaskCemc->detector("CEMC"); + se->registerSubsystem(towerMaskCemc); + + std::cout << "Loading hcal maskers" << std::endl; + TowerInfoDeadHotMask *towerMaskHCalin = new TowerInfoDeadHotMask("HCALIN"); + towerMaskHCalin->detector("HCALIN"); + se->registerSubsystem(towerMaskHCalin); + + TowerInfoDeadHotMask *towerMaskHCalout = new TowerInfoDeadHotMask("HCALOUT"); + towerMaskHCalout->detector("HCALOUT"); + se->registerSubsystem(towerMaskHCalout); + } + + std::cout << "Adding Geometry file" << std::endl; + Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO"); + std::string geoLocation = CDBInterface::instance()->getUrl("calo_geo"); + intrue2->AddFile(geoLocation); + se->registerInputManager(intrue2); + + ////////////////// + // Clusters + std::cout << "Building clusters" << std::endl; + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->set_threshold_energy(0.030); // for when using basic calibration + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(ClusterBuilder); + + if (enableMasking) + { + std::cout << "Masking clusters" << std::endl; + RawClusterDeadHotMask *clusterMask = new RawClusterDeadHotMask("clusterMask"); + clusterMask->detector("CEMC"); + se->registerSubsystem(clusterMask); + } + + std::cout << "Applying Position Dependent Correction" << std::endl; + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + clusterCorrection->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(clusterCorrection); + + /////////////////////////////////////////// + // Calo node with software zero supression + if (addZeroSupCaloNodes) + { + CaloTowerBuilder *ctbEMCal_SZ = new CaloTowerBuilder("EMCalBUILDER_ZS"); + ctbEMCal_SZ->set_detector_type(CaloTowerDefs::CEMC); + ctbEMCal_SZ->set_processing_type(CaloWaveformProcessing::TEMPLATE); + ctbEMCal_SZ->set_nsamples(8); + ctbEMCal_SZ->set_outputNodePrefix("TOWERS_SZ_"); + ctbEMCal_SZ->set_softwarezerosuppression(true, 100000000); + se->registerSubsystem(ctbEMCal_SZ); + + CaloTowerBuilder *ctbIHCal_SZ = new CaloTowerBuilder("HCALINBUILDER_ZS"); + ctbIHCal_SZ->set_detector_type(CaloTowerDefs::HCALIN); + ctbIHCal_SZ->set_processing_type(CaloWaveformProcessing::TEMPLATE); + ctbIHCal_SZ->set_nsamples(8); + ctbIHCal_SZ->set_outputNodePrefix("TOWERS_SZ_"); + ctbIHCal_SZ->set_softwarezerosuppression(true, 100000000); + se->registerSubsystem(ctbIHCal_SZ); + + CaloTowerBuilder *ctbOHCal_SZ = new CaloTowerBuilder("HCALOUTBUILDER_SZ"); + ctbOHCal_SZ->set_detector_type(CaloTowerDefs::HCALOUT); + ctbOHCal_SZ->set_processing_type(CaloWaveformProcessing::TEMPLATE); + ctbOHCal_SZ->set_nsamples(8); + ctbOHCal_SZ->set_outputNodePrefix("TOWERS_SZ_"); + ctbOHCal_SZ->set_softwarezerosuppression(true, 100000000); + se->registerSubsystem(ctbOHCal_SZ); + + CaloTowerCalib *calibEMC_SZ = new CaloTowerCalib("CEMCCALIB_SZ"); + calibEMC_SZ->set_detector_type(CaloTowerDefs::CEMC); + calibEMC_SZ->set_inputNodePrefix("TOWERS_SZ_"); + calibEMC_SZ->set_outputNodePrefix("TOWERINFO_SZ_CALIB_"); + se->registerSubsystem(calibEMC_SZ); + + CaloTowerCalib *calibIHCal_SZ = new CaloTowerCalib("IHCALCALIB_SZ"); + calibIHCal_SZ->set_detector_type(CaloTowerDefs::HCALIN); + calibIHCal_SZ->set_inputNodePrefix("TOWERS_SZ_"); + calibIHCal_SZ->set_outputNodePrefix("TOWERINFO_SZ_CALIB_"); + se->registerSubsystem(calibIHCal_SZ); + + CaloTowerCalib *calibOHCal_SZ = new CaloTowerCalib("OHCALCALIB_SZ"); + calibOHCal_SZ->set_detector_type(CaloTowerDefs::HCALOUT); + calibOHCal_SZ->set_inputNodePrefix("TOWERS_SZ_"); + calibOHCal_SZ->set_outputNodePrefix("TOWERINFO_SZ_CALIB_"); + se->registerSubsystem(calibOHCal_SZ); + } + + MinimumBiasClassifier *minimumbiasclassifier = new MinimumBiasClassifier(); + se->registerSubsystem(minimumbiasclassifier); + + CentralityReco *centralityreco = new CentralityReco(); + se->registerSubsystem(centralityreco); + /////////////////////////////////// + // Validation + CaloValid *ca = new CaloValid("calomodulename",fulloutfile_hist); + ca->set_timing_cut_width(200); //integers for timing width, > 1 : wider cut around max peak time + ca->apply_vertex_cut(false); + ca->set_vertex_cut(20.); + se->registerSubsystem(ca); + + + Fun4AllInputManager *In = new Fun4AllPrdfInputManager("in"); + In->AddFile(fname); + se->registerInputManager(In); + + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", fulloutfile); + se->registerOutputManager(out); + + se->run(nEvents); + se->End(); + CDBInterface::instance()->Print(); // print used DB files + se->PrintTimer(); + delete se; + std::cout << "All done!" << std::endl; + gSystem->Exit(0); +} + +#endif diff --git a/Gl1Production/Fun4All_Gl1_Combiner.C b/Gl1Production/Fun4All_Gl1_Combiner.C new file mode 100644 index 000000000..db914b304 --- /dev/null +++ b/Gl1Production/Fun4All_Gl1_Combiner.C @@ -0,0 +1,58 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include + +//#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) + +SingleGl1PoolInput *sngl[9]{}; + +void Fun4All_Gl1_Combiner(int nEvents = 0, + const string &input_file00 = "gl1.list" +) +{ + vector infile; + infile.push_back(input_file00); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); + recoConsts *rc = recoConsts::instance(); +// rc->set_IntFlag("RUNNUMBER",20445); + Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb"); +// in->Verbosity(10); + int i=0; + for (auto iter : infile) + { + SingleGl1PoolInput *sngl= new SingleGl1PoolInput("GL1_" + to_string(i)); +// sngl->Verbosity(3); + sngl->AddListFile(iter); + in->registerStreamingInput(sngl,InputManagerType::GL1); + i++; + } + se->registerInputManager(in); + +// Gl1Check *gl1check = new Gl1Check(); +// // gl1check->Verbosity(3); +// se->registerSubsystem(gl1check); + + Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out","gl1.root"); +out->UseFileRule(); +out->SetNEvents(5); + se->registerOutputManager(out); + + se->run(nEvents); + + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/InttProduction/Fun4All_Intt_Combiner.C b/InttProduction/Fun4All_Intt_Combiner.C new file mode 100644 index 000000000..ba5964d54 --- /dev/null +++ b/InttProduction/Fun4All_Intt_Combiner.C @@ -0,0 +1,96 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) +R__LOAD_LIBRARY(libintt.so) + +SingleInttPoolInput *sngl[9]{}; + +void Fun4All_Intt_Combiner(int nEvents = 0, + const string &input_file00 = "intt0.list", + const string &input_file01 = "intt1.list", + const string &input_file02 = "intt2.list", + const string &input_file03 = "intt3.list", + const string &input_file04 = "intt4.list", + const string &input_file05 = "intt5.list", + const string &input_file06 = "intt6.list", + const string &input_file07 = "intt7.list") +{ + bool runTrkrHits = false; + bool runTkrkClus = false; + bool stripRawHit = false; + + vector infile; + infile.push_back(input_file00); + infile.push_back(input_file01); + infile.push_back(input_file02); + infile.push_back(input_file03); + infile.push_back(input_file04); + infile.push_back(input_file05); + infile.push_back(input_file06); + infile.push_back(input_file07); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); + recoConsts *rc = recoConsts::instance(); + Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb"); + // in->Verbosity(10); + int i = 0; + for (auto iter : infile) + { + SingleInttPoolInput *sngl = new SingleInttPoolInput("INTT_" + to_string(i)); + // sngl->Verbosity(3); + sngl->AddListFile(iter); + int nBcoVal = runTrkrHits ? 0 : 2; + sngl->SetNegativeBco(nBcoVal); + sngl->SetBcoRange(2); + in->registerStreamingInput(sngl, InputManagerType::INTT); + i++; + } + + se->registerInputManager(in); + + // InttCheck *inttcheck = new InttCheck(); + // inttcheck->Verbosity(3); + // se->registerSubsystem(inttcheck); + + if (runTrkrHits) + { + InttCombinedRawDataDecoder *myDecoder = new InttCombinedRawDataDecoder("myUnpacker"); + myDecoder->runInttStandalone(true); + myDecoder->writeInttEventHeader(true); + se->registerSubsystem(myDecoder); + } + + if (runTkrkClus) + { + Intt_Clustering(); //Be careful!!! INTT z-clustering may be off which is not what you want! + } + + Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out", "intt-00020869.root"); + if (stripRawHit) + { + out->StripNode("INTTRAWHIT"); + } + se->registerOutputManager(out); + + se->run(nEvents); + + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/InttProduction/intt_makelist.sh b/InttProduction/intt_makelist.sh new file mode 100644 index 000000000..58394fae3 --- /dev/null +++ b/InttProduction/intt_makelist.sh @@ -0,0 +1,24 @@ +#!/usr/bin/bash + +# creates file lists for the INTT from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for the Intt for a given run" + echo "Usage: intt_makelist.sh " + exit 1 +fi + +runnumber=$(printf "%08d" $1) + +for i in {0..7} +do +ls -1 /sphenix/lustre01/sphnxpro/commissioning/INTT/beam/beam_intt${i}-${runnumber}-* > intt${i}.list +if [ ! -s intt${i}.list ] +then + echo intt${i}.list empty, removing it + rm intt${i}.list +fi + +done diff --git a/InttProduction/runnumbers.txt b/InttProduction/runnumbers.txt new file mode 100644 index 000000000..63cf68935 --- /dev/null +++ b/InttProduction/runnumbers.txt @@ -0,0 +1,56 @@ +23892 +23893 +23894 +23895 +23896 +23897 +23932 +23842 +23943 +23946 +23947 +23948 +23949 +23950 +23951 +23952 +23953 +23957 +23958 +23959 +23960 +23964 +23965 +23966 +23967 +23968 +23969 +24314 +24315 +24316 +24317 +24318 +24319 +24320 +24321 +24322 +24323 +24324 +24325 +24337 +24345 +24346 +24356 +24749 +24750 +24752 +24753 +24754 +24755 +24756 +24757 +24764 +24765 +24766 +24767 +24768 diff --git a/MvtxProduction/Fun4All_Mvtx_Combiner.C b/MvtxProduction/Fun4All_Mvtx_Combiner.C new file mode 100644 index 000000000..13b9188a6 --- /dev/null +++ b/MvtxProduction/Fun4All_Mvtx_Combiner.C @@ -0,0 +1,61 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) + + +void Fun4All_Mvtx_Combiner(int nEvents = 0, + const string &input_file00 = "mvtx-flx0.list", + const string &input_file01 = "mvtx-flx1.list", + const string &input_file02 = "mvtx-flx2.list", + const string &input_file03 = "mvtx-flx3.list", + const string &input_file04 = "mvtx-flx4.list", + const string &input_file05 = "mvtx-flx5.list") +{ + vector infiles; + infiles.push_back(input_file00); + infiles.push_back(input_file01); + infiles.push_back(input_file02); + infiles.push_back(input_file03); + infiles.push_back(input_file04); + infiles.push_back(input_file05); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); + recoConsts *rc = recoConsts::instance(); + //rc->set_IntFlag("RUNNUMBER",20445); + Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb"); + +// in->Verbosity(10); + int i = 0; + for (auto& infile : infiles) + { + auto* sngl= new SingleMvtxPoolInput("MVTX_FLX" + to_string(i)); +// sngl->Verbosity(3); + sngl->SetBcoRange(10); + sngl->AddListFile(infile); + in->registerStreamingInput(sngl, InputManagerType::MVTX); + i++; + } + se->registerInputManager(in); + + Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out","mvtx_raw_hits.root"); + se->registerOutputManager(out); + + se->run(nEvents); + + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/MvtxProduction/Fun4All_SingleMvtx.C b/MvtxProduction/Fun4All_SingleMvtx.C new file mode 100644 index 000000000..3f8d05853 --- /dev/null +++ b/MvtxProduction/Fun4All_SingleMvtx.C @@ -0,0 +1,120 @@ +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) + +SingleMvtxPoolInput *sngl[24]{}; + +vector infile; + +//9451 +void Fun4All_SingleMvtx(int nEvents = 0, + const string &input_file00 = "mvtx-flx0.list", + const string &input_file01 = "mvtx-flx1.list", + const string &input_file02 = "mvtx-flx2.list", + const string &input_file03 = "mvtx-flx3.list", + const string &input_file04 = "mvtx-flx4.list", + const string &input_file05 = "mvtx-flx5.list" +) +{ + infile.push_back(input_file00); + infile.push_back(input_file01); + // infile.push_back(input_file02); + // infile.push_back(input_file03); + // infile.push_back(input_file04); + // infile.push_back(input_file05); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); +// EventCombiner *evtcomb = new EventCombiner(); +// evtcomb->Verbosity(1); + // Fun4AllEvtInputPoolManager *in = new Fun4AllEvtInputPoolManager("Comb"); + // in->Verbosity(10); + int i = 0; + for (auto iter : infile) + { + sngl[i]= new SingleMvtxPoolInput("MVTX_" + to_string(i)); + sngl[i]->Verbosity(3); + sngl[i]->SetBcoRange(10); + sngl[i]->AddListFile(iter); + i++; + } + +// Fun4AllEventOutputManager *out = new Fun4AllEventOutputManager("EvtOut","/sphenix/user/pinkenbu/out-%08d-%04d.evt",20000); +// out->DropPacket(21102); +// se->registerOutputManager(out); +} + +void Run(const int nEvents = 1) +{ + for (int i = 0; i < nEvents; i++) +// while(1) + { + int j = 0; + bool quit = false; + for (auto iter : infile) + { + sngl[j]->FillPool(10); + if (sngl[j]->AllDone()) + { + quit = true; + } + j++; + } + if (quit) + { + break; + } + } +} + +void RunBclk(const uint64_t bclk = 0) +{ + int j = 0; + for (auto iter : infile) + { + sngl[j]->FillPool(bclk); + j++; + } +} + +void CleanUp() +{ + int j = 0; + for (auto iter : infile) + { + sngl[j]->ClearCurrentEvent(); + j++; + } +} + +void Verbosity(int v) +{ + int j = 0; + for (auto iter : infile) + { + sngl[j]->Verbosity(v); + j++; + } +} + +void Print(const std::string &what = "ALL", int i = -1) +{ + if (i < 0) + { + int j = 0; + for (auto iter : infile) + { + sngl[j]->Print(what); + j++; + } + return; + } + +} diff --git a/MvtxProduction/mvtx_makelist.sh b/MvtxProduction/mvtx_makelist.sh new file mode 100755 index 000000000..daa0a7966 --- /dev/null +++ b/MvtxProduction/mvtx_makelist.sh @@ -0,0 +1,24 @@ +#!/usr/bin/bash + +# creates file lists for the MVTX from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for the MVTX for a given run" + echo "Usage: mvtx_makelist.sh " + exit 1 +fi + +runnumber=$(printf "%08d" $1) + +for i in {0..5} +do +ls -1 /sphenix/lustre01/sphnxpro/commissioning/MVTX/cosmics/cosmics_mvtx-flx${i}-${runnumber}-* > mvtx-flx${i}.list +if [ ! -s mvtx-flx${i}.list ] +then + echo mvtx-flx${i}.list empty, removing it + rm mvtx-flx${i}.list +fi + +done diff --git a/README.md b/README.md new file mode 100644 index 000000000..3620f0cfa --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ + +# Welcome + +This is the standard macros respository for [sPHENIX collaboration](https://www.sphenix.bnl.gov/). Following is the 10-min tutorial on using the sPHENIX macros from [this wiki link](https://wiki.bnl.gov/sPHENIX/index.php/Tutorial/sPHENIX_simulation). + +[![Build Status](https://web.sdcc.bnl.gov/jenkins-sphenix/buildStatus/icon?job=sPHENIX/sPHENIX_CoreSoftware_MasterBranch)](https://web.sdcc.bnl.gov/jenkins-sphenix/job/sPHENIX/job/sPHENIX_CoreSoftware_MasterBranch/) +[![Doxygen](https://img.shields.io/badge/code%20reference-Doxygen-green.svg)](https://www.phenix.bnl.gov/WWW/sPHENIX/doxygen/html/) +[![Singularity](https://img.shields.io/badge/container-Singularity%20via%20CVMFS-green.svg)](https://github.com/sPHENIX-Collaboration/Singularity) + +[![Open Issues](https://img.shields.io/github/issues/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/issues) +[![Open Pull Request](https://img.shields.io/github/issues-pr/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/pulls) +[![Monthly Commits](https://img.shields.io/github/commit-activity/m/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/commits/master) +[![Last Commit](https://img.shields.io/github/last-commit/sPHENIX-Collaboration/macros.svg)](https://github.com/sPHENIX-Collaboration/macros/commits/master) + +# Get started + +Please follow [SPHENIX software day-1 checklist](https://wiki.bnl.gov/sPHENIX/index.php/SPHENIX_software_day-1_checklist) to get started on [RHIC computing facility at BNL](https://www.racf.bnl.gov/), or follow the [sPHENIX container setup](https://github.com/sPHENIX-Collaboration/Singularity) for your own computing environment. + +# Check out macro repository + +Download the newest macro repository from GitHub: + +``` +[jinhuang@rcas2073 test]$ git clone https://github.com/sPHENIX-Collaboration/macros.git +Cloning into 'macros'... +remote: Counting objects: 1125, done. +remote: Total 1125 (delta 0), reused 0 (delta 0), pack-reused 1125 +Receiving objects: 100% (1125/1125), 181.75 KiB | 0 bytes/s, done. +Resolving deltas: 100% (471/471), done. +Checking connectivity... done. +[jinhuang@rcas2073 test]$ cd macros/detectors +[jinhuang@rcas2073 detectors]$ # here are all the subdirectories with macros to run sPHENIX, fsPHENIX and EIC detector simulations +``` + +The default sPHENIX simulation + reconstruction macro is Fun4All_G4_sPHENIX.C, which is self-explanatory. It is not a black box!. You are welcome to open/edit it to work for your purpose of study. + +# Try an event display + +Then let's see what is implemented by firing up one event: +``` +[jinhuang@rcas2072 sPHENIX]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so +# Note, for bash users, please use /opt/sphenix/core/bin/sphenix_setup.sh instead +[jinhuang@rcas2072 sPHENIX]$ root +root [] .x Fun4All_G4_sPHENIX.C(-1) // here negative value in event number start an event display of one event +root [] .L DisplayOn.C +root [] PHG4Reco* g4 = DisplayOn() +root [] Fun4AllServer *se = Fun4AllServer::instance(); +root [] se->run(1) +root [] displaycmd() # this one show more Geant4 command we can run from the ROOT prompt +``` + + +# Run more events + +This is simpler, just run with first parameter as the intended number of event: +``` +[jinhuang@rcas2072 sPHENIX]$ source /opt/sphenix/core/bin/sphenix_setup.csh -n # setup sPHENIX environment if not already done so +[jinhuang@rcas2072 sPHENIX]$ root +root [] .x Fun4All_G4_sPHENIX.C(10) // run 10 events +``` + +# What next? + +Now you are able to run the whole sPHENIX simulation + reconstruction chain. Many next-step topics are listed in the [software](https://wiki.bnl.gov/sPHENIX/index.php/Software) page. And specifically, to use the simulation for your study, a few thing you might want to try: + +* Checkout the [evaluator Ntuples](https://wiki.bnl.gov/sPHENIX/index.php/Tracking) output from your 10 events for a generic look of the reconstructed data. +* Run [sPHENIX software tutorials](https://github.com/sPHENIX-Collaboration/tutorials). +* [Write your analysis module for more dedicated analysis](https://wiki.bnl.gov/sPHENIX/index.php/Example_of_using_DST_nodes), for which the module produced the evaluator NTuple ([CaloEvaluator](https://sphenix-collaboration.github.io/doxygen/dd/d59/classCaloEvaluator.html), [JetEvaluator](https://sphenix-collaboration.github.io/doxygen/dd/d59/classCaloEvaluator.html), [SvtxEvaluator](https://sphenix-collaboration.github.io/doxygen/d6/d11/classSvtxEvaluator.html)) can usually serve as good examples. diff --git a/StreamingProduction/Fun4All_Stream_Combiner.C b/StreamingProduction/Fun4All_Stream_Combiner.C new file mode 100644 index 000000000..d057bea07 --- /dev/null +++ b/StreamingProduction/Fun4All_Stream_Combiner.C @@ -0,0 +1,195 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) + +void Fun4All_Stream_Combiner(int nEvents = 0, + const string &input_gl1file = "gl1.list", + const string &input_inttfile00 = "intt0.list", + const string &input_inttfile01 = "intt1.list", + const string &input_inttfile02 = "intt2.list", + const string &input_inttfile03 = "intt3.list", + const string &input_inttfile04 = "intt4.list", + const string &input_inttfile05 = "intt5.list", + const string &input_inttfile06 = "intt6.list", + const string &input_inttfile07 = "intt7.list", + const string &input_mvtxfile00 = "mvtx-flx0.list", + const string &input_mvtxfile01 = "mvtx-flx1.list", + const string &input_mvtxfile02 = "mvtx-flx2.list", + const string &input_mvtxfile03 = "mvtx-flx3.list", + const string &input_mvtxfile04 = "mvtx-flx4.list", + const string &input_mvtxfile05 = "mvtx-flx5.list", + const string &input_tpcfile00 = "tpc00.list", + const string &input_tpcfile01 = "tpc01.list", + const string &input_tpcfile02 = "tpc02.list", + const string &input_tpcfile03 = "tpc03.list", + const string &input_tpcfile04 = "tpc04.list", + const string &input_tpcfile05 = "tpc05.list", + const string &input_tpcfile06 = "tpc06.list", + const string &input_tpcfile07 = "tpc07.list", + const string &input_tpcfile08 = "tpc08.list", + const string &input_tpcfile09 = "tpc09.list", + const string &input_tpcfile10 = "tpc10.list", + const string &input_tpcfile11 = "tpc11.list", + const string &input_tpcfile12 = "tpc12.list", + const string &input_tpcfile13 = "tpc13.list", + const string &input_tpcfile14 = "tpc14.list", + const string &input_tpcfile15 = "tpc15.list", + const string &input_tpcfile16 = "tpc16.list", + const string &input_tpcfile17 = "tpc17.list", + const string &input_tpcfile18 = "tpc18.list", + const string &input_tpcfile19 = "tpc19.list", + const string &input_tpcfile20 = "tpc20.list", + const string &input_tpcfile21 = "tpc21.list", + const string &input_tpcfile22 = "tpc22.list", + const string &input_tpcfile23 = "tpc23.list", + const string &input_tpotfile = "tpot.list") +{ + vector tpc_infile; + tpc_infile.push_back(input_tpcfile00); + tpc_infile.push_back(input_tpcfile01); + tpc_infile.push_back(input_tpcfile02); + tpc_infile.push_back(input_tpcfile03); + tpc_infile.push_back(input_tpcfile04); + tpc_infile.push_back(input_tpcfile05); + tpc_infile.push_back(input_tpcfile06); + tpc_infile.push_back(input_tpcfile07); + tpc_infile.push_back(input_tpcfile08); + tpc_infile.push_back(input_tpcfile09); + tpc_infile.push_back(input_tpcfile10); + tpc_infile.push_back(input_tpcfile11); + tpc_infile.push_back(input_tpcfile12); + tpc_infile.push_back(input_tpcfile13); + tpc_infile.push_back(input_tpcfile14); + tpc_infile.push_back(input_tpcfile15); + tpc_infile.push_back(input_tpcfile16); + tpc_infile.push_back(input_tpcfile17); + tpc_infile.push_back(input_tpcfile18); + tpc_infile.push_back(input_tpcfile19); + tpc_infile.push_back(input_tpcfile20); + tpc_infile.push_back(input_tpcfile21); + tpc_infile.push_back(input_tpcfile22); + tpc_infile.push_back(input_tpcfile23); + + vector intt_infile; + intt_infile.push_back(input_inttfile00); + intt_infile.push_back(input_inttfile01); + intt_infile.push_back(input_inttfile02); + intt_infile.push_back(input_inttfile03); + intt_infile.push_back(input_inttfile04); + intt_infile.push_back(input_inttfile05); + intt_infile.push_back(input_inttfile06); + intt_infile.push_back(input_inttfile07); + + vector mvtx_infile; + mvtx_infile.push_back(input_mvtxfile00); + mvtx_infile.push_back(input_mvtxfile01); + mvtx_infile.push_back(input_mvtxfile02); + mvtx_infile.push_back(input_mvtxfile03); + mvtx_infile.push_back(input_mvtxfile04); + mvtx_infile.push_back(input_mvtxfile05); + + vector gl1_infile; + gl1_infile.push_back(input_gl1file); + + vector tpot_infile; + tpot_infile.push_back(input_tpotfile); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); + recoConsts *rc = recoConsts::instance(); + Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb"); + // in->Verbosity(2); + int i = 0; + for (auto iter : tpc_infile) + { + SingleTpcPoolInput *tpc_sngl = new SingleTpcPoolInput("TPC_" + to_string(i)); + // tpc_sngl->Verbosity(3); + tpc_sngl->SetBcoRange(130); + tpc_sngl->AddListFile(iter); + in->registerStreamingInput(tpc_sngl, InputManagerType::TPC); + i++; + } + i = 0; + for (auto iter : intt_infile) + { + SingleInttPoolInput *intt_sngl = new SingleInttPoolInput("INTT_" + to_string(i)); + // intt_sngl->Verbosity(3); + intt_sngl->SetNegativeBco(1); + intt_sngl->SetBcoRange(2); + intt_sngl->AddListFile(iter); + in->registerStreamingInput(intt_sngl, InputManagerType::INTT); + i++; + } + i = 0; + for (auto iter : mvtx_infile) + { + SingleMvtxPoolInput *mvtx_sngl = new SingleMvtxPoolInput("MVTX_" + to_string(i)); + // mvtx_sngl->Verbosity(3); + mvtx_sngl->SetBcoRange(1000); + mvtx_sngl->SetNegativeBco(1000); + mvtx_sngl->AddListFile(iter); + in->registerStreamingInput(mvtx_sngl, InputManagerType::MVTX); + i++; + } + i = 0; + for (auto iter : gl1_infile) + { + SingleGl1PoolInput *gl1_sngl = new SingleGl1PoolInput("GL1_" + to_string(i)); + // gl1_sngl->Verbosity(3); + gl1_sngl->AddListFile(iter); + in->registerStreamingInput(gl1_sngl, InputManagerType::GL1); + i++; + } + i = 0; + for (auto iter : tpot_infile) + { + SingleMicromegasPoolInput *mm_sngl = new SingleMicromegasPoolInput("MICROMEGAS_" + to_string(i)); + // sngl->Verbosity(3); + mm_sngl->SetBcoRange(100); + mm_sngl->SetNegativeBco(2); + mm_sngl->AddListFile(iter); + in->registerStreamingInput(mm_sngl, InputManagerType::MICROMEGAS); + i++; + } + + se->registerInputManager(in); + // StreamingCheck *scheck = new StreamingCheck(); + // scheck->SetTpcBcoRange(130); + // se->registerSubsystem(scheck); + // TpcCheck *tpccheck = new TpcCheck(); + // tpccheck->Verbosity(3); + // tpccheck->SetBcoRange(130); + // se->registerSubsystem(tpccheck); + + Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out", "streaming.root"); + se->registerOutputManager(out); + + if (nEvents < 0) + { + return; + } + se->run(nEvents); + + se->End(); + delete se; + cout << "all done" << endl; + gSystem->Exit(0); +} diff --git a/StreamingProduction/gl1_makecosmics.sh b/StreamingProduction/gl1_makecosmics.sh new file mode 100644 index 000000000..65bfd30a9 --- /dev/null +++ b/StreamingProduction/gl1_makecosmics.sh @@ -0,0 +1,15 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No runnumber supplied" + exit 0 +fi + +runnumber=$(printf "%08d" $1) +/bin/ls -1 /sphenix/lustre01/sphnxpro/commissioning/GL1/cosmics/GL1_cosmics-${runnumber}-* >gl1.list +if [ ! -s gl1.list ] +then + echo gl1.list empty, removing it + rm gl1.list +fi diff --git a/StreamingProduction/intt_makecosmics.sh b/StreamingProduction/intt_makecosmics.sh new file mode 100644 index 000000000..ae89de9d2 --- /dev/null +++ b/StreamingProduction/intt_makecosmics.sh @@ -0,0 +1,24 @@ +#!/usr/bin/bash + +# creates file lists for the INTT from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for the Intt for a given run" + echo "Usage: intt_makelist.sh " + exit 1 +fi + +runnumber=$(printf "%08d" $1) + +for i in {0..7} +do +/bin/ls -1 /sphenix/lustre01/sphnxpro/commissioning/INTT/cosmics/cosmics_intt${i}-${runnumber}-* > intt${i}.list +if [ ! -s intt${i}.list ] +then + echo intt${i}.list empty, removing it + rm intt${i}.list +fi + +done diff --git a/StreamingProduction/make_cosmics.sh b/StreamingProduction/make_cosmics.sh new file mode 100644 index 000000000..afb3c0017 --- /dev/null +++ b/StreamingProduction/make_cosmics.sh @@ -0,0 +1,17 @@ +#!/usr/bin/bash + +# creates file lists from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for a given run" + echo "Usage: make_cosmics.sh " + exit 1 +fi + +sh intt_makecosmics.sh $1 +sh tpc_makecosmics.sh $1 +sh gl1_makecosmics.sh $1 +sh tpot_makecosmics.sh $1 +sh mvtx_makecosmics.sh $1 diff --git a/StreamingProduction/mvtx_makecosmics.sh b/StreamingProduction/mvtx_makecosmics.sh new file mode 100644 index 000000000..daa0a7966 --- /dev/null +++ b/StreamingProduction/mvtx_makecosmics.sh @@ -0,0 +1,24 @@ +#!/usr/bin/bash + +# creates file lists for the MVTX from known locations in lustre +# run number is the input argument + +if [ $# -eq 0 ] + then + echo "Creates needed lists of input files for the MVTX for a given run" + echo "Usage: mvtx_makelist.sh " + exit 1 +fi + +runnumber=$(printf "%08d" $1) + +for i in {0..5} +do +ls -1 /sphenix/lustre01/sphnxpro/commissioning/MVTX/cosmics/cosmics_mvtx-flx${i}-${runnumber}-* > mvtx-flx${i}.list +if [ ! -s mvtx-flx${i}.list ] +then + echo mvtx-flx${i}.list empty, removing it + rm mvtx-flx${i}.list +fi + +done diff --git a/StreamingProduction/tpc_makecosmics.sh b/StreamingProduction/tpc_makecosmics.sh new file mode 100644 index 000000000..65f251cf1 --- /dev/null +++ b/StreamingProduction/tpc_makecosmics.sh @@ -0,0 +1,20 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No runnumber supplied" + exit 0 +fi + +runnumber=$(printf "%08d" $1) + +for i in {0..23} +do +ebdc=$(printf "%02d" $i) +/bin/ls -1 /sphenix/lustre01/sphnxpro/commissioning/tpc/cosmics/TPC_ebdc${ebdc}_cosmics-${runnumber}-* > tpc${ebdc}.list +if [ ! -s tpc${ebdc}.list ] +then + echo tpc${ebdc}.list empty, removing it + rm tpc${ebdc}.list +fi +done diff --git a/StreamingProduction/tpot_makecosmics.sh b/StreamingProduction/tpot_makecosmics.sh new file mode 100644 index 000000000..da069ff62 --- /dev/null +++ b/StreamingProduction/tpot_makecosmics.sh @@ -0,0 +1,15 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No runnumber supplied" + exit 0 +fi + +runnumber=$(printf "%08d" $1) +/bin/ls -1 /sphenix/lustre01/sphnxpro/commissioning/TPOT/cosmics/TPOT_ebdc39_cosmics-${runnumber}-* >tpot.list +if [ ! -s tpot.list ] +then + echo tpot.list empty, removing it + rm tpot.list +fi diff --git a/TpcProduction/Fun4All_Tpc_Combiner.C b/TpcProduction/Fun4All_Tpc_Combiner.C new file mode 100644 index 000000000..cb73e1910 --- /dev/null +++ b/TpcProduction/Fun4All_Tpc_Combiner.C @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) + +void Fun4All_Tpc_Combiner(int nEvents = 0, + const string &input_file00 = "tpc00.list", + const string &input_file01 = "tpc01.list", + const string &input_file02 = "tpc02.list", + const string &input_file03 = "tpc03.list", + const string &input_file04 = "tpc04.list", + const string &input_file05 = "tpc05.list", + const string &input_file06 = "tpc06.list", + const string &input_file07 = "tpc07.list", + const string &input_file08 = "tpc08.list", + const string &input_file09 = "tpc09.list", + const string &input_file10 = "tpc10.list", + const string &input_file11 = "tpc11.list", + const string &input_file12 = "tpc12.list", + const string &input_file13 = "tpc13.list", + const string &input_file14 = "tpc14.list", + const string &input_file15 = "tpc15.list", + const string &input_file16 = "tpc16.list", + const string &input_file17 = "tpc17.list", + const string &input_file18 = "tpc18.list", + const string &input_file19 = "tpc19.list", + const string &input_file20 = "tpc20.list", + const string &input_file21 = "tpc21.list", + const string &input_file22 = "tpc22.list", + const string &input_file23 = "tpc23.list" +) +{ + vector infile; + infile.push_back(input_file00); + infile.push_back(input_file01); + infile.push_back(input_file02); + infile.push_back(input_file03); + infile.push_back(input_file04); + infile.push_back(input_file05); + infile.push_back(input_file06); + infile.push_back(input_file07); + infile.push_back(input_file08); + infile.push_back(input_file09); + infile.push_back(input_file10); + infile.push_back(input_file11); + infile.push_back(input_file12); + infile.push_back(input_file13); + infile.push_back(input_file14); + infile.push_back(input_file15); + infile.push_back(input_file16); + infile.push_back(input_file17); + infile.push_back(input_file18); + infile.push_back(input_file19); + infile.push_back(input_file20); + infile.push_back(input_file21); + infile.push_back(input_file22); + infile.push_back(input_file23); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); +recoConsts *rc = recoConsts::instance(); +//rc->set_IntFlag("RUNNUMBER",20445); + Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb"); +// in->Verbosity(10); + int i=0; + for (auto iter : infile) + { + SingleTpcPoolInput *sngl= new SingleTpcPoolInput("TPC_" + to_string(i)); +// sngl->Verbosity(3); + sngl->SetBcoRange(130); + sngl->AddListFile(iter); + in->registerStreamingInput(sngl,InputManagerType::TPC); + i++; + } + se->registerInputManager(in); + + // TpcCheck *tpccheck = new TpcCheck(); + // tpccheck->Verbosity(3); + // tpccheck->SetBcoRange(130); + // se->registerSubsystem(tpccheck); + + // Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out","tpc.root"); + // se->registerOutputManager(out); + + se->run(nEvents); + + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/TpcProduction/tpc_makecosmics.sh b/TpcProduction/tpc_makecosmics.sh new file mode 100644 index 000000000..773a50b60 --- /dev/null +++ b/TpcProduction/tpc_makecosmics.sh @@ -0,0 +1,20 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No runnumber supplied" + exit 0 +fi + +runnumber=$(printf "%08d" $1) + +for i in {0..23} +do +ebdc=$(printf "%02d" $i) +ls -1 /sphenix/lustre01/sphnxpro/commissioning/tpc/cosmics/TPC_ebdc${ebdc}_cosmics-${runnumber}-* > tpc${ebdc}.list +if [ ! -s tpc${ebdc}.list ] +then + echo tpc${ebdc}.list empty, removing it + rm tpc${ebdc}.list +fi +done diff --git a/TpcProduction/tpc_makelist.sh b/TpcProduction/tpc_makelist.sh new file mode 100644 index 000000000..aab653a5e --- /dev/null +++ b/TpcProduction/tpc_makelist.sh @@ -0,0 +1,20 @@ +#!/usr/bin/bash + +if [ $# -eq 0 ] +then + echo "No runnumber supplied" + exit 0 +fi + +runnumber=$(printf "%08d" $1) + +for i in {0..23} +do +ebdc=$(printf "%02d" $i) +ls -1 /sphenix/lustre01/sphnxpro/commissioning/tpc/beam/TPC_ebdc${ebdc}_beam-${runnumber}-* > tpc${ebdc}.list +if [ ! -s tpc${ebdc}.list ] +then + echo tpc${ebdc}.list empty, removing it + rm tpc${ebdc}.list +fi +done diff --git a/TpotProduction/Fun4All_Tpot_Combiner.C b/TpotProduction/Fun4All_Tpot_Combiner.C new file mode 100644 index 000000000..435e516c7 --- /dev/null +++ b/TpotProduction/Fun4All_Tpot_Combiner.C @@ -0,0 +1,54 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) + +void Fun4All_Tpot_Combiner(int nEvents = 0, + const string &input_file00 = "tpot.list" +) +{ + vector infile; + infile.push_back(input_file00); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); +recoConsts *rc = recoConsts::instance(); +//rc->set_IntFlag("RUNNUMBER",20445); + Fun4AllStreamingInputManager *in = new Fun4AllStreamingInputManager("Comb"); + in->Verbosity(10); + int i=0; + for (auto iter : infile) + { + SingleMicromegasPoolInput *sngl= new SingleMicromegasPoolInput("MICROMEGAS_" + to_string(i)); + sngl->Verbosity(3); + sngl->SetBcoRange(130); + sngl->AddListFile(iter); + in->registerStreamingInput(sngl,InputManagerType::MICROMEGAS); + i++; + } + se->registerInputManager(in); + + // MicromegasCheck *micromegascheck = new MicromegasCheck(); + // micromegascheck->Verbosity(3); + // micromegascheck->SetBcoRange(130); + // se->registerSubsystem(micromegascheck); + + Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out","micromegas.root"); + se->registerOutputManager(out); + + se->run(nEvents); + + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/TrackingProduction/Fun4All_TrkrClusteringSeeding.C b/TrackingProduction/Fun4All_TrkrClusteringSeeding.C new file mode 100644 index 000000000..ce3aa749c --- /dev/null +++ b/TrackingProduction/Fun4All_TrkrClusteringSeeding.C @@ -0,0 +1,146 @@ +/* + * This macro shows a minimum working example of running the tracking + * hit unpackers with some basic seeding algorithms to try to put together + * tracks. There are some analysis modules run at the end which package + * hits, clusters, and clusters on tracks into trees for analysis. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libffamodules.so) +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libmicromegas.so) +R__LOAD_LIBRARY(libTrackingDiagnostics.so) +void Fun4All_TrkrClusteringSeeding( + const int nEvents = 2, + const std::string filename = "cosmics-00025926-0005.root", + const std::string outfilename = "cosmics", + const std::string dir = "/sphenix/lustre01/sphnxpro/commissioning/aligned_streaming_all_4/") +{ + std::string inputRawHitFile = dir + filename; + auto pos = filename.find("0002"); + std::string runnumber_str = filename.substr(pos, pos + 8); + int runnumber = std::stoi(runnumber_str); + + auto se = Fun4AllServer::instance(); + se->Verbosity(1); + auto rc = recoConsts::instance(); + rc->set_IntFlag("RUNNUMBER", runnumber); + + Enable::CDB = true; + rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2023"); + rc->set_uint64Flag("TIMESTAMP", 6); + std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry"); + + Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn"); + ingeo->AddFile(geofile); + se->registerInputManager(ingeo); + + G4TPC::tpc_drift_velocity_reco = (8.0 / 1000) * 107.0 / 105.0; + G4MAGNET::magfield = "0.01"; + G4MAGNET::magfield_rescale = 1; + ACTSGEOM::ActsGeomInit(); + + auto hitsin = new Fun4AllDstInputManager("InputManager"); + hitsin->fileopen(inputRawHitFile); + se->registerInputManager(hitsin); + + Mvtx_HitUnpacking(); + Intt_HitUnpacking(); + Tpc_HitUnpacking(); + Micromegas_HitUnpacking(); + Mvtx_Clustering(); + Intt_Clustering(); + + auto tpcclusterizer = new TpcClusterizer; + tpcclusterizer->Verbosity(0); + tpcclusterizer->set_do_hit_association(G4TPC::DO_HIT_ASSOCIATION); + tpcclusterizer->set_rawdata_reco(); + se->registerSubsystem(tpcclusterizer); + + Micromegas_Clustering(); + + Tracking_Reco_TrackSeed(); + convert_seeds(); + + TString ntupoutfile = outfilename + filename + "_ntup.root"; + std::string ntupstring(ntupoutfile.Data()); + + auto ntp = new TrkrNtuplizer("TrkrNtuplizer", ntupstring); + ntp->do_hit_eval(true); + ntp->do_cluster_eval(true); + ntp->do_track_eval(true); + ntp->do_siseed_eval(true); + ntp->do_tpcseed_eval(true); + ntp->do_clus_trk_eval(true); + ntp->do_vertex_eval(false); + ntp->set_trkclus_seed_container("SvtxTrackSeedContainer"); + ntp->Verbosity(0); + ntp->do_info_eval(false); + se->registerSubsystem(ntp); + + TString residoutfile = outfilename + filename + "_resid.root"; + std::string residstring(residoutfile.Data()); + + auto resid = new TrackResiduals("TrackResiduals"); + resid->outfileName(residstring); + resid->alignment(false); + resid->clusterTree(); + resid->hitTree(); + resid->zeroField(); + se->registerSubsystem(resid); + + // Fun4AllOutputManager *out = new Fun4AllDstOutputManager("out", "/sphenix/tg/tg01/hf/jdosbo/tracking_development/onlineoffline/hitsets.root"); + // se->registerOutputManager(out); + + se->run(nEvents); + se->End(); + se->PrintTimer(); + + if (Enable::QA) + { + se->registerSubsystem(new MvtxClusterQA); + se->registerSubsystem(new InttClusterQA); + se->registerSubsystem(new TpcClusterQA); + se->registerSubsystem(new MicromegasClusterQA); + + TString qaname = outfilename + filename + "_qa.root"; + std::string qaOutputFileName(qaname.Data()); + QAHistManagerDef::saveQARootFile(qaOutputFileName); + } + + delete se; + std::cout << "Finished" << std::endl; + gSystem->Exit(0); +} diff --git a/TrackingProduction/Fun4All_TrkrHitSet_Unpacker.C b/TrackingProduction/Fun4All_TrkrHitSet_Unpacker.C new file mode 100644 index 000000000..a174eaffe --- /dev/null +++ b/TrackingProduction/Fun4All_TrkrHitSet_Unpacker.C @@ -0,0 +1,79 @@ +/* + * This macro is run in our daily CI and is intended as a minimum working + * example showing how to unpack the raw hits into the offline tracker hit + * format. No other reconstruction or analysis is performed + */ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libffamodules.so) +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libmicromegas.so) +void Fun4All_TrkrHitSet_Unpacker( + const int nEvents = 2, + const int runnumber = 26048, + const std::string outfilename = "cosmics", + const std::string dir = "/sphenix/lustre01/sphnxpro/commissioning/aligned_streaming_all_4/", + const std::string file = "cosmics-") +{ + gSystem->Load("libg4dst.so"); + std::string inputRawHitFile = dir + file; + char filename[500]; + sprintf(filename, "%s%08d-0000.root", inputRawHitFile.c_str(), runnumber); + + auto se = Fun4AllServer::instance(); + se->Verbosity(1); + auto rc = recoConsts::instance(); + rc->set_IntFlag("RUNNUMBER", runnumber); + + Enable::CDB = true; + rc->set_StringFlag("CDB_GLOBALTAG", "ProdA_2023"); + rc->set_uint64Flag("TIMESTAMP", 6); + + std::string geofile = CDBInterface::instance()->getUrl("Tracking_Geometry"); + Fun4AllRunNodeInputManager *ingeo = new Fun4AllRunNodeInputManager("GeoIn"); + ingeo->AddFile(geofile); + se->registerInputManager(ingeo); + + auto hitsin = new Fun4AllDstInputManager("InputManager"); + hitsin->fileopen(filename); + se->registerInputManager(hitsin); + + Mvtx_HitUnpacking(); + Intt_HitUnpacking(); + Tpc_HitUnpacking(); + Micromegas_HitUnpacking(); + + Fun4AllOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfilename); + out->StripNode("MVTXRAWHIT"); + out->StripNode("INTTRAWHIT"); + out->StripNode("MICROMEGASRAWHIT"); + out->StripNode("TPCRAWHIT"); + out->StripNode("GL1RAWHIT"); + + se->registerOutputManager(out); + + se->run(nEvents); + se->End(); + se->PrintTimer(); + + delete se; + std::cout << "Finished" << std::endl; + gSystem->Exit(0); +} diff --git a/calibrations/README.md b/calibrations/README.md new file mode 100644 index 000000000..47bf30333 --- /dev/null +++ b/calibrations/README.md @@ -0,0 +1,4 @@ + +# Welcome + +This is the place for the calibration macros. Create subdirectories as needed (don't cram all macros into a single place) diff --git a/calibrations/calo/calib_nov23/pimacs/iterWhole.csh b/calibrations/calo/calib_nov23/pimacs/iterWhole.csh new file mode 100755 index 000000000..b3b138685 --- /dev/null +++ b/calibrations/calo/calib_nov23/pimacs/iterWhole.csh @@ -0,0 +1,81 @@ +#!/bin/csh +echo ' ' +echo 'START: '`date` +#setenv HOME /phenix/u/$LOGNAME +#source /etc/csh.login +#source $HOME/.login +#source /opt/phenix/bin/phenix_setup.c + + +#@ z = $1 + 500 +@ z = $1 + 0 + +echo hi justin doing job num $z + +source /opt/sphenix/core/bin/sphenix_setup.csh -n new + +setenv JFINSTALL /phenix/scratch/jfrantz/install/sphenix_tst1nov23 +#ls $JFINSTALL/include + +source /opt/sphenix/core/bin/setup_local.csh $JFINSTALL + +#//setenv JFINSTALL /sphenix/user/jfrantz/newgeom/install +#//setenv LD_LIBRARY_PATH $MYINSTALL/lib:$LD_LIBRARY_PATH +#//set PATH = ($MYINSTALL/bin $path) +#source ~/setldpath.csh . +#//echo $LD_LIBRARY_PATH +#//echo $MYINSTALL +echo $PATH + +#setenv CALIBRATIONROOT $JFINSTALL/share/calibrations/ +#setenv CALIBRATIONROOT /phenix/scratch/jfrantz/install/sphenix_ynewy/share/calibrations/ + +#cd /direct/phenix+u/apun/sphenixabi/macros/macros/g4simulations_embed +#cd /gpfs/mnt/gpfs04/sphenix/user/apun/gitfork/macros/macros/g4simulations +#cd /direct/phenix+u/apun/sphenixabi/macros/macros/g4simulations +#cd /direct/phenix+u/apun/Island/macros/g4simulations +cd /sphenix/user/jfrantz/thdatNov22/pimacs/ + +#condor/links9613/ +if ($1 > 1) then +echo “job $1 : not logging to .roothist” +setenv ROOT_HIST 0 +endif + + + root.exe -b <= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +//#include +#include + +//#include +#include +#include +#include + +#include + + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +//R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + + +#endif + +// to get files from my local area +void dst_simple_towerslope_runmacro(int nevents = 1e5, const char *fname = "/sphenix/user/sregmi/FINAL_VERSION/tower_slope_old_tower_method/3_RawWaveformTowerBuilder/macro/testoutput_400.root", const char * outfile = "defout.root", const int runNumber = 0) + +{ + gSystem->Load("libg4dst"); + + Fun4AllServer *se = Fun4AllServer::instance(); + + // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile); + // ca->Detector("CEMC"); + // se->registerSubsystem(ca); + + // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in"); + // in->fileopen(fname); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("in"); + + TString infiletstr(fname); + if (infiletstr.Contains(".list")) + in->AddListFile(fname); + else + in->fileopen(fname); + + + se->registerInputManager(in); + + Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO"); + intrue2->AddFile("updated_geo.root"); + se->registerInputManager(intrue2); + + + //CaloTowerBuilder *ca = new CaloTowerBuilder(); + + recoConsts *rc = recoConsts::instance(); + rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023"); // this points to the global tag in the CDB + // The calibrations have a validity range set by the beam clock which is not read out of the prdfs as of now + // rc->set_uint64Flag("TIMESTAMP",0); + rc->set_uint64Flag("TIMESTAMP",runNumber); + + + CaloTowerCalib *calib = new CaloTowerCalib("CEMCCALIB"); + // calib->setCalibName("cemc_abscalib_cosmic");// these two lines are needed to choose your own calibration + // calib->setFieldName("cemc_abscalib_cosmic"); + calib->set_detector_type(CaloTowerCalib::CEMC); + se->registerSubsystem(calib); + + + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(10); + ClusterBuilder->set_threshold_energy(0.032); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(ClusterBuilder); + + + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("dummy", outfile); + // this call is needed for embedding + // eval_pi2->set_centrality_nclusters_cut(350); // which uses more central events + // than we will for data to enhance Bkg + // to match the enhanced signal from embed + eval_pi2->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(eval_pi2); + cout << "successful registration of pi0 " << endl; + + + + /* + LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",outfile); + // LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval7e->CaloType(LiteCaloEval::CEMC); + //eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval7e); + + */ + + + // in->AddListFile("g4hits.list"); + +// Fun4All +// se->registerInputManager(in); + + //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_400.root"); + + //out->StripNode("WAVEFORMS_CEMC"); + //se->registerOutputManager(out); + + se->run(nevents); + + se->End(); + se->PrintTimer(); + gSystem->Exit(0); +} diff --git a/calibrations/calo/calib_nov23/pimacs/plain_sim_dst_simple_preNov23.C b/calibrations/calo/calib_nov23/pimacs/plain_sim_dst_simple_preNov23.C new file mode 100644 index 000000000..f570406f4 --- /dev/null +++ b/calibrations/calo/calib_nov23/pimacs/plain_sim_dst_simple_preNov23.C @@ -0,0 +1,159 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +//#include +#include + +//#include +#include +#include +#include + +#include +#include + + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +//R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + + +#endif + +// to get files from my local area +void clus_dst_simple_superfastcalib( const int file_num = 0 ) + +{ + const int nEvents = -1; + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + ///sphenix/lustre01/sphnxpro/mdc2/shijing_hepmc/fm_0_20/calocluster/run0007 + + string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-"; + string inputFile1 = "DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-"; + //string inputFile2 = "DST_TRUTH_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-"; + string inputFile3 = "DST_GLOBAL_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000007-"; + + string outputFile = "RESULTS/mult_clus_ntuple/iter_23/Fun4All_ntuples_run7_sHijing_iter23_"; + + int ynum_int = 100000 + file_num; + TString yn_tstr = ""; + yn_tstr += ynum_int; + yn_tstr.Remove(0,1); + inputFile0 += yn_tstr.Data(); + inputFile1 += yn_tstr.Data(); + //inputFile2 += yn_tstr.Data(); + inputFile3 += yn_tstr.Data(); + outputFile += yn_tstr.Data(); + + inputFile0 += ".root"; + inputFile1 += ".root"; + //inputFile2 += ".root"; + inputFile3 += ".root"; + outputFile += ".root"; + + std::cout << "-------------------------------------------------------------------" << std::endl; + std::cout << " input files are" << std::endl; + std::cout << "-------------------------------------------------------------------" << std::endl; + std::cout << inputFile0 << std::endl; + std::cout << inputFile1 << std::endl; + //std::cout << inputFile2 << std::endl; + std::cout << inputFile3 << std::endl; + + std::cout << "-------------------------------------------------------------------" << std::endl; + std::cout << "output file is " << std::endl; + std::cout << "-------------------------------------------------------------------" << std::endl; + std::cout << outputFile << std::endl; + + + gSystem->Load("libg4dst"); + + //Fun4AllServer *se = Fun4AllServer::instance(); + + // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile); + // ca->Detector("CEMC"); + // se->registerSubsystem(ca); + + // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in"); + // in->fileopen(fname); + + Fun4AllInputManager *in1 = new Fun4AllDstInputManager("in1"); + in1->fileopen(inputFile1); + se->registerInputManager(in1); + + Fun4AllInputManager *in3 = new Fun4AllDstInputManager("in3"); + in3->fileopen(inputFile3); + se->registerInputManager(in3); + + //CaloTowerBuilder *ca = new CaloTowerBuilder(); + //Enable::CDB = true; + + recoConsts *rc = recoConsts::instance(); + //=============== + // conditions DB flags + //=============== + // global tag + rc->set_StringFlag("CDB_GLOBALTAG","MDC2"); + // // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP",6); + + + CaloTowerCalib *calib = new CaloTowerCalib("CALO_TOWER_CEMC"); + // make sure there is not any mistake in "full file path + name" + // for first iteration file name can be any as we will not use correction factor and default is "1" + calib->setCalibUseMode(1); // decide if we want to use correction factor("0" = do not use (set for first iteration), "1" = use (set for remaining)) + + // these two lines are needed to choose your own correction factor (this is filename) + calib->setCalibName("/sphenix/user/sregmi/WORKING_AREA/PI_0/pi0_calib_m-clust/CDB_CEMC/iter_file/m_clust_pi0_iter22_CDB.root"); + calib->setFieldName("cemc_pi0_abs_calib"); // (this is field name) + calib->set_detector_type(CaloTowerCalib::CEMC); + + se->registerSubsystem(calib); + + + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(10); + ClusterBuilder->set_threshold_energy(0.032); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(ClusterBuilder); + + + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("dummy", outputFile); + // this call is needed for embedding + // eval_pi2->set_centrality_nclusters_cut(350); // which uses more central events + // than we will for data to enhance Bkg + // to match the enhanced signal from embed + eval_pi2->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(eval_pi2); + + + // in->AddListFile("g4hits.list"); + +// Fun4All +// se->registerInputManager(in); + + //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_400.root"); + + //out->StripNode("WAVEFORMS_CEMC"); + //se->registerOutputManager(out); + + se->run(nEvents); + + se->End(); + se->PrintTimer(); + gSystem->Exit(0); +} diff --git a/calibrations/calo/calib_nov23/pimacs/runCCPi0Loop.C b/calibrations/calo/calib_nov23/pimacs/runCCPi0Loop.C new file mode 100644 index 000000000..ab67ab828 --- /dev/null +++ b/calibrations/calo/calib_nov23/pimacs/runCCPi0Loop.C @@ -0,0 +1,46 @@ +#include +//#include "GetTChainMacro.C" +#include +#include +#include "TChain.h" +#include "TTree.h" +#include "TString.h" + + + +void runCCPi0Loop(int nevents = -1, const char *ifile="", const char *ofile="") +{ + R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + CaloCalibEmc_Pi0 calo_obj("CaloCalibEmc_Pi0", ofile); + calo_obj.InitRun(0); + TTree * intree1 = GetTChainMacro(ifile); + // calo_obj.InitializeBadTowers(); + calo_obj.Loop(nevents, ifile, intree1); + calo_obj.End(0); +} + + +TTree* GetTChainMacro(TString ifile="") +{ + ifstream inFile; + inFile.open(ifile, ios::in); // open to read + if (!inFile) + { + cerr << "Unable to open file:\n "; + exit(1); + } + + TChain *pitree = new TChain("_eventTree"); + string root_file; + int lines=0; + while (std::getline(inFile, root_file)) + { + pitree->Add(root_file.c_str()); + lines += 1; + } + printf("total lines: %d\n",lines); + inFile.close(); + + return (TTree *) pitree; +} diff --git a/calibrations/calo/calib_nov23/pimacs/save_correc_value.C b/calibrations/calo/calib_nov23/pimacs/save_correc_value.C new file mode 100644 index 000000000..e2937566b --- /dev/null +++ b/calibrations/calo/calib_nov23/pimacs/save_correc_value.C @@ -0,0 +1,37 @@ +#include + +void save_correc_value( + std::string file_prefix = "m_clust_pi0_iter", + int n_iter = 23 + ) + +{ + R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + // file location + std::string macro_loc = "/sphenix/user/sregmi/WORKING_AREA/PI_0/pi0_calib_m-clust/macros/RESULTS/mult_clus_loop_iter/"; + + // input file + std::string ifile = macro_loc + file_prefix + std::to_string(n_iter) + "_combined.root"; + + // output file + std::string ofile = macro_loc + file_prefix + std::to_string(n_iter) + "_combined_fitted.root"; + + std::string infilent = ""; // used for first iteration ONLY + if (n_iter > 1) + {infilent = macro_loc + file_prefix + std::to_string(n_iter-1) + "_combined_fitted.root";} + + std::cout << "input file , " << ifile << std::endl; + std::cout << "output file , " << ofile << std::endl; + std::cout << "incorrect file , " << infilent << std::endl; + + + CaloCalibEmc_Pi0 calo_obj("CaloCalibEmc_Pi0" /* this name goes to SubsysReco */, ofile.c_str()); + // calo_obj.InitRun(0); // to declare the eta_hist[96] + calo_obj.Get_Histos(ifile.c_str() , ofile.c_str()); // open the fun4al file and Get eta_hist[96] histos + calo_obj.Fit_Histos_Etas96(infilent.c_str()); // do fittings + calo_obj.End(0); // save the output file + std::cout << "All Done" << std::endl; + gSystem->Exit(0); +} + diff --git a/calibrations/calo/calib_nov23/pimacs/wholeIter_Pi0EtaByEta.C b/calibrations/calo/calib_nov23/pimacs/wholeIter_Pi0EtaByEta.C new file mode 100644 index 000000000..08dde9a8b --- /dev/null +++ b/calibrations/calo/calib_nov23/pimacs/wholeIter_Pi0EtaByEta.C @@ -0,0 +1,332 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include +//#include +#include +#include // for CDBTTree +#include + +//#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcdbobjects) +R__LOAD_LIBRARY(libcalo_reco.so) +//R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + +#endif + +void make_csv(const char * inf, const char * outf); +TTree * GetTChainMacro(TString ifs); +void make_cemcCDBTree(const char * infct, const char * outfct); + + +// to get files from my local area +void wholeIter_Pi0EtaByEta(int nevents = -1, +const int iteration = 1 , +const char *fname = "pi0input.list", +const char * inputCDBfnameIn = "inputcdb1.root", +const char * outfileloc1 = "./", +const char * outfileloc2 = "./") +{ + //, const int runNumber = 0) + + + //outfileloc1 --> $CONDOR_SCRATCH --> throwaway temp files + //outfileloc2 --> user defined gfps to watch/monitor iterations or debug + + gSystem->Load("libg4dst"); + + std::string inputCDBfname = inputCDBfnameIn; + + const std::string defout1 = outfileloc1; + const std::string defout2 = outfileloc2; + // filenames, other than input + std::string outntupfile = defout1 + "/outntup_iter"+ std::to_string(iteration) + ".root"; + std::string outloopfile = defout1 + "/outntup_loop" + std::to_string(iteration) + ".root"; + std::string outfitfile = defout2 + "/outfit_" + std::to_string(iteration) + ".root"; + std::string outcsvfile = defout1 + "/csvoutfit" + std::to_string(iteration) + ".csv"; + std::string iterCDBfile = defout2 + "/cdbtree"+ std::to_string(iteration) + ".root"; + + // in other than the first iteration, the previous iteration's corrections + // are needed both in CDBTree form (for input to clusters) and in "native" CaloCalibEmc_Pi0 form + // (for aggregation of cumulative corrections across each iteration) + std::string prevoutfitfile = defout2 + "/outfit_" + std::to_string(iteration-1) + ".root"; + if (iteration == 1) + prevoutfitfile = ""; + + // for iterations other than 1, ignore input cdbfname and use previous iteration's + if (iteration > 1) + inputCDBfname = defout2 + "/cdbtree" + std::to_string(iteration-1) + ".root"; + + Fun4AllServer *se = Fun4AllServer::instance(); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("in"); + + TString infiletstr(fname); + if (infiletstr.Contains(".list")) + in->AddListFile(fname); + else + in->fileopen(fname); + + + se->registerInputManager(in); + + // JF Nov23 ?? still needed ? + Fun4AllInputManager *intrue2 = new Fun4AllRunNodeInputManager("DST_GEO"); + intrue2->AddFile("updated_geo.root"); + se->registerInputManager(intrue2); + + + + recoConsts *rc = recoConsts::instance(); + rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023"); // this points to the global tag in the CDB + // The calibrations have a validity range set by the beam clock which is not read out of the prdfs as of now + rc->set_uint64Flag("TIMESTAMP",0); + // rc->set_uint64Flag("TIMESTAMP",runNumber); + + + CaloTowerCalib *calib = new CaloTowerCalib("CEMCCALIB"); + // calib->setCalibName("cemc_abscalib_cosmic");// these two lines are needed to choose your own calibration + + // JF to Blair --> below change preferred fieldname for first towerslope iter + if (iteration == 1) // blair-defined towerslope CBDtree + { + calib->setFieldName("cemc_pi0_abs_calib"); + } + else + { + // leave this, at least at first, using Sijan's defined + // cdbtree outputs + calib->setFieldName("cemc_pi0_abs_calib"); + } + + calib->set_directURL(inputCDBfname); + + se->registerSubsystem(calib); + + + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(10); + ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + + //NOV 23 Blair : new + ClusterBuilder->setInputTowerNodeName("TOWERINFO_CALIB_CEMC"); + ClusterBuilder->setOutputClusterNodeName("CLUSTERINFO2"); + + se->registerSubsystem(ClusterBuilder); + + + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("dummy", outntupfile); + eval_pi2->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + eval_pi2->setInputTowerNodeName("TOWERINFO_CALIB_CEMC"); + eval_pi2->setInputClusterNodeName("CLUSTERINFO2"); + se->registerSubsystem(eval_pi2); + cout << "successful registration of pi0 " << endl; + + se->run(nevents); + se->End(); + + + // loop over ntuple file + CaloCalibEmc_Pi0 calo_obj("CaloCalibEmc_Pi0", outloopfile); + calo_obj.InitRun(0); + // TTree * intree1 = GetTChainMacro(ifile); // if parallelized + calo_obj.Loop(nevents, outntupfile); + calo_obj.End(0); + + + //now fit: + CaloCalibEmc_Pi0 calo_obj2("CaloCalibEmc_Pi0",""); + //for test using previous + // outloopfile = "/sphenix/user/jfrantz/thdatNov22/pimacs/cutsg33_cpi1_21813.root"; + + calo_obj2.Get_Histos(outloopfile.c_str() , outfitfile.c_str()); + calo_obj2.Fit_Histos_Etas96(prevoutfitfile.c_str()); // see note at beginning during filenames settings + calo_obj2.End(0); + + // now gen CDBTree file using Sijan's methods + make_csv(outfitfile.c_str(), outcsvfile.c_str()); + make_cemcCDBTree(outcsvfile.c_str(), iterCDBfile.c_str()); + + + se->PrintTimer(); + + // gSystem->Exit(0); +} + + +TTree* GetTChainMacro(TString ifile="") +{ + ifstream inFile; + inFile.open(ifile, ios::in); // open to read + if (!inFile) + { + cerr << "Unable to open file:\n "; + exit(1); + } + + TChain *pitree = new TChain("_eventTree"); + string root_file; + int lines=0; + while (std::getline(inFile, root_file)) + { + pitree->Add(root_file.c_str()); + lines += 1; + } + printf("total lines: %d\n",lines); + inFile.close(); + + return (TTree *) pitree; + + } + + +void make_csv( const char * input_filechar, const char * output_filechar) +{ + // input file + const string input_file = input_filechar; + + // output file + const string output_file = output_filechar; + + + // Open the ROOT file + TFile *file = TFile::Open(input_file.c_str(), "READ"); + + // Create an output CSV file + std::ofstream csvFile(output_file.c_str()); + + // Get the TTree + TTree *tree = (TTree*)file->Get("nt_corrVals"); + + // Get the number of entries (rows) in the TTree + Long64_t nEntries = tree->GetEntries(); + + if (nEntries != 24576) {std::cout << "The number of entries does not match with EMCal. The number is " << nEntries << " ." << std::endl;} + + + // Get the number of branches (columns) in the TTree + TObjArray *branches = tree->GetListOfBranches(); + int nbranches = branches->GetEntries(); + + + // write the header for CSV file + csvFile << "phibin" << " , " << "etabin" << " , " << "calib-factor" << std::endl; + + for (int j = 0; j < nEntries; j++) // for each entry in the Branches + { + tree->GetEntry(j); + + int ieta, iphi; + float agg_corr_val; + + for (int b = 0; b < nbranches; ++b) + { + TBranch *branch = (TBranch*)branches->At(b); + TLeaf *leaf = (TLeaf*)branch->GetListOfLeaves()->At(0); + + if (b == 0) {ieta = leaf->GetValue(0);} + if (b == 1) {iphi = leaf->GetValue(0);} + if (b == 3) {agg_corr_val = leaf->GetValue(0);} + } + csvFile << iphi << " , " << ieta << " , " << agg_corr_val << "\n"; + } + + // Clean up + csvFile.close(); + file->Close(); + delete file; + std::cout << "All Done making csvfile:" << output_file << std::endl; + // return 0; +} + + +void make_cemcCDBTree(const char * input_file1, // csv file to be supplied + const char * output_file1) // output root file having CDB Ttree +{ + // file location, input file and output file + + + const string input_file = input_file1; + const string output_file = output_file1; + + std::cout << "start making CDBTree: " << output_file1 << std::endl; + + float corrArray[256][96]; + string line, cell1, cell2, cell3; + + // Open the CSV file + ifstream file(input_file.c_str()); + + // read header row and do nothing + std::getline(file, line); + while(getline(file, line)) + { + stringstream lineStream(line); + + getline(lineStream, cell1, ','); + //std::cout << "phi: " << std::stoi(cell1) << " "; + + getline(lineStream, cell2, ','); + //std::cout << "eta: " << std::stoi(cell2) << " "; + + getline(lineStream, cell3, ','); + //std::cout << "corr: " << std::stof(cell3) << std::endl; + + corrArray[std::stoi(cell1)][std::stoi(cell2)] = std::stof(cell3); + } + file.close(); + + /* to check if my array was correctly filled + * -------------------------------------- + for (int iphi=0; iphi<256; iphi++) + { + for (int ieta=0; ieta<96; ieta++) + { + std::cout << iphi << " " << ieta << " " << corrArray[iphi][ieta] << std::endl; + } + } + */ + + CDBTTree *cdbttree = new CDBTTree(output_file.c_str()); + for(int iphi=0; iphi<256; iphi++){ + for(int ieta=0; ieta<96; ieta++){ + int key = iphi + (ieta << 16); + cdbttree->SetFloatValue(key, "cemc_pi0_abs_calib", corrArray[iphi][ieta]); + } + } + + cdbttree->Commit(); + //cdbttree->Print(); + cdbttree->WriteCDBTTree(); + delete cdbttree; + std::cout << "cdb success " << std::endl; + // gSystem->Exit(0); +} diff --git a/calibrations/calo/calib_nov23/towerslope/TSCtoCDBTTree.C b/calibrations/calo/calib_nov23/towerslope/TSCtoCDBTTree.C new file mode 100644 index 000000000..0c37c7888 --- /dev/null +++ b/calibrations/calo/calib_nov23/towerslope/TSCtoCDBTTree.C @@ -0,0 +1,56 @@ +#include +#include // for CDBTTree +#include +#include +#include "TowerInfo.h" +#include "TowerInfoDefs.h" + +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +R__LOAD_LIBRARY(libcdbobjects) +R__LOAD_LIBRARY(libphool.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libcalo_io.so) + +void TSCtoCDBTTree(const char * infile, const char * outputfile) +{ + + bool chk4file = gSystem->AccessPathName(infile); + TFile *f = nullptr; + + if(!chk4file) + { + f = new TFile(infile,"READ"); + } + else + { + std::cout << "File " << infile << " cant be found in current directory." << std::endl; + exit(0); + } + + //write to cdb tree + CDBTTree *cdbttree = new CDBTTree(outputfile); + + //gain values lie in the 2d histogram called corrPat + TH2F *cp = (TH2F *)f->Get("corrPat"); + + for(int i = 0; i < 96 ; i++) + { + for(int j = 0; j < 256; j++) + { + unsigned int key = TowerInfoDefs::encode_emcal(i,j); + float gain = (1.0 / cp->GetBinContent(i+1,j+1) ); + if (cp->GetBinContent(i+1,j+1)==0) gain = 0; + if (isnan(cp->GetBinContent(i+1,j+1))) {gain = 0; cout << i << "," << j << endl;} + cdbttree->SetFloatValue(key,"Femc_datadriven_qm1_correction",gain); + } + } + + cdbttree->Commit(); + cdbttree->WriteCDBTTree(); + //cdbttree->Print(); + f->Close(); + delete f; + delete cdbttree; + +}//end macro diff --git a/calibrations/calo/calib_nov23/towerslope/createLocalEMCalCalibFile.C b/calibrations/calo/calib_nov23/towerslope/createLocalEMCalCalibFile.C new file mode 100644 index 000000000..30ebf64f5 --- /dev/null +++ b/calibrations/calo/calib_nov23/towerslope/createLocalEMCalCalibFile.C @@ -0,0 +1,39 @@ +#include +#include // for CDBTTree +#include + +R__LOAD_LIBRARY(libcdbobjects) + + +void createLocalEMCalCalibFile(const string fname,int runNumber){ + + string default_time_independent_calib = "cemc_pi0_twrSlope_v1_default"; + string m_calibName = "cemc_pi0_twrSlope_v1"; + + string calibdir = CDBInterface::instance()->getUrl(m_calibName); + string filePath; + + if (!calibdir.empty()) + { + filePath = calibdir; + //cdbttree = new CDBTTree(calibdir); + } + else + { + calibdir = CDBInterface::instance()->getUrl(default_time_independent_calib); + + if (calibdir.empty()) + { + std::cout << "No EMCal Calibration NOT even a default" << std::endl; + exit(1); + } + filePath = calibdir; + //cdbttree = new CDBTTree(calibdir); + std::cout << "No specific file for " << m_calibName << " found, using default calib " << default_time_independent_calib << std::endl; + } + + TFile* f_cdb = new TFile(filePath.c_str()); + f_cdb->Cp(fname.c_str()); + + delete f_cdb; +} diff --git a/calibrations/calo/calib_nov23/towerslope/mergeCDBTTrees.C b/calibrations/calo/calib_nov23/towerslope/mergeCDBTTrees.C new file mode 100644 index 000000000..80fdba703 --- /dev/null +++ b/calibrations/calo/calib_nov23/towerslope/mergeCDBTTrees.C @@ -0,0 +1,41 @@ +#include +#include // for CDBTTree +#include +#include +#include "TowerInfo.h" +#include "TowerInfoDefs.h" + +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +R__LOAD_LIBRARY(libcdbobjects) +R__LOAD_LIBRARY(libphool.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libcalo_io.so) + +void mergeCDBTTrees(const char * infile1, const char * infile2, const char * outputfile) +{ + + CDBTTree *cdbttree1 = new CDBTTree(infile1); + CDBTTree *cdbttree2 = new CDBTTree(infile2); + CDBTTree *cdbttreeOut = new CDBTTree(outputfile); + + string m_fieldname = "Femc_datadriven_qm1_correction"; + + for(int i = 0; i < 96 ; i++) + { + for(int j = 0; j < 256; j++) + { + unsigned int key = TowerInfoDefs::encode_emcal(i,j); + float val1 = cdbttree1->GetFloatValue(key, m_fieldname); + float val2 = cdbttree2->GetFloatValue(key, m_fieldname); + cdbttreeOut->SetFloatValue(key,m_fieldname,val1*val2); + } + } + + cdbttreeOut->Commit(); + cdbttreeOut->WriteCDBTTree(); + delete cdbttreeOut; + delete cdbttree1; + delete cdbttree2; + +}//end macro diff --git a/calibrations/calo/calib_nov23/towerslope/rings_do_eta_fit2_emc.C b/calibrations/calo/calib_nov23/towerslope/rings_do_eta_fit2_emc.C new file mode 100644 index 000000000..34c686d1b --- /dev/null +++ b/calibrations/calo/calib_nov23/towerslope/rings_do_eta_fit2_emc.C @@ -0,0 +1,40 @@ +#include + +#include +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +// regular file, modified file, output file +void rings_do_eta_fit2_emc(const char * infile, const char * modfile) +{ + TStopwatch t; + t.Start(); + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval modlce; + + //reflce.CaloType(LiteCaloEval::CEMC); + modlce.CaloType(LiteCaloEval::CEMC); + + /// we really dont need to retrieve histos here bc we arent using ref object + /// reflce.Get_Histos(reffile); + + modlce.Get_Histos(infile,modfile); + + modlce.m_myminbin = 8; // this really is min bin (no -1/+1 needed) + // but not sure if for summer 23 this should + // be 8 or 9 I think 8 according to Joey Clement + // on ~Nov 1, mattermost post + modlce.m_mymaxbin = 95 + 1 ; // this actually means maxbin is 1 less + // modlce.m_mymaxbin = 95+1; // so that means maxbin is 95 which is + // really the max eta bin for emc, indexed 0 through 95 + + + modlce.setFitMin(0.12); + modlce.setFitMax(0.7); + + modlce.FitRelativeShifts(&modlce,110); + + t.Stop(); + t.Print(); + +} diff --git a/calibrations/calo/calib_nov23/towerslope/towerslope_dst_runner.C b/calibrations/calo/calib_nov23/towerslope/towerslope_dst_runner.C new file mode 100644 index 000000000..8502c2115 --- /dev/null +++ b/calibrations/calo/calib_nov23/towerslope/towerslope_dst_runner.C @@ -0,0 +1,83 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +//#include +#include + +#include +#include +#include +//#include + +#include + + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +//R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + + +#endif + +// to get files from my local area +void towerslope_dst_runner(int nevents = 1e5, const char *fname = "/sphenix/user/sregmi/FINAL_VERSION/tower_slope_old_tower_method/3_RawWaveformTowerBuilder/macro/testoutput_400.root", const char * outfile = "defout.root") +//,const int runNumber) +{ + + Fun4AllServer *se = Fun4AllServer::instance(); + + + Fun4AllInputManager *in = new Fun4AllDstInputManager("in"); + + TString infiletstr(fname); + if (infiletstr.Contains(".list")) + in->AddListFile(fname); + else + in->fileopen(fname); + + + se->registerInputManager(in); + + //JF to Blair Nov 23 -- leaving these next blocks, similar code + // would be needed if we run a second iteration of towerslope + // which is fairly possible. + + //CaloTowerBuilder *ca = new CaloTowerBuilder(); + + // // recoConsts *rc = recoConsts::instance(); + // // rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023"); // this points to the global tag in the CDB + // // The calibrations have a validity range set by the beam clock which is not read out of the prdfs as of now + //rc->set_uint64Flag("TIMESTAMP",runNumber); + + + // CaloTowerCalib *calib = new CaloTowerCalib("CEMCCALIB"); + // // calib->setCalibName("cemc_abscalib_cosmic");// these two lines are needed to choose your own calibration + // // calib->setFieldName("cemc_abscalib_cosmic"); + // calib->set_detector_type(CaloTowerCalib::CEMC); + // se->registerSubsystem(calib); + + std::cout << "in tow dst " << std::endl; + + + LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",outfile); + // LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval7e->CaloType(LiteCaloEval::CEMC); + eval7e->setInputTowerNodeName("TOWERINFO_CALIB_CEMC"); + //eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval7e); + + + se->run(nevents); + + se->End(); + se->PrintTimer(); + gSystem->Exit(0); +} diff --git a/calibrations/calo/calib_nov23/towerslope/tsdst_plus_tsfit.C b/calibrations/calo/calib_nov23/towerslope/tsdst_plus_tsfit.C new file mode 100644 index 000000000..798651be9 --- /dev/null +++ b/calibrations/calo/calib_nov23/towerslope/tsdst_plus_tsfit.C @@ -0,0 +1,137 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +//#include +#include +#include + +#include +#include +#include +//#include + +#include + +#include "createLocalEMCalCalibFile.C" +#include "mergeCDBTTrees.C" +#include "TSCtoCDBTTree.C" + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +//R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + + +#endif + +// to get files from my local area +void tsdst_plus_tsfit(int nevents = 1, const char *fname = "input.list", const char * outfile = "defout.root", const char * fitoutfile = "deffitout.root") +//,const int runNumber) +{ + + Fun4AllServer *se = Fun4AllServer::instance(); + + + Fun4AllInputManager *in = new Fun4AllDstInputManager("in"); + + TString infiletstr(fname); + if (infiletstr.Contains(".list")) + in->AddListFile(fname); + else + in->fileopen(fname); + + se->registerInputManager(in); + + + // initalize CDB to pull what we "think" is the "base" calibration + // into a local cdbttree so we can update it with the tower slope output + recoConsts *rc = recoConsts::instance(); + ifstream file(fname); + string first_file; + getline(file, first_file); + + pair runseg = Fun4AllUtils::GetRunSegment(first_file); + int runnumber = runseg.first; + cout << "run number = " << runnumber << endl; + + // global tag + rc->set_StringFlag("CDB_GLOBALTAG","MDC2"); + // // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP",runnumber); + + string local_cdb_copy_name = "local_cdb_copy.root"; + createLocalEMCalCalibFile(local_cdb_copy_name.c_str(),runnumber); + + + //JF to Blair Nov 23 -- leaving these next blocks, similar code + // would be needed if we run a second iteration of towerslope + // which is fairly possible. + + //CaloTowerBuilder *ca = new CaloTowerBuilder(); + + // // recoConsts *rc = recoConsts::instance(); + // // rc->set_StringFlag("CDB_GLOBALTAG","ProdA_2023"); // this points to the global tag in the CDB + // // The calibrations have a validity range set by the beam clock which is not read out of the prdfs as of now + //rc->set_uint64Flag("TIMESTAMP",runNumber); + + + // CaloTowerCalib *calib = new CaloTowerCalib("CEMCCALIB"); + // // calib->setCalibName("cemc_abscalib_cosmic");// these two lines are needed to choose your own calibration + // // calib->setFieldName("cemc_abscalib_cosmic"); + // calib->set_detector_type(CaloTowerCalib::CEMC); + // se->registerSubsystem(calib); + + std::cout << "in tow dst " << std::endl; + + + LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",outfile); + // LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval7e->CaloType(LiteCaloEval::CEMC); + eval7e->setInputTowerNodeName("TOWERINFO_CALIB_CEMC"); + //eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval7e); + + + se->run(nevents); + + se->End(); + se->PrintTimer(); + + + LiteCaloEval modlce; + + //reflce.CaloType(LiteCaloEval::CEMC); + modlce.CaloType(LiteCaloEval::CEMC); + + + modlce.Get_Histos(outfile,fitoutfile); + + modlce.m_myminbin = 8; // this really is min bin (no -1/+1 needed) + // but not sure if for summer 23 this should + // be 8 or 9 I think 8 according to Joey Clement + // on ~Nov 1, mattermost post + modlce.m_mymaxbin = 95 + 1 ; // this actually means maxbin is 1 less + // modlce.m_mymaxbin = 95+1; // so that means maxbin is 95 which is + // really the max eta bin for emc, indexed 0 through 95 + + + modlce.setFitMin(0.12); + modlce.setFitMax(0.7); + + modlce.FitRelativeShifts(&modlce,110); + + + // create the cdbttree from tsc output andd multiply the corrections + // into the base calibration to pickup for pi0 first iteration + TSCtoCDBTTree(fitoutfile,"tsc_output_cdb.root"); + mergeCDBTTrees("tsc_output_cdb.root",local_cdb_copy_name.c_str(),"calib_post_TSC.root"); + + gSystem->Exit(0); +} diff --git a/calibrations/calo/emc_pi0_tbt/Fun4All_pi0tbt_SIMPLE_EMBED.C b/calibrations/calo/emc_pi0_tbt/Fun4All_pi0tbt_SIMPLE_EMBED.C new file mode 100644 index 000000000..3e5a42c41 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/Fun4All_pi0tbt_SIMPLE_EMBED.C @@ -0,0 +1,526 @@ +#ifndef MACRO_FUN4ALLG4SPHENIX_C +#define MACRO_FUN4ALLG4SPHENIX_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcaloCalibDBFile.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + +// For HepMC Hijing +// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat + +int Fun4All_pi0tbt_SIMPLE_EMBED( + const int nEvents = 3, + const int mdc2_4_file_num = 1, + const string &outputFile = "out_jan23.root", + const int skip = 0, + const string &outdir = ".") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + string inputFile2 = "DST_TRUTH_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + + int ynum_int = 100000+ mdc2_4_file_num; + TString yn_tstr = ""; + yn_tstr += ynum_int; + yn_tstr.Remove(0,1); + inputFile0 += yn_tstr.Data(); + inputFile1 += yn_tstr.Data(); + inputFile2 += yn_tstr.Data(); + + inputFile0 += ".root"; + inputFile1 += ".root"; + inputFile2 += ".root"; + + cout << "running over these files" << endl; + cout << inputFile0 << endl; + cout << inputFile1 << endl; + + //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. + PHRandomSeed::Verbosity(1); + + // just if we set some flags somewhere in this macro + recoConsts *rc = recoConsts::instance(); + + //=============== + // Input options + //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 1; + + Input::READHITS = false; // true; + //INPUTREADHITS::filename[0] = inputFile0; + //INPUTREADHITS::filename[1] = inputFile1; + + Input::EMBED = true; + INPUTEMBED::filename[0] = inputFile0; //0; + INPUTEMBED::filename[1] = inputFile1; + INPUTEMBED::filename[2] = inputFile2; + + Input::SIMPLE = true; + Input::SIMPLE_VERBOSITY = 0; + + InputInit(); + + //-------------- + // Set generator specific options + //-------------- + // can only be set after InputInit() is called + + // Simple Input generator: + // if you run more than one of these Input::SIMPLE_NUMBER > 1 + // add the settings for other with [1], next with [2]... + if (Input::SIMPLE) + { + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi0",10); + if (Input::HEPMC || Input::EMBED) + { + //INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_global_vertex(true); + INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + else + { + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Gaus, + PHG4SimpleEventGenerator::Gaus, + PHG4SimpleEventGenerator::Gaus); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0.01, 0.01, 5.); + } + INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1.1, 1.1); + INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(1.6, 5.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_power_law_n(-6.5); + } + + + if (Input::PILEUPRATE > 0) + { + //! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001 + Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCPileupInputManager); + } + // register all input generators with Fun4All + InputRegister(); + + // set up production relatedstuff + Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + Enable::DSTOUT = false; + Enable::DSTOUT_COMPRESS = false; + DstOut::OutputDir = outdir; + DstOut::OutputFile = outputFile; + + //Option to convert DST to human command readable TTree for quick poke around the outputs + // Enable::DSTREADER = true; + + // turn the display on (default off) + Enable::DISPLAY = false; + + //====================== + // What to run + //====================== + + // QA, main switch + Enable::QA = false; + + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + // Enable::MBD = true; + // Enable::MBD_SUPPORT = true; // save hist in MBD/BBC support structure + //Enable::MBDFAKE = true; // Smeared vtx and t0, use if you don't want real MBD/BBC in simulation + + //Enable::PIPE = true; + //Enable::PIPE_ABSORBER = true; + //Enable::INTT = false; +// Enable::INTT_ABSORBER = true; // enables layerwise support structure readout +// Enable::INTT_SUPPORT = true; // enable global support structure readout + Enable::INTT_CELL = Enable::INTT && true; + Enable::INTT_CLUSTER = Enable::INTT_CELL && true; + Enable::INTT_QA = Enable::INTT_CLUSTER && Enable::QA && true; + + Enable::TPC = false; + Enable::TPC_ABSORBER = true; + Enable::TPC_CELL = Enable::TPC && true; + Enable::TPC_CLUSTER = Enable::TPC_CELL && true; + Enable::TPC_QA = Enable::TPC_CLUSTER && Enable::QA && true; + + Enable::MICROMEGAS = false; + Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; + Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; + Enable::MICROMEGAS_QA = Enable::MICROMEGAS_CLUSTER && Enable::QA && true; + + Enable::TRACKING_TRACK = false; + Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true; + Enable::TRACKING_QA = Enable::TRACKING_TRACK && Enable::QA && true; + + // cemc electronics + thin layer of W-epoxy to get albedo from cemc + // into the tracking, cannot run together with CEMC + // Enable::CEMCALBEDO = true; + + Enable::CEMC = true; + // Enable::CEMC_ABSORBER = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; + Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; + //Enable::CEMC_EVAL = false;//Enable::CEMC_CLUSTER && true; + //Enable::CEMC_QA = false;//Enable::CEMC_CLUSTER && Enable::QA && true; + + Enable::HCALIN =false; + Enable::HCALIN_ABSORBER = true; + Enable::HCALIN_CELL = Enable::HCALIN && true; + Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; + Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true; + Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; + Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && true; + + Enable::MAGNET = false; + Enable::MAGNET_ABSORBER = false; + + Enable::HCALOUT = false; + Enable::HCALOUT_ABSORBER = true; + Enable::HCALOUT_CELL = Enable::HCALOUT && true; + Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; + Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true; + Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; + Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER && Enable::QA && true; + + Enable::EPD = false; + + Enable::BEAMLINE = true; +// Enable::BEAMLINE_ABSORBER = true; // makes the beam line magnets sensitive volumes +// Enable::BEAMLINE_BLACKHOLE = true; // turns the beamline magnets into black holes + Enable::ZDC = false; +// Enable::ZDC_ABSORBER = true; +// Enable::ZDC_SUPPORT = true; + Enable::ZDC_TOWER = Enable::ZDC && true; + Enable::ZDC_EVAL = Enable::ZDC_TOWER && true; + + //! forward flux return plug door. Out of acceptance and off by default. + //Enable::PLUGDOOR = true; + //Enable::PLUGDOOR_ABSORBER = true; + + //Enable::GLOBAL_RECO = true; + //Enable::GLOBAL_FASTSIM = true; + + //Enable::KFPARTICLE = true; + //Enable::KFPARTICLE_VERBOSITY = 1; + //Enable::KFPARTICLE_TRUTH_MATCH = true; + //Enable::KFPARTICLE_SAVE_NTUPLE = true; + + Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + + Enable::JETS = false; + Enable::JETS_EVAL = Enable::JETS && true; + Enable::JETS_QA = Enable::JETS && Enable::QA && true; + + // HI Jet Reco for p+Au / Au+Au collisions (default is false for + // single particle / p+p-only simulations, or for p+Au / Au+Au + // simulations which don't particularly care about jets) + Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + + // 3-D topoCluster reconstruction, potentially in all calorimeter layers + Enable::TOPOCLUSTER = false && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + // particle flow jet reconstruction - needs topoClusters! + //Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; + // centrality reconstruction + //Enable::CENTRALITY = true; + + // new settings using Enable namespace in GlobalVariables.C + //Enable::BLACKHOLE = true; + //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits + //BlackHoleGeometry::visible = true; + + // Initialize the selected subsystems + G4Init(); + + //--------------------- + // GEANT4 Detector description + //--------------------- + + + if (!Input::READHITS) + { + G4Setup(); + } + + + //------------------ + // Detector Division + //------------------ + + if (Enable::MBD || Enable::MBDFAKE) Mbd_Reco(); + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + if (Enable::MICROMEGAS_CELL) Micromegas_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + //----------------------------- + // CEMC towering and clustering + //----------------------------- + + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); + + //----------------------------- + // HCAL towering and clustering + //----------------------------- + + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); + + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); + + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (Enable::TOPOCLUSTER) TopoClusterReco(); + + //-------------- + // SVTX tracking + //-------------- + if(Enable::TRACKING_TRACK) + { + TrackingInit(); + } + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) TPC_Clustering(); + if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering(); + + if (Enable::TRACKING_TRACK) + { + Tracking_Reco(); + } + //----------------- + // Global Vertexing + //----------------- + /* + if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM) + { + cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl; + gSystem->Exit(1); + } + if (Enable::GLOBAL_RECO) + { + Global_Reco(); + } + else if (Enable::GLOBAL_FASTSIM) + { + Global_FastSim(); + } +*/ + + //----------------- + // Centrality Determination + //----------------- + + if (Enable::CENTRALITY) + { + Centrality(); + } + + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + + //--------- + // Jet reco + //--------- + + if (Enable::JETS) Jet_Reco(); + if (Enable::HIJETS) HIJetReco(); + + if (Enable::PARTICLEFLOW) ParticleFlow(); + + //---------------------- + // Simulation evaluation + //---------------------- + string outputroot = outputFile; + string remove_this = ".root"; + size_t pos = outputroot.find(remove_this); + if (pos != string::npos) + { + outputroot.erase(pos, remove_this.length()); + } + + if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4svtx_eval.root"); + + if (Enable::CEMC_EVAL) CEMC_Eval(outputroot + "_g4cemc_eval.root"); + + if (Enable::HCALIN_EVAL) HCALInner_Eval(outputroot + "_g4hcalin_eval.root"); + + if (Enable::HCALOUT_EVAL) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root"); + + if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); + + if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root"); + + if (Enable::USER) UserAnalysisInit(); + + + + + //====================== + // Run KFParticle on evt + //====================== + if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); + if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); + + //---------------------- + // Standard QAs + //---------------------- + + if (Enable::CEMC_QA) CEMC_QA(); + if (Enable::HCALIN_QA) HCALInner_QA(); + if (Enable::HCALOUT_QA) HCALOuter_QA(); + + if (Enable::JETS_QA) Jet_QA(); + + if (Enable::MVTX_QA) Mvtx_QA(); + if (Enable::INTT_QA) Intt_QA(); + if (Enable::TPC_QA) TPC_QA(); + if (Enable::MICROMEGAS_QA) Micromegas_QA(); + if (Enable::TRACKING_QA) Tracking_QA(); + + if (Enable::TRACKING_QA && Enable::CEMC_QA && Enable::HCALIN_QA && Enable::HCALOUT_QA) QA_G4CaloTracking(); + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + if (Enable::DSTOUT_COMPRESS) + { + ShowerCompress(); + DstCompress(out); + } + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + if (Enable::DISPLAY) + { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout << "-------------------------------------------------" << endl; + cout << "You are in event display mode. Run one event with" << endl; + cout << "se->run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; + gROOT->ProcessLine("displaycmd()"); + + return 0; + } + + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("dummy", outputroot+"_piemc.root"); + // this call is needed for embedding + eval_pi2->set_centrality_nclusters_cut(350); // which uses more central events + // than we will for data to enhance Bkg + // to match the enhanced signal from embed + se->registerSubsystem(eval_pi2); + cout << "successful registration of pi0 " << endl; + + + // if we use a negative number of events we go back to the command line here + if (nEvents < 0) + { + return 0; + } + // if we run the particle generator and use 0 it'll run forever + // for embedding it runs forever if the repeat flag is set + if (nEvents == 0 && !Input::HEPMC && !Input::READHITS && INPUTEMBED::REPEAT) + { + cout << "using 0 for number of events is a bad idea when using particle generators" << endl; + cout << "it will run forever, so I just return without running anything" << endl; + return 0; + } + + se->skip(skip); + se->run(nEvents); + + //----- + // QA output + //----- + + if (Enable::QA) QA_Output(outputroot + "_qa.root"); + + //----- + // Exit + //----- + + se->End(); + std::cout << "All done" << std::endl; + delete se; + /* + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + */ + gSystem->Exit(0); + return 0; +} +#endif diff --git a/calibrations/calo/emc_pi0_tbt/G4Setup_sPHENIX.C b/calibrations/calo/emc_pi0_tbt/G4Setup_sPHENIX.C new file mode 100644 index 000000000..f8331d084 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/G4Setup_sPHENIX.C @@ -0,0 +1,224 @@ +#ifndef MACRO_G4SETUPSPHENIX_C +#define MACRO_G4SETUPSPHENIX_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) + +void G4Init() +{ + // Check on invalid combinations + if (Enable::CEMC && Enable::CEMCALBEDO) + { + cout << "Enable::CEMCALBEDO and Enable::CEMC cannot be set simultanously" << endl; + gSystem->Exit(1); + } + // load detector/material macros and execute Init() function + + if (Enable::PIPE) PipeInit(); + if (Enable::MVTX) MvtxInit(); + if (Enable::INTT) InttInit(); + if (Enable::TPC) TPCInit(); + if (Enable::MICROMEGAS) MicromegasInit(); + if (Enable::MBD) MbdInit(); + if (Enable::CEMCALBEDO) CEmcAlbedoInit(); + if (Enable::CEMC) CEmcInit(); + if (Enable::HCALIN) HCalInnerInit(); + if (Enable::MAGNET) MagnetInit(); + MagnetFieldInit(); // We want the field - even if the magnet volume is disabled + if (Enable::HCALOUT) HCalOuterInit(); + if (Enable::PLUGDOOR) PlugDoorInit(); + if (Enable::EPD) EPDInit(); + if (Enable::BEAMLINE) + { + BeamLineInit(); + if (Enable::ZDC) + { + ZDCInit(); + } + } + if (Enable::USER) UserInit(); + if (Enable::BLACKHOLE) BlackHoleInit(); +} + +int G4Setup() +{ + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4Reco *g4Reco = new PHG4Reco(); + g4Reco->set_rapidity_coverage(1.1); // according to drawings + WorldInit(g4Reco); + if (G4P6DECAYER::decayType != EDecayType::kAll) + { + g4Reco->set_force_decay(G4P6DECAYER::decayType); + } + + double fieldstrength; + istringstream stringline(G4MAGNET::magfield); + stringline >> fieldstrength; + if (stringline.fail()) + { // conversion to double fails -> we have a string + + if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos || + G4MAGNET::magfield == "CDB") + { + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::Field3DCartesian); + } + else + { + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::kField2D); + } + } + else + { + g4Reco->set_field(fieldstrength); // use const soleniodal field + } + g4Reco->set_field_rescale(G4MAGNET::magfield_rescale); + +// the radius is an older protection against overlaps, it is not +// clear how well this works nowadays but it doesn't hurt either + double radius = 0.; + + if (Enable::PIPE) radius = Pipe(g4Reco, radius); + if (Enable::MVTX) radius = Mvtx(g4Reco, radius); + if (Enable::INTT) radius = Intt(g4Reco, radius); + if (Enable::TPC) radius = TPC(g4Reco, radius); + if (Enable::MICROMEGAS) Micromegas(g4Reco); + if (Enable::MBD) Mbd(g4Reco); + if (Enable::CEMCALBEDO) CEmcAlbedo(g4Reco); + if (Enable::CEMC) radius = CEmc(g4Reco, radius, 8); + if (Enable::HCALIN) radius = HCalInner(g4Reco, radius, 4); + if (Enable::MAGNET) radius = Magnet(g4Reco, radius); + if (Enable::HCALOUT) radius = HCalOuter(g4Reco, radius, 4); + if (Enable::PLUGDOOR) PlugDoor(g4Reco); + if (Enable::EPD) EPD(g4Reco); + if (Enable::BEAMLINE) + { + BeamLineDefineMagnets(g4Reco); + BeamLineDefineBeamPipe(g4Reco); + if (Enable::ZDC) + { + ZDCSetup(g4Reco); + } + } + if (Enable::USER) UserDetector(g4Reco); + + + //---------------------------------------- + // BLACKHOLE + + if (Enable::BLACKHOLE) BlackHole(g4Reco, radius); + + PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); + g4Reco->registerSubsystem(truth); + + // finally adjust the world size in case the default is too small + WorldSize(g4Reco, radius); + + se->registerSubsystem(g4Reco); + return 0; +} + +void ShowerCompress(int verbosity = 0) +{ + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); + compress->AddHitContainer("G4HIT_PIPE"); + compress->AddHitContainer("G4HIT_SVTXSUPPORT"); + compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); + compress->AddHitContainer("G4HIT_CEMC"); + compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); + compress->AddHitContainer("G4HIT_CEMC_SPT"); + compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); + compress->AddHitContainer("G4HIT_HCALIN"); + compress->AddHitContainer("G4HIT_HCALIN_SPT"); + compress->AddHitContainer("G4HIT_MAGNET"); + compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); + compress->AddHitContainer("G4HIT_HCALOUT"); + compress->AddHitContainer("G4HIT_BH_1"); + compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); + compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); + compress->AddHitContainer("G4HIT_MBD"); + compress->AddCellContainer("G4CELL_CEMC"); + compress->AddCellContainer("G4CELL_HCALIN"); + compress->AddCellContainer("G4CELL_HCALOUT"); + compress->AddTowerContainer("TOWER_SIM_CEMC"); + compress->AddTowerContainer("TOWER_RAW_CEMC"); + compress->AddTowerContainer("TOWER_CALIB_CEMC"); + compress->AddTowerContainer("TOWER_SIM_HCALIN"); + compress->AddTowerContainer("TOWER_RAW_HCALIN"); + compress->AddTowerContainer("TOWER_CALIB_HCALIN"); + compress->AddTowerContainer("TOWER_SIM_HCALOUT"); + compress->AddTowerContainer("TOWER_RAW_HCALOUT"); + compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); + se->registerSubsystem(compress); + + return; +} + +void DstCompress(Fun4AllDstOutputManager *out) +{ + if (out) + { + out->StripNode("G4HIT_PIPE"); + out->StripNode("G4HIT_SVTXSUPPORT"); + out->StripNode("G4HIT_CEMC_ELECTRONICS"); + out->StripNode("G4HIT_CEMC"); + out->StripNode("G4HIT_ABSORBER_CEMC"); + out->StripNode("G4HIT_CEMC_SPT"); + out->StripNode("G4HIT_ABSORBER_HCALIN"); + out->StripNode("G4HIT_HCALIN"); + out->StripNode("G4HIT_HCALIN_SPT"); + out->StripNode("G4HIT_MAGNET"); + out->StripNode("G4HIT_ABSORBER_HCALOUT"); + out->StripNode("G4HIT_HCALOUT"); + out->StripNode("G4HIT_BH_1"); + out->StripNode("G4HIT_BH_FORWARD_PLUS"); + out->StripNode("G4HIT_BH_FORWARD_NEG"); + out->StripNode("G4HIT_MBD"); + out->StripNode("G4CELL_CEMC"); + out->StripNode("G4CELL_HCALIN"); + out->StripNode("G4CELL_HCALOUT"); + } +} +#endif diff --git a/calibrations/calo/emc_pi0_tbt/README.md b/calibrations/calo/emc_pi0_tbt/README.md new file mode 100644 index 000000000..7dc06e783 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/README.md @@ -0,0 +1,38 @@ +Various macros related to running the pi0 Tower by Tower calib module in various situations: + +macros for running tower slope method on MDC2 files +FOR using various decalibration/calibration updates to the sim and reco frameworks in coresoftware, see towerslope macros directories + +Macro/script for running over MDC2 Hits files with embedding (Production 62 currently) +------------------------------------------- + +Fun4All_pi0tbt_SIMPLE_EMBED.C + +Notes: does not need filelist input (e.g. from CreateFileList.pl), see comments inside, takes single +integer input, assuming filenames of Production 62 MDC2 Hits files. For other production +runs beginning of macro/filename parsing part my need up dated. Note that per usual MDC2 +and presumably all sphenix default production/sim file access, only the filename is specified +and lustre system/dcache finds the file and decides/provides appropriate "full path" access method. +Valid filenames can be obtained from CreateFileLists.pl + + +Macros for doing the actual fitting steps and iterations +---------------------- + +runLCELoop.C + +this runs the TbT iterations, the first (or zeroth) iteration if used is run during initial +the fun4all running that also creates the reduced cluster ntuple which this runLCELoop macro +operates on. Reads in output of previous iterations correction Values applies them, makes +new set (the current iteration's) of tower by tower mass histograms. + + +save_corr*.C macros + +reads in the mass histograms file, fits the mass distributions, extracts correction values and +produces new file of those. Usually takes as input the ouput of the runLCELoop except possibly +for the first (or "zeroth") iteration. + + + + diff --git a/calibrations/calo/emc_pi0_tbt/newtestscript.csh b/calibrations/calo/emc_pi0_tbt/newtestscript.csh new file mode 100755 index 000000000..1d03722fe --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/newtestscript.csh @@ -0,0 +1,34 @@ +#!/bin/csh +echo ' ' +echo 'START: '`date` + +source /etc/csh.login +foreach i (/etc/profile.d/*.csh) + source $i +end + + +echo hi Shyam doing job num $1 + +source /opt/sphenix/core/bin/sphenix_setup.csh -n new + +source /opt/sphenix/core/bin/setup_local.csh /sphenix/user/schauhan1/install/jan23install + + +cd /gpfs/mnt/gpfs02/sphenix/user/schauhan1/jan23_pi0/macro + + root.exe -b < +void runLCELoop(int nevents = -1, const char *ifile="treetest_g4cemc_eval.root", const char *ofile="treetest1_g4cemc_eval.root") +{ + gSystem->Load("libcalibCaloEmc_pi0.so"); + CaloCalibEmc_Pi0 obj_LCE("CaloCalibEmc_Pi0", ofile); + obj_LCE.InitRun(0); + obj_LCE.Loop(ifile, nevents); + obj_LCE.End(0); + obj_LCE.FittingHistos(); +} diff --git a/calibrations/calo/emc_pi0_tbt/save_corr_val_add96.C b/calibrations/calo/emc_pi0_tbt/save_corr_val_add96.C new file mode 100644 index 000000000..c853faec1 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/save_corr_val_add96.C @@ -0,0 +1,16 @@ +#include + +void save_correc_value(const char* ifile = "", const char* ofile = "",const char * infilent = "") +{ + R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + CaloCalibEmc_Pi0 calo_obj("CaloCalibEmc_Pi0", ofile ); + + calo_obj.Get_Histos(ifile,ofile); + + calo_obj.Add_96(); + + calo_obj.Fit_Histos_Eta_Phi_Add96(infilent); + + calo_obj.End(0); +} diff --git a/calibrations/calo/emc_pi0_tbt/save_corr_value2.C b/calibrations/calo/emc_pi0_tbt/save_corr_value2.C new file mode 100644 index 000000000..2705a25f1 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/save_corr_value2.C @@ -0,0 +1,14 @@ +#include + +void save_corr_value2(const char* ifile = "", const char* ofile = "",const char * infilent = "") +{ + R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + CaloCalibEmc_Pi0 calo_obj("CaloCalibEmc_Pi0" /* this name goes to SubsysReco */, ofile ); + // calo_obj.InitRun(0); // to declare the eta_hist[96] + calo_obj.Get_Histos(ifile,ofile); // open the fun4al file and Get eta_hist[96] histos + //calo_obj.Add_96(); + calo_obj.Add_32(); + calo_obj.Fit_Histos_Eta_Phi(infilent); // do the fittings + calo_obj.End(0); // save the output file +} diff --git a/calibrations/calo/emc_pi0_tbt/save_correc_value.C b/calibrations/calo/emc_pi0_tbt/save_correc_value.C new file mode 100644 index 000000000..4b2486543 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/save_correc_value.C @@ -0,0 +1,12 @@ +#include + +void save_correc_value(const char* ifile = "", const char* ofile = "",const char * infilent = "") +{ + R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + + CaloCalibEmc_Pi0 calo_obj("CaloCalibEmc_Pi0" /* this name goes to SubsysReco */, ofile ); + // calo_obj.InitRun(0); // to declare the eta_hist[96] + calo_obj.Get_Histos(ifile,ofile); // open the fun4al file and Get eta_hist[96] histos + calo_obj.Fit_Histos(infilent); // do the fittings + calo_obj.End(0); // save the output file +} diff --git a/calibrations/calo/emc_pi0_tbt/towInfoClustering/G4_CEmc_Spacal.C b/calibrations/calo/emc_pi0_tbt/towInfoClustering/G4_CEmc_Spacal.C new file mode 100644 index 000000000..423ab415b --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/towInfoClustering/G4_CEmc_Spacal.C @@ -0,0 +1,414 @@ +#ifndef MACRO_G4CEMCSPACAL_C +#define MACRO_G4CEMCSPACAL_C + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool CEMC = false; + bool CEMC_ABSORBER = false; + bool CEMC_OVERLAPCHECK = false; + bool CEMC_CELL = false; + bool CEMC_TOWER = false; + bool CEMC_CLUSTER = false; + bool CEMC_EVAL = false; + bool CEMC_QA = false; + int CEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4CEMC +{ + int Min_cemc_layer = 1; + int Max_cemc_layer = 1; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // directly pass the energy of sim tower to digitized tower + // kNo_digitization + // simple digitization with photon statistics, single amplitude ADC conversion and pedestal + // kSimple_photon_digitization + // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal + // kSiPM_photon_digitization + + // 2D azimuthal projective SPACAL (slow) + int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; + + enum enu_Cemc_clusterizer + { + kCemcGraphClusterizer, + + kCemcTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; + +} // namespace G4CEMC + +// black hole parameters are set in CEmc function +// needs a dummy argument to play with current G4Setup_sPHENIX.C +void CEmcInit(const int i = 0) +{ +} + +//! EMCal main setup macro +double +CEmc(PHG4Reco *g4Reco, double radius, const int crossings) +{ + return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); +} + +//! 2D full projective SPACAL +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + + double emc_inner_radius = 92; // emc inner radius from engineering drawing + double cemcthickness = 22.50000 - no_overlapp; + + //max radius is 116 cm; + double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius + assert(emc_outer_radius < 116); + + if (radius > emc_inner_radius) + { + cout << "inconsistency: preshower radius+thickness: " << radius + << " larger than emc inner radius: " << emc_inner_radius << endl; + gSystem->Exit(-1); + } + + // the radii are only to determined the thickness of the cemc + radius = emc_inner_radius; + + // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", 1.5 - no_overlapp); + cyl->SuperDetector("CEMC_ELECTRONICS"); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius += 1.5; + cemcthickness -= 1.5 + no_overlapp; + + // 0.5cm thick Stainless Steel as an approximation for EMCAl support system + cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); + cyl->SuperDetector("CEMC_SPT"); + cyl->set_double_param("radius", radius + cemcthickness - 0.5); + cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel + cyl->set_double_param("thickness", 0.5 - no_overlapp); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + // this is the z extend and outer radius of the support structure and therefore the z extend + // and radius of the surrounding black holes + double sptlen = PHG4Utils::GetLengthForRapidityCoverage(radius + cemcthickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, sptlen); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -sptlen); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + cemcthickness); + + cemcthickness -= 0.5 + no_overlapp; + + int ilayer = 0; + PHG4SpacalSubsystem *cemc; + + cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + + cemc->set_int_param("virualize_fiber", 0); + cemc->set_int_param("azimuthal_seg_visible", 1); + cemc->set_int_param("construction_verbose", 0); + cemc->Verbosity(0); + if (Enable::XPLOAD) + { + cemc->UseCDB("CEMC_GEOMETRY"); + } + else + { + cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); + cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2023ProjTilted/")); + } + cemc->set_double_param("radius", radius); // overwrite minimal radius + cemc->set_double_param("thickness", cemcthickness); // overwrite thickness + + cemc->SetActive(); + cemc->SuperDetector("CEMC"); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + if (ilayer > G4CEMC::Max_cemc_layer) + { + cout << "layer discrepancy, current layer " << ilayer + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; + } + + radius += cemcthickness; + radius += no_overlapp; + + return radius; +} + +void CEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + for (int i = G4CEMC::Min_cemc_layer; i <= G4CEMC::Max_cemc_layer; i++) + { + // cemc_cells->etaphisize(i, 0.024, 0.024); + const double radius = 95; + cemc_cells->cellsize(i, 2 * M_PI / 256. * radius, 2 * M_PI / 256. * radius); + } + se->registerSubsystem(cemc_cells); + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + cemc_cells->get_light_collection_model().load_data_file( + string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype3Module.xml"), + "data_grid_light_guide_efficiency", "data_grid_fiber_trans"); + se->registerSubsystem(cemc_cells); + } + else + { + cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + + return; +} + +void CEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); + TowerBuilder->Detector("CEMC"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + double sampling_fraction = 1; + // sampling_fraction = 0.02244; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 2.36081e-02; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 1.90951e-02; // 2017 Tilt porjective SPACAL, 8 GeV photon, eta = 0.3 - 0.4 + sampling_fraction = 2e-02; // 2017 Tilt porjective SPACAL, tower-by-tower calibration + const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition + + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + TowerDigitizer->Detector("CEMC"); + TowerDigitizer->Verbosity(verbosity); + TowerDigitizer->set_digi_algorithm(G4CEMC::TowerDigi); + TowerDigitizer->set_variable_pedestal(true); //read ped central and width from calibrations file comment next 2 lines if true + // TowerDigitizer->set_pedstal_central_ADC(0); + // TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + TowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error + TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); + TowerDigitizer->set_variable_zero_suppression(true); //read zs values from calibrations file comment next line if true + // TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + if (Enable::XPLOAD) + { + TowerDigitizer->GetParameters().ReadFromCDB("EMCTOWERCALIB"); + } + else + { + TowerDigitizer->GetParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + } + se->registerSubsystem(TowerDigitizer); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + TowerCalibration->Detector("CEMC"); + TowerCalibration->Verbosity(verbosity); + + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // just use sampling fraction set previously + TowerCalibration->set_calib_const_GeV_ADC(1.0 / sampling_fraction); + } + else + { + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kTower_by_tower_calibration); + if (Enable::XPLOAD) + { + TowerCalibration->GetCalibrationParameters().ReadFromCDB("EMCTOWERCALIB"); + } + else + { + TowerCalibration->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + } + TowerCalibration->set_variable_GeV_ADC(true); //read GeV per ADC from calibrations file comment next line if true + // TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_variable_pedestal(true); //read pedestals from calibrations file comment next line if true + // TowerCalibration->set_pedstal_ADC(0); + } + se->registerSubsystem(TowerCalibration); + + return; +} + +void CEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + // ClusterBuilder->set_UseTowerInfo(0); + se->registerSubsystem(ClusterBuilder); + + RawClusterBuilderTemplate *ClusterBuilder2 = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2"); + ClusterBuilder2->Detector("CEMC"); + ClusterBuilder2->Verbosity(verbosity); + ClusterBuilder2->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof2 = getenv("CALIBRATIONROOT"); + emc_prof2 += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder2->LoadProfile(emc_prof2); + ClusterBuilder2->set_UseTowerInfo(1); + se->registerSubsystem(ClusterBuilder2); + + } + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "CEMC_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + if (Enable::XPLOAD) + { + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromCDB("CEMCRECALIB"); + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromCDB("CEMC_ECORE_RECALIB"); + } + else + { + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + } + + clusterCorrection->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection); + + + RawClusterPositionCorrection *clusterCorrection2 = new RawClusterPositionCorrection("CEMC"); + + clusterCorrection2->set_UseTowerInfo(1); + if (Enable::XPLOAD) + { + clusterCorrection2->Get_eclus_CalibrationParameters().ReadFromCDB("CEMCRECALIB"); + clusterCorrection2->Get_ecore_CalibrationParameters().ReadFromCDB("CEMC_ECORE_RECALIB"); + } + else + { + clusterCorrection2->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + clusterCorrection2->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + } + + clusterCorrection2->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection2); + + + return; +} +void CEMC_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void CEMC_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("CEMC"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/calibrations/calo/emc_pi0_tbt/towInfoClustering/README.md b/calibrations/calo/emc_pi0_tbt/towInfoClustering/README.md new file mode 100644 index 000000000..89211cc86 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/towInfoClustering/README.md @@ -0,0 +1,15 @@ +Example macros for running default clustering builder in mode which reads new towerinfo data structures rather than the old/original RawTower sim data structures. + +NOTE: associated core software commit notes influencing content of these macros : pull request 2/21/23: adds capability to use towerfinfo new tower data structs in default Template emcal cluster builder, cluster position correction tool, and also in calibration pi0 TbT code [which then uses the new cluster version] although the cluster data structures didn't change, the links to the towers they hold in the version using towinfo are implied to be tower info objects rather than raw tower]. In all three cases, turn on with set_UseTowerInfo flag-- unlike some other of Tim's commits, this flag can only be used in modes 0 (don't use tower info) and 1 (use tower info) not in Tim's mode 2 (do both simultaneously). Corresponding example macros to use this can be found in macros/calibrations/calo/emc_pi0_tbt/towInfoClustering/ + + +G4_Cemc_Spacal.C : The usual, with extra ClusterBuilderTemplate and ClusterPosCorr which process the towinfo as described above producing additional nodes CLUSTERINFO_XXX in addition to old/orig CLUSTER_XXX nodes + +spiNo2.C : Fun4all run macro that starts from mdc2 run 62 hits files (currently pi0 embed is default but there is also lines that can be uncommented for regular minbias run62. Assumes use of above G4_Cemc_Spacal.C macro [e.g. by placing in the same directory] Also runs both versions of Pi0 Calo TbT module. + +rundst_spiNo.C : similar to previous spiNo2 except only outputs dst with both tower/toweinfo copies [all ~6 nodes, SIM/RAW/CALIB] but NOT any clustering nodes. So clustering tests can be broken up into faster 2nd part testing only the clustering without needing all hits baggage. + +srundst_mdc2_clustest.C: runs on previous macro dst output, much simpler/faster libraries needed, contains RawClusBuild, etc. subsys recos and CAlib pi0 TbT modules as faster 2nd part, so testing only the clustering without needing all hits baggage + + + diff --git a/calibrations/calo/emc_pi0_tbt/towInfoClustering/rundst_spiNo.C b/calibrations/calo/emc_pi0_tbt/towInfoClustering/rundst_spiNo.C new file mode 100644 index 000000000..60cd3eb97 --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/towInfoClustering/rundst_spiNo.C @@ -0,0 +1,483 @@ +#ifndef MACRO_FUN4ALLG4CALO_C +#define MACRO_FUN4ALLG4CALO_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//#include + + +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcaloCalibDBFile.so) +//R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + + +// For HepMC Hijing +// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat + +int rundst_spiNo( + const int nEvents = 5, + // const string &inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + //const string &inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + const int mdc2_4_file_num = 20, + const string &outputFile = "dstnewoutput5_calo5", + // const string &inputFile0 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_CALO_G4HIT_sHijing_0_12fm-0000000001-00000.root", + // const string &inputFile1 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_VERTEX_sHijing_0_12fm-0000000001-00000.root", + // const string &outputFile = "G4sPHENIX_calo1", + const string &outdir = ".") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + + // string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + // string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + + // string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + //string inputFile0 = "DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-00000.root"; + // string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + string inputFile0 = "DST_CALO_G4HIT_single_pi0_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + string inputFile1 = "DST_VERTEX_single_pi0_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + + int ynum_int = 100000+ mdc2_4_file_num; + TString yn_tstr = ""; + yn_tstr += ynum_int; + yn_tstr.Remove(0,1); + inputFile0 += yn_tstr.Data(); + inputFile1 += yn_tstr.Data(); + + inputFile0 += ".root"; + inputFile1 += ".root"; + + cout << "running over these files" << endl; + cout << inputFile0 << endl; + cout << inputFile1 << endl; + + //const string &outputFile = "newoutput1_calo1", + + + //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. + PHRandomSeed::Verbosity(1); + /* + long mtime = gSystem->Now(); + TString fileOut = outputFile.c_str(); + fileOut += (mtime / 100000 - 8542922)/3; + string outputFile2 = fileOut.Data(); + */ + string outputFile2 = outputFile.c_str(); + outputFile2 = outputFile2 + ".root"; + + // just if we set some flags somewhere in this macro + recoConsts *rc = recoConsts::instance(); + // By default every random number generator uses + // PHRandomSeed() which reads /dev/urandom to get its seed + // if the RANDOMSEED flag is set its value is taken as seed + // You can either set this to a random value using PHRandomSeed() + // which will make all seeds identical (not sure what the point of + // this would be: + // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); + // or set it to a fixed value so you can debug your code + // rc->set_IntFlag("RANDOMSEED", 12345); + + //=============== + // Input options + //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 1; + // First enable the input generators + // Either: + // read previously generated g4-hits files, in this case it opens a DST and skips + // the simulations step completely. The G4Setup macro is only loaded to get information + // about the number of layers used for the cell reco code + Input::READHITS = true; + INPUTREADHITS::filename[0] = inputFile0; + INPUTREADHITS::filename[1] = inputFile1; + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + // This creates the input generator(s) + InputInit(); + + // register all input generators with Fun4All + InputRegister(); + + // set up production relatedstuff + Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + Enable::DSTOUT = true; + Enable::DSTOUT_COMPRESS = false; + DstOut::OutputDir = outdir; + //DstOut::OutputFile = outputFile; + DstOut::OutputFile = outputFile2; + + + //Option to convert DST to human command readable TTree for quick poke around the outputs + // Enable::DSTREADER = true; + + // turn the display on (default off) + Enable::DISPLAY = false; + + //====================== + // What to run + //====================== + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + Enable::CEMC = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; + // Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; +// Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; + + Enable::HCALIN = true; + Enable::HCALIN_CELL = Enable::HCALIN && true; + Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; + // Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true; +// Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; + + Enable::HCALOUT = true; + Enable::HCALOUT_CELL = Enable::HCALOUT && true; + Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; + // Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true; +// Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; + + +// Enable::EPD = false; + +// Enable::GLOBAL_RECO = true; + // Enable::GLOBAL_FASTSIM = true; + +// Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + +// Enable::JETS = true; +// Enable::JETS_EVAL = Enable::JETS && true; + + // HI Jet Reco for p+Au / Au+Au collisions (default is false for + // single particle / p+p-only simulations, or for p+Au / Au+Au + // simulations which don't particularly care about jets) +// Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + + // 3-D topoCluster reconstruction, potentially in all calorimeter layers +// Enable::TOPOCLUSTER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + // particle flow jet reconstruction - needs topoClusters! +// Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; + + //--------------- + // Magnet Settings + //--------------- + + // const string magfield = "1.5"; // alternatively to specify a constant magnetic field, give a float number, which will be translated to solenoidal field in T, if string use as fieldmap name (including path) + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database +// G4MAGNET::magfield_rescale = 1; // make consistent with expected Babar field strength of 1.4T + + //--------------- + // Pythia Decayer + //--------------- + // list of decay types in + // $OFFLINE_MAIN/include/g4decayer/EDecayType.hh + // default is All: + // G4P6DECAYER::decayType = EDecayType::kAll; + + // Initialize the selected subsystems + G4Init(); + + //--------------------- + // GEANT4 Detector description + //--------------------- + if (!Input::READHITS) + { + G4Setup(); + } + + //------------------ + // Detector Division + //------------------ + + if (Enable::MBD || Enable::MBDFAKE) Mbd_Reco(); + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + if (Enable::MICROMEGAS_CELL) Micromegas_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + //----------------------------- + // CEMC towering and clustering + //----------------------------- + + if (Enable::CEMC_TOWER) CEMC_Towers(); + // if (Enable::CEMC_CLUSTER) CEMC_Clusters(); + + //----------------------------- + // HCAL towering and clustering + //----------------------------- + + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); + + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); + + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (Enable::TOPOCLUSTER) TopoClusterReco(); + + if (Enable::DSTOUT_COMPRESS) ShowerCompress(); + + //-------------- + // SVTX tracking + //-------------- + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) TPC_Clustering(); + if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering(); + + if (Enable::TRACKING_TRACK) + { + TrackingInit(); + Tracking_Reco(); + } + //----------------- + // Global Vertexing + //----------------- + + if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM) + { + cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl; + gSystem->Exit(1); + } + if (Enable::GLOBAL_RECO) + { + Global_Reco(); + } + else if (Enable::GLOBAL_FASTSIM) + { + Global_FastSim(); + } + + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + + //--------- + // Jet reco + //--------- + + if (Enable::JETS) Jet_Reco(); + if (Enable::HIJETS) HIJetReco(); + + if (Enable::PARTICLEFLOW) ParticleFlow(); + + //---------------------- + // Simulation evaluation + //---------------------- + string outputroot = outputFile; + string remove_this = ".root"; + size_t pos = outputroot.find(remove_this); + if (pos != string::npos) + { + outputroot.erase(pos, remove_this.length()); + } + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + out->AddNode("Sync"); + out->AddNode("EventHeader"); + out->AddNode("TOWER_SIM_HCALIN"); + out->AddNode("TOWER_RAW_HCALIN"); + out->AddNode("TOWER_CALIB_HCALIN"); + out->AddNode("CLUSTER_HCALIN"); + out->AddNode("TOWER_SIM_HCALOUT"); + out->AddNode("TOWER_RAW_HCALOUT"); + out->AddNode("TOWER_CALIB_HCALOUT"); + out->AddNode("CLUSTER_HCALOUT"); + out->AddNode("TOWER_SIM_CEMC"); + out->AddNode("TOWER_RAW_CEMC"); + out->AddNode("TOWER_CALIB_CEMC"); + out->AddNode("TOWERINFO_SIM_CEMC"); + out->AddNode("TOWERINFO_RAW_CEMC"); + out->AddNode("TOWERINFO_CALIB_CEMC"); + // out->AddNode("CLUSTER_CEMC"); + //out->AddNode("CLUSTER_POS_COR_CEMC"); +// leave the topo cluster here in case we run this during pass3 + //out->AddNode("TOPOCLUSTER_ALLCALO"); + //out->AddNode("TOPOCLUSTER_EMCAL"); + //out->AddNode("TOPOCLUSTER_HCAL"); + out->AddNode("GlobalVertexMap"); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + if (Enable::DISPLAY) + { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout << "-------------------------------------------------" << endl; + cout << "You are in event display mode. Run one event with" << endl; + cout << "se->run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; + gROOT->ProcessLine("displaycmd()"); + + return 0; + } + + string outputfile = outputFile2 + "_ho4ho_eval.root"; + string outputfile2 = outputFile2 + "_piemc.root"; + string outputfile3 = outputFile2 + "_towslopemc.root"; + string outputfile4 = outputFile2 + "_hcalin.root"; + string outputfile5 = outputFile2 + "_hcalin_mod.root"; + string outputfile6 = outputFile2 + "_emcal.root"; + + + LiteCaloEval *eval3a = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile3.c_str()); + // LiteCaloEval *eval3a = new LiteCaloEval("HOCEMCEVALUATOR", "HCALOUT", outputfile3.c_str()); + // eval->Verbosity(verbosity); + eval3a->CaloType(LiteCaloEval::CEMC); + //eval3a->CaloType(LiteCaloEval::HCALOUT); + //eval3a->set_mode(1); + se->registerSubsystem(eval3a); + + /* + // LiteCaloEval *eval = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile.c_str()); + LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + // eval->CaloType(LiteCaloEval::CEMC); + eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval); + + LiteCaloEval *eval7 = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile6.c_str()); + // LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval7->CaloType(LiteCaloEval::CEMC); + //eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval7); + + + */ + /* + CaloCalibEmc_Pi0 *eval_pi1 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI0", outputfile2); + // eval_pi1->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi1); + */ + + + /* + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI02", outputfile2); + // eval_pi2->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi2); + cout << "successful registration of pi0 " << endl; + */ + + /* + LiteCaloEval *eval3 = new LiteCaloEval("HcalIn_towslope", "HCALIN", outputfile4.c_str()); + // eval->Verbosity(verbosity); + eval3->CaloType(LiteCaloEval::HCALIN); + se->registerSubsystem(eval3); + + LiteCaloEval *eval4 = new LiteCaloEval("HIN_towslope2", "HCALIN", outputfile5.c_str()); + // eval->Verbosity(verbosity); + eval4->CaloType(LiteCaloEval::HCALIN); + eval4->set_mode(1); + se->registerSubsystem(eval4); + + */ + + // if we use a negative number of events we go back to the command line here + if (nEvents < 0) + { + return 0; + } + // if we run the particle generator and use 0 it'll run forever + if (nEvents == 0 && !Input::HEPMC && !Input::READHITS) + { + cout << "using 0 for number of events is a bad idea when using particle generators" << endl; + cout << "it will run forever, so I just return without running anything" << endl; + return 0; + } + + se->run(nEvents); + + //----- + // Exit + //----- + + se->End(); + // se->PrintTimer(); + //se->PrintMemoryTracker(); + std::cout << "All done" << std::endl; + gSystem->Exit(0); + delete se; + /* + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + */ + + return 0; +} +#endif diff --git a/calibrations/calo/emc_pi0_tbt/towInfoClustering/spiNo2.C b/calibrations/calo/emc_pi0_tbt/towInfoClustering/spiNo2.C new file mode 100644 index 000000000..8c4df130a --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/towInfoClustering/spiNo2.C @@ -0,0 +1,477 @@ +#ifndef MACRO_FUN4ALLG4CALO_C +#define MACRO_FUN4ALLG4CALO_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +//#include + + +#include +#include + +//#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcaloCalibDBFile.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) +//R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + + +// For HepMC Hijing +// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat + +int spiNo2( + const int nEvents = 600, + const string &outputFile = "oldoutput2", + // const string &inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + //const string &inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + const int mdc2_4_file_num = 31, + // const string &inputFile0 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_CALO_G4HIT_sHijing_0_12fm-0000000001-00000.root", + // const string &inputFile1 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_VERTEX_sHijing_0_12fm-0000000001-00000.root", + // const string &outputFile = "G4sPHENIX_calo1", + const string &outdir = ".") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + + // string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + // string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + + // string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + //string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + string inputFile0 = "DST_CALO_G4HIT_single_pi0_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + string inputFile1 = "DST_VERTEX_single_pi0_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + + + int ynum_int = 100000+ mdc2_4_file_num; + TString yn_tstr = ""; + yn_tstr += ynum_int; + yn_tstr.Remove(0,1); + inputFile0 += yn_tstr.Data(); + inputFile1 += yn_tstr.Data(); + + inputFile0 += ".root"; + inputFile1 += ".root"; + + cout << "running over these files" << endl; + cout << inputFile0 << endl; + cout << inputFile1 << endl; + + //const string &outputFile = "newoutput1_calo1", + + + //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. + PHRandomSeed::Verbosity(1); + /* + long mtime = gSystem->Now(); + TString fileOut = outputFile.c_str(); + fileOut += (mtime / 100000 - 8542922)/3; + string outputFile2 = fileOut.Data(); + */ + string outputFile2 = outputFile.c_str(); + outputFile2 = outputFile2 + ".root"; + + // just if we set some flags somewhere in this macro + recoConsts *rc = recoConsts::instance(); + // By default every random number generator uses + // PHRandomSeed() which reads /dev/urandom to get its seed + // if the RANDOMSEED flag is set its value is taken as seed + // You can either set this to a random value using PHRandomSeed() + // which will make all seeds identical (not sure what the point of + // this would be: + // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); + // or set it to a fixed value so you can debug your code + // rc->set_IntFlag("RANDOMSEED", 12345); + + //=============== + // Input options + //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 1; + // First enable the input generators + // Either: + // read previously generated g4-hits files, in this case it opens a DST and skips + // the simulations step completely. The G4Setup macro is only loaded to get information + // about the number of layers used for the cell reco code + Input::READHITS = true; + INPUTREADHITS::filename[0] = inputFile0; + INPUTREADHITS::filename[1] = inputFile1; + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + // This creates the input generator(s) + InputInit(); + + // register all input generators with Fun4All + InputRegister(); + + // set up production relatedstuff + Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + Enable::DSTOUT = false; + Enable::DSTOUT_COMPRESS = false; + DstOut::OutputDir = outdir; +// DstOut::OutputFile = outputFile; + DstOut::OutputFile = outputFile2; + + + //Option to convert DST to human command readable TTree for quick poke around the outputs + // Enable::DSTREADER = true; + + // turn the display on (default off) + Enable::DISPLAY = false; + + //====================== + // What to run + //====================== + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + Enable::CEMC = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; + Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; +// Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; + + Enable::HCALIN = true; + Enable::HCALIN_CELL = Enable::HCALIN && true; + Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; + // Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true; +// Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; + + Enable::HCALOUT = true; + Enable::HCALOUT_CELL = Enable::HCALOUT && true; + Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; + // Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true; +// Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; + + +// Enable::EPD = false; + +// Enable::GLOBAL_RECO = true; + // Enable::GLOBAL_FASTSIM = true; + +// Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + +// Enable::JETS = true; +// Enable::JETS_EVAL = Enable::JETS && true; + + // HI Jet Reco for p+Au / Au+Au collisions (default is false for + // single particle / p+p-only simulations, or for p+Au / Au+Au + // simulations which don't particularly care about jets) +// Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + + // 3-D topoCluster reconstruction, potentially in all calorimeter layers +// Enable::TOPOCLUSTER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + // particle flow jet reconstruction - needs topoClusters! +// Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; + + //--------------- + // Magnet Settings + //--------------- + + // const string magfield = "1.5"; // alternatively to specify a constant magnetic field, give a float number, which will be translated to solenoidal field in T, if string use as fieldmap name (including path) + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database +// G4MAGNET::magfield_rescale = 1; // make consistent with expected Babar field strength of 1.4T + + //--------------- + // Pythia Decayer + //--------------- + // list of decay types in + // $OFFLINE_MAIN/include/g4decayer/EDecayType.hh + // default is All: + // G4P6DECAYER::decayType = EDecayType::kAll; + + // Initialize the selected subsystems + G4Init(); + + //--------------------- + // GEANT4 Detector description + //--------------------- + if (!Input::READHITS) + { + G4Setup(); + } + + //------------------ + // Detector Division + //------------------ + + if (Enable::MBD || Enable::MBDFAKE) Mbd_Reco(); + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + if (Enable::MICROMEGAS_CELL) Micromegas_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + //----------------------------- + // CEMC towering and clustering + //----------------------------- + + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); + + //----------------------------- + // HCAL towering and clustering + //----------------------------- + + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); + + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); + + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (Enable::TOPOCLUSTER) TopoClusterReco(); + + if (Enable::DSTOUT_COMPRESS) ShowerCompress(); + + //-------------- + // SVTX tracking + //-------------- + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) TPC_Clustering(); + if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering(); + + if (Enable::TRACKING_TRACK) + { + TrackingInit(); + Tracking_Reco(); + } + //----------------- + // Global Vertexing + //----------------- + + if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM) + { + cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl; + gSystem->Exit(1); + } + if (Enable::GLOBAL_RECO) + { + Global_Reco(); + } + else if (Enable::GLOBAL_FASTSIM) + { + Global_FastSim(); + } + + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + + //--------- + // Jet reco + //--------- + + if (Enable::JETS) Jet_Reco(); + if (Enable::HIJETS) HIJetReco(); + + if (Enable::PARTICLEFLOW) ParticleFlow(); + + //---------------------- + // Simulation evaluation + //---------------------- + string outputroot = outputFile; + string remove_this = ".root"; + size_t pos = outputroot.find(remove_this); + if (pos != string::npos) + { + outputroot.erase(pos, remove_this.length()); + } + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + out->AddNode("Sync"); + out->AddNode("EventHeader"); + out->AddNode("TOWER_SIM_HCALIN"); + out->AddNode("TOWER_RAW_HCALIN"); + out->AddNode("TOWER_CALIB_HCALIN"); + out->AddNode("CLUSTER_HCALIN"); + out->AddNode("TOWER_SIM_HCALOUT"); + out->AddNode("TOWER_RAW_HCALOUT"); + out->AddNode("TOWER_CALIB_HCALOUT"); + out->AddNode("CLUSTER_HCALOUT"); + out->AddNode("TOWER_SIM_CEMC"); + out->AddNode("TOWER_RAW_CEMC"); + out->AddNode("TOWER_CALIB_CEMC"); + out->AddNode("CLUSTER_CEMC"); + out->AddNode("CLUSTER_POS_COR_CEMC"); +// leave the topo cluster here in case we run this during pass3 + out->AddNode("TOPOCLUSTER_ALLCALO"); + out->AddNode("TOPOCLUSTER_EMCAL"); + out->AddNode("TOPOCLUSTER_HCAL"); + out->AddNode("GlobalVertexMap"); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + if (Enable::DISPLAY) + { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout << "-------------------------------------------------" << endl; + cout << "You are in event display mode. Run one event with" << endl; + cout << "se->run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; + gROOT->ProcessLine("displaycmd()"); + + return 0; + } + + string outputfile = outputFile2 + "_ho4ho_eval.root"; + string outputfile2 = outputFile2 + "_piemc.root"; + string outputfile3 = outputFile2 + "_towinfo_pi.root"; + string outputfile4 = outputFile2 + "_hcalin.root"; + string outputfile5 = outputFile2 + "_hcalin_mod.root"; + string outputfile6 = outputFile2 + "_emcal.root"; + + + /* + // LiteCaloEval *eval3a = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile3.c_str()); + LiteCaloEval *eval3a = new LiteCaloEval("HOCEMCEVALUATOR", "HCALOUT", outputfile3.c_str()); + // eval->Verbosity(verbosity); + // eval3a->CaloType(LiteCaloEval::CEMC); + eval3a->CaloType(LiteCaloEval::HCALOUT); + eval3a->set_mode(1); + se->registerSubsystem(eval3a); + + // LiteCaloEval *eval = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile.c_str()); + LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + // eval->CaloType(LiteCaloEval::CEMC); + eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval); + + LiteCaloEval *eval7 = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile6.c_str()); + // LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval7->CaloType(LiteCaloEval::CEMC); + //eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval7); + + + */ + + CaloCalibEmc_Pi0 *eval_pi1 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI0", outputfile2); + // eval_pi1->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi1); + + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI02", outputfile3); + // eval_pi2->set_mode(1); + // eval->Verbosity(verbosity); + eval_pi2->set_UseTowerInfo(1); + se->registerSubsystem(eval_pi2); + cout << "successful registration of pi0 2" << endl; + + /* + LiteCaloEval *eval3 = new LiteCaloEval("HcalIn_towslope", "HCALIN", outputfile4.c_str()); + // eval->Verbosity(verbosity); + eval3->CaloType(LiteCaloEval::HCALIN); + se->registerSubsystem(eval3); + + LiteCaloEval *eval4 = new LiteCaloEval("HIN_towslope2", "HCALIN", outputfile5.c_str()); + // eval->Verbosity(verbosity); + eval4->CaloType(LiteCaloEval::HCALIN); + eval4->set_mode(1); + se->registerSubsystem(eval4); + + */ + + // if we use a negative number of events we go back to the command line here + if (nEvents < 0) + { + return 0; + } + // if we run the particle generator and use 0 it'll run forever + if (nEvents == 0 && !Input::HEPMC && !Input::READHITS) + { + cout << "using 0 for number of events is a bad idea when using particle generators" << endl; + cout << "it will run forever, so I just return without running anything" << endl; + return 0; + } + + se->run(nEvents); + + //----- + // Exit + //----- + + se->End(); + // se->PrintTimer(); + //se->PrintMemoryTracker(); + std::cout << "All done" << std::endl; + gSystem->Exit(0); + delete se; + /* + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + */ + + return 0; +} +#endif diff --git a/calibrations/calo/emc_pi0_tbt/towInfoClustering/srundst_mdc2_clustest.C b/calibrations/calo/emc_pi0_tbt/towInfoClustering/srundst_mdc2_clustest.C new file mode 100644 index 000000000..e4af06cce --- /dev/null +++ b/calibrations/calo/emc_pi0_tbt/towInfoClustering/srundst_mdc2_clustest.C @@ -0,0 +1,193 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +//#include +#include +#include + +#include + +#include +#include +#include +#include + + +R__LOAD_LIBRARY(libfun4all.so) +//R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + + +#endif + +// void Fun4All_TowerBuilder(const char *fname = "/sphenix/data/data02/sphenix/cemc/combinedEvents/EmCalSEB01-000000222-0000_x.prdf", const char *outfile = "trees/0.root") +void srundst_mdc2_clustest( + const int nEvents = 5, + const string &outputFile = "secoutput4_raw", + const string &inputFile0 = "ongoing/dstnewoutput5_calo5.root" + //const string &inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + // const int mdc2_4_file_num = 1, + ) +{ + + // gSystem->Load("libg4dst"); + + Fun4AllServer *se = Fun4AllServer::instance(); + +/* + string inputFile0 = "DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-"; + + + int ynum_int = 100000+ mdc2_4_file_num; + TString yn_tstr = ""; + yn_tstr += ynum_int; + yn_tstr.Remove(0,1); + inputFile0 += yn_tstr.Data(); + inputFile1 += yn_tstr.Data(); + + inputFile0 += ".root"; + inputFile1 += ".root"; + + cout << "running over these files" << endl; + cout << inputFile0 << endl; + cout << inputFile1 << endl; +*/ + + // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile); + // ca->Detector("CEMC"); + // se->registerSubsystem(ca); + + // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in"); + // in->fileopen(fname); + +Fun4AllInputManager *in = new Fun4AllDstInputManager("in"); + +// in->fileopen(inputFile0.c_str()); +// in->fileopen(inputFile1.c_str()); + in->AddFile(inputFile0.c_str()); +//in->AddFile(inputFile1.c_str()); + + //CaloTowerBuilder *ca = new CaloTowerBuilder(); + // RawWaveformTowerBuilder *rw = new RawWaveformTowerBuilder(); + + // rw->set_detector_type(RawWaveformTowerBuilder::CEMC); + // se->registerSubsystem(rw); +///// + + + +//////// + // in->AddListFile("g4hits.list"); + + + +// Fun4All + se->registerInputManager(in); + + + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); +// ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + se->registerSubsystem(ClusterBuilder); + + + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + + +//clusterCorrection->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection); + + + + RawClusterBuilderTemplate *ClusterBuilder2 = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate2"); + ClusterBuilder2->Detector("CEMC"); + // ClusterBuilder2->Verbosity(verbosity); + ClusterBuilder2->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof2 = getenv("CALIBRATIONROOT"); + emc_prof2 += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder2->LoadProfile(emc_prof2); + ClusterBuilder2->set_UseTowerInfo(1); + se->registerSubsystem(ClusterBuilder2); + + RawClusterPositionCorrection *clusterCorrection2 = new RawClusterPositionCorrection("CEMC"); + + clusterCorrection2->set_UseTowerInfo(1); + if (false) + { + clusterCorrection2->Get_eclus_CalibrationParameters().ReadFromCDB("CEMCRECALIB"); + clusterCorrection2->Get_ecore_CalibrationParameters().ReadFromCDB("CEMC_ECORE_RECALIB"); + } + else + { + clusterCorrection2->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + clusterCorrection2->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + } + + // clusterCorrection2->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection2); + + + + string outputFile2 = outputFile.c_str(); + outputFile2 = outputFile2 + ".root"; + string outputfile5 = outputFile2 + "_cemc_eval5.root"; + string outputFile3 = outputFile2 + "_cemc_eval3.root"; + + + + LiteCaloEval *eval5 = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile5.c_str()); + // eval->Verbosity(verbosity); + eval5->CaloType(LiteCaloEval::CEMC); + se->registerSubsystem(eval5); + + + CaloCalibEmc_Pi0 *eval_pi1 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI0", outputFile2); + // eval_pi1->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi1); + + + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI02", outputFile3); + // eval_pi2->set_mode(1); + // eval->Verbosity(verbosity); + eval_pi2->set_UseTowerInfo(1); + se->registerSubsystem(eval_pi2); + cout << "successful registration of pi0 2" << endl; + + + + /* + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_simfile_ver2_5.root"); + + out->StripNode("WAVEFORMS_CEMC"); + se->registerOutputManager(out); + + */ + + se->run(nEvents); + se->End(); + se->PrintTimer(); + // gSystem->Exit(0); +} diff --git a/calibrations/calo/emcal_calib_year1/Fun4All_EMCal.C b/calibrations/calo/emcal_calib_year1/Fun4All_EMCal.C new file mode 100644 index 000000000..fad5f4435 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/Fun4All_EMCal.C @@ -0,0 +1,183 @@ +#ifndef FUN4ALL_EMCAL_C +#define FUN4ALL_EMCAL_C + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include // for CDBTTree +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libcdbobjects) +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libffamodules.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + +void createLocalEMCalCalibFile(const string fname, int runNumber); + + + + +void Fun4All_EMCal(int nevents = 0, const std::string &fname = "inputdata.txt",int iter = 2, const std::string &calib_fname="local_calib_copy.root") +{ + bool enableMasking = 0; + + bool doFit = 0; + bool doHistMake = 1; + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + // se->Verbosity(verbosity); + recoConsts *rc = recoConsts::instance(); + + ifstream file(fname); + string first_file; + getline(file, first_file); + + //=============== + // conditions DB flags + //=============== + pair runseg = Fun4AllUtils::GetRunSegment(first_file); + int runnumber = runseg.first; + cout << "run number = " << runnumber << endl; + + // global tag + rc->set_StringFlag("CDB_GLOBALTAG", "MDC2"); + // // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP", runnumber); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_TOWERS"); + in->AddListFile(fname); + se->registerInputManager(in); + + std::string filename = first_file.substr(first_file.find_last_of("/\\") + 1); + std::string OutFile = Form("OUTHIST_iter%d_%s",iter , filename.c_str()); + + + if (iter == 0) + { + createLocalEMCalCalibFile(calib_fname.c_str(), runnumber); + cout << "creating " << calib_fname.c_str() << " and exiting" << endl; + gSystem->Exit(0); + } + + //////////////////// + // Calibrate towers + + std::cout << "Calibrating EMCal" << std::endl; + CaloTowerCalib *calibEMC = new CaloTowerCalib("CEMCCALIB"); + calibEMC->set_detector_type(CaloTowerDefs::CEMC); + calibEMC->set_directURL(calib_fname.c_str()); + se->registerSubsystem(calibEMC); + + + ////////////////// + // Clusters + std::cout << "Building clusters" << std::endl; + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->set_threshold_energy(0.20); // for when using basic calibration + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + ClusterBuilder->setOutputClusterNodeName("CLUSTERINFO_CEMC2"); + se->registerSubsystem(ClusterBuilder); + +/* + std::cout << "Applying Position Dependent Correction" << std::endl; + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + clusterCorrection->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(clusterCorrection); +*/ + + /////////////////// + // analysis modules + if (iter==1){ + LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",OutFile); + eval7e->CaloType(LiteCaloEval::CEMC); + eval7e->setInputTowerNodeName("TOWERINFO_CALIB_CEMC"); + se->registerSubsystem(eval7e); + } + + if (iter>1){ + pi0EtaByEta *ca = new pi0EtaByEta("calomodulename", OutFile); + ca->set_timing_cut_width(16); + ca->apply_vertex_cut(false); + ca->set_vertex_cut(20.); + se->registerSubsystem(ca); + } + + se->run(nevents); + se->End(); + se->PrintTimer(); + delete se; + + TFile* f_done_signal = new TFile("DONE.root","recreate"); + std::cout << "All done!" << std::endl; + gSystem->Exit(0); +} + + + + +void createLocalEMCalCalibFile(const string fname, int runNumber) +{ + string default_time_independent_calib = "cemc_pi0_twrSlope_v1_default"; + string m_calibName = "cemc_pi0_twrSlope_v1"; + + string calibdir = CDBInterface::instance()->getUrl(m_calibName); + string filePath; + + if (!calibdir.empty()) + { + filePath = calibdir; + // cdbttree = new CDBTTree(calibdir); + } + else + { + calibdir = CDBInterface::instance()->getUrl(default_time_independent_calib); + + if (calibdir.empty()) + { + std::cout << "No EMCal Calibration NOT even a default" << std::endl; + exit(1); + } + filePath = calibdir; + // cdbttree = new CDBTTree(calibdir); + std::cout << "No specific file for " << m_calibName << " found, using default calib " << default_time_independent_calib << std::endl; + } + + TFile *f_cdb = new TFile(filePath.c_str()); + f_cdb->Cp(fname.c_str()); + + std::cout << "created local Calib file for run " << runNumber << " named " << fname << std::endl; + + delete f_cdb; +} + +#endif diff --git a/calibrations/calo/emcal_calib_year1/base/CondorRun.sh b/calibrations/calo/emcal_calib_year1/base/CondorRun.sh new file mode 100644 index 000000000..30fd727db --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/base/CondorRun.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +source /sphenix/u/bseidlitz/setup.sh + +echo "------------------setting up environment--------------------" +export Cur_dir=$(pwd) +echo "running area:" ${Cur_dir} +echo "-------------------------running----------------------------" +cd ${Cur_dir} +ls +root '' > notes.log + + + +root -b "Fun4All_EMCal.C(0,\"inputdata.txt\",iteration,\"local_calib_copy.root\")" + +echo "JOB COMPLETE!" diff --git a/calibrations/calo/emcal_calib_year1/base/plot.C b/calibrations/calo/emcal_calib_year1/base/plot.C new file mode 100644 index 000000000..c5a07ee98 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/base/plot.C @@ -0,0 +1,130 @@ +#include "sPhenixStyle.C" + +void myText(Double_t x,Double_t y,Color_t color, const char *text, Double_t tsize=0.04) { + + TLatex l; l.SetTextAlign(12); l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextColor(color); + l.DrawLatex(x,y,text); +} + + + + +void plot(){ + +SetsPhenixStyle(); + +std::string file_path = "runList.txt"; + +std::ifstream file(file_path); + +std::vector run_numbers; +std::string line; +while (std::getline(file, line)) { + std::istringstream iss(line); + int run_number; + if (iss >> run_number) { + run_numbers.push_back(run_number); + } else { + std::cerr << "Warning: Invalid integer on line: " << line << std::endl; + } +} + +file.close(); + +if (run_numbers.empty()) { + std::cerr << "Error: No valid run numbers found in the file." << std::endl; + return 1; +} + +int first_run = run_numbers.front(); +int last_run = run_numbers.back(); + +string func_str = "[0]/[2]/2.5*exp(-0.5*((x-[1])/[2])^2) + [3] + [4]*x + [5]*x^2 + [6]*x^3"; + +TFile* fintsc = new TFile("tsc_fitout.root"); +TFile* finpi0 = new TFile("fitout_iter21.root"); + +TH2F* tsc_corr = (TH2F*) fintsc->Get("corrPat"); + +TCanvas* c1 = new TCanvas("c1","c1",600,600); +tsc_corr->Draw("COLZ"); +tsc_corr->SetXTitle("ieta"); +tsc_corr->SetYTitle("iphi"); + +gPad->SetRightMargin(0.15); + +myText(0.2,0.98,1,Form("%d-%d",first_run,last_run)); + +c1->SaveAs("plots/tsc_coef.pdf"); + + + +TH1F* h_peak_eta = (TH1F*) finpi0->Get("h_peak_eta"); +TH1F* h_sigma_eta = (TH1F*) finpi0->Get("h_sigma_eta"); +TH1F* h_p0_eta = (TH1F*) finpi0->Get("h_p0_eta"); +TH1F* h_p3_eta = (TH1F*) finpi0->Get("h_p3_eta"); +TH1F* h_p4_eta = (TH1F*) finpi0->Get("h_p4_eta"); +TH1F* h_p5_eta = (TH1F*) finpi0->Get("h_p5_eta"); +TH1F* h_p6_eta = (TH1F*) finpi0->Get("h_p6_eta"); + +TCanvas* c2 = new TCanvas("c2","c2",600,600); +h_peak_eta->Draw("ex0"); +h_peak_eta->SetXTitle("ieta"); +h_peak_eta->SetYTitle("#it{#pi}^{0} mass"); +myText(0.2,0.98,1,Form("%d-%d",first_run,last_run)); + +c2->SaveAs("plots/mass_eta.pdf"); + + +TCanvas* c3 = new TCanvas("c3","c3",600,600); +h_p0_eta->Draw("ex0"); +h_p0_eta->SetXTitle("ieta"); +h_p0_eta->SetYTitle("gauss scale fit parameter"); + +c3->SaveAs("plots/p0_eta.pdf"); + + +TCanvas* c4 = new TCanvas("c4","c4",600,600); +h_p3_eta->Draw("ex0"); +h_p3_eta->SetXTitle("ieta"); +h_p3_eta->SetYTitle("0th order pol fit parameter"); +myText(0.2,0.98,1,Form("%d-%d",first_run,last_run)); + +c4->SaveAs("plots/p3_eta.pdf"); + + +TCanvas* c5 = new TCanvas("c5","c5",600,600); +h_p4_eta->Draw("ex0"); +h_p4_eta->SetXTitle("ieta"); +h_p4_eta->SetYTitle("1st order pol fit parameter"); + +c5->SaveAs("plots/p4_eta.pdf"); + + +TCanvas* c6 = new TCanvas("c6","c6",600,600); +h_p5_eta->Draw("ex0"); +h_p5_eta->SetXTitle("ieta"); +h_p5_eta->SetYTitle("2nd order pol fit parameter"); + +c6->SaveAs("plots/p5_eta.pdf"); + + +TCanvas* c7 = new TCanvas("c7","c7",600,600); +h_p6_eta->Draw("ex0"); +h_p6_eta->SetXTitle("ieta"); +h_p6_eta->SetYTitle("3rd order pol fit parameter"); + +c7->SaveAs("plots/p6_eta.pdf"); + + +TCanvas* c8 = new TCanvas("c8","c8",600,600); +h_sigma_eta->Draw("ex0"); +h_sigma_eta->SetXTitle("ieta"); +h_sigma_eta->SetYTitle("gauss sigma fit parameter"); + +c8->SaveAs("plots/sigma_eta.pdf"); + + +} diff --git a/calibrations/calo/emcal_calib_year1/base/run.sh b/calibrations/calo/emcal_calib_year1/base/run.sh new file mode 100755 index 000000000..0c77cbcc5 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/base/run.sh @@ -0,0 +1,172 @@ +#!/usr/bin/bash + +############################################ +# Blair Seidlitz +# this script does an iterative emcal calib +# which runs event skimming on condor and +# does fitting locally. +# +# iteration 0 -> iter=0 +# pulls a calibration from currenttly calling it +# local_calib_copy.root to use in calotowercalib +# iteration 1 +# tower slope method +# iteration >= 2 +# pi0 iterative method +############################################# + + +export TargetDir="$PWD"/condorout + +iter=0 + +while read dir; do + rm inputdata.txt + for file in /sphenix/lustre01/sphnxpro/commissioning/DST_ana.395_2023p007/DST_CALO*-000"$dir"-*.root + do +cat >>inputdata.txt<< EOF +$file +EOF +done +done < runList.txt # redirect the input of the + + +if [ "$iter" -eq 0 ]; then + root "../Fun4All_EMCal.C(0,\"inputdata.txt\",0,\"local_calib_copy.root\")" + iter=$((iter+1)) +fi + + +# upper bound on x determines number of iterations +for((x=0;x<35;x++)); +do + +if [ -d ${TargetDir} ]; then + if [ -n "$(ls -A ${TargetDir}/OutDir*)" ]; then + rm -rf ${TargetDir}/OutDir* + fi +else + mkdir ${TargetDir} +fi + +i=0 +while read dir; do + li=$(printf "%04d" $i) + + rm inputdata.txt + + # creates a list of all files for a particular run + for file in /sphenix/lustre01/sphnxpro/commissioning/DST_ana395_2023p007/DST_CALO*-000"$dir"-*.root + do +cat >>inputdata.txt<< EOF +$file +EOF +done + + if [ "$iter" -le 3 ]; then + j=16 + else + j=100 + fi + tot_files=$( cat inputdata.txt | wc -l ) + echo "total files: $tot_files" + rem=$(( $tot_files%$j )) + files_per_job=$(( $tot_files/$j )) + njob=$j + if [ $rem -ne 0 ]; then + files_per_job=$(( $files_per_job+1 )) + fi + rem2=$(( $tot_files%$files_per_job )) + njob=$(( $tot_files/$files_per_job )) + if [ $rem2 -ne 0 ]; then + njob=$(( ($tot_files/$files_per_job)+1 )) + fi + echo "files per job: $files_per_job" + echo "njob: $njob" + + + for((q=0;q<$njob;q++)); + do + + mkdir ${TargetDir}/OutDir$i + export WorkDir="${TargetDir}/OutDir$i" + echo "WorkDir:" ${WorkDir} + start_file=$(( $q*$files_per_job+1 )) + end_file=$(( $start_file+$files_per_job-1 )) + echo "start file: $start_file end file: $end_file" + + sed -n $start_file\,${end_file}p inputdata.txt > tmp.txt + mv tmp.txt ${WorkDir}/inputdata.txt + + pushd ${WorkDir} + + + + cp -v "$PWD"/../../CondorRun.sh CondorRunJob$li.sh + cp -v "$PWD"/../../local_calib_copy.root . + cp "$PWD"/../../../Fun4All_EMCal.C . + + sed -i "s/iteration/$iter/g" CondorRunJob$li.sh + + chmod +x CondorRunJob$li.sh + + + cat >>ff.sub<< EOF ++JobFlavour = "workday" +transfer_input_files = ${WorkDir}/CondorRunJob$li.sh, ${WorkDir}/inputdata.txt,${WorkDir}/Fun4All_EMCal.C +Executable = CondorRunJob$li.sh +request_memory = 10GB +Universe = vanilla +Notification = Never +GetEnv = True +Priority = +12 +Output = condor.out +Error = condor.err +Log = /tmp/condor$li.log +Notify_user = bs3402@columbia.edu + +Queue +EOF + + condor_submit ff.sub + popd + + i=$((i+1)) + done +done < runList.txt # redirect the input of the + +# Set the directory where the files are located +file_directory="${TargetDir}/OutDir*/DONE.root" + +while [ $(ls $file_directory | wc -l) -lt $((i)) ]; do + current_file_count=$(ls $file_directory | wc -l) + echo "Waiting for $((i)) files, currently $current_file_count" + sleep 30 # Adjust the sleep duration as needed +done + +export TargetHadd="$PWD"/combine_out + +if [ ! -d ${TargetHadd} ]; then + mkdir ${TargetHadd} +fi + +file_to_hadd="${TargetDir}/OutDir*/OUTHIST_iter*.root" + +hist_out=${TargetHadd}/out${iter}.root + +rm $hist_out + +hadd -k $hist_out $file_to_hadd + +################################ +# FITTING (not done with condor + +if [ "$iter" -le 3 ]; then + root -b "../doTscFit.C(\"${hist_out}\",\"local_calib_copy.root\",$iter)" +else + root -b "../doFitAndCalibUpdate.C(\"${hist_out}\",\"local_calib_copy.root\",$iter)" +fi + +iter=$((iter+1)) + +done diff --git a/calibrations/calo/emcal_calib_year1/doFitAndCalibUpdate.C b/calibrations/calo/emcal_calib_year1/doFitAndCalibUpdate.C new file mode 100644 index 000000000..0f33aa128 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/doFitAndCalibUpdate.C @@ -0,0 +1,23 @@ + +#include +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + +void doFitAndCalibUpdate(const std::string &hist_fname = "base/combine_out/out2.root", const std::string &calib_fname = "base/local_calib_copy.root" ,int iter = 2) +{ + + + pi0EtaByEta *caFit = new pi0EtaByEta("calomodulename", "bla.root"); + //caFit->set_massTargetHistFile("/sphenix/u/bseidlitz/work/macros/calibrations/calo/emcal_calib_year1/run10_uncorr_cls_mass.root"); + caFit->fitEtaSlices(hist_fname.c_str(), Form("fitout_iter%d.root", iter), calib_fname.c_str()); + + size_t pos = calib_fname.find_last_of('.'); + string f_calib_save_name = calib_fname; + f_calib_save_name.insert(pos,Form("_iter%d",iter)); + + TFile* f_calib_mod = new TFile(calib_fname.c_str()); + f_calib_mod->Cp(f_calib_save_name.c_str()); + + gSystem->Exit(0); +} + + diff --git a/calibrations/calo/emcal_calib_year1/doTscFit.C b/calibrations/calo/emcal_calib_year1/doTscFit.C new file mode 100644 index 000000000..1233a3365 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/doTscFit.C @@ -0,0 +1,129 @@ +#include // for CDBTTree +#include +#include "TowerInfoDefs.h" + +#include "sPhenixStyle.C" + +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +R__LOAD_LIBRARY(libcdbobjects) + + +void TSCtoCDBTTree(const char * infile, const char * outputfile); +void mergeCDBTTrees(const char * infile1, const char * infile2, const char * outputfile); + +void doTscFit(const std::string &hist_fname = "base/combine_out/out1.root", const std::string &calib_fname = "base/local_calib_copy.root",int iter=1) +{ + + string fitoutfile = Form("tsc_fitout_it%d.root",iter); + + if (iter <= 2){ + LiteCaloEval modlce; + modlce.CaloType(LiteCaloEval::CEMC); + modlce.Get_Histos(hist_fname.c_str(),fitoutfile.c_str()); + modlce.m_myminbin = 8; + modlce.m_mymaxbin = 96; + modlce.setFitMin(0.20); + modlce.setFitMax(0.8); + if (iter==1) modlce.set_doQA(false); + if (iter==2) modlce.set_doQA(true); + modlce.FitRelativeShifts(&modlce,110); + } + + if (iter==3) { + SetsPhenixStyle(); + LiteCaloEval modlce; + modlce.CaloType(LiteCaloEval::CEMC); + modlce.Get_Histos(hist_fname.c_str(),fitoutfile.c_str()); + modlce.plot_cemc("figures"); + } + + + // create the cdbttree from tsc output andd multiply the corrections + // into the base calibration to pickup for pi0 first iteration + + TSCtoCDBTTree(fitoutfile.c_str(),Form("tsc_output_cdb_it%d.root",iter)); + mergeCDBTTrees(Form("tsc_output_cdb_it%d.root",iter),calib_fname.c_str(),calib_fname.c_str()); + + size_t pos = calib_fname.find_last_of('.'); + string f_calib_save_name = calib_fname; + f_calib_save_name.insert(pos,Form("_postTSC_it%d",iter)); + + TFile* f_calib_mod = new TFile(calib_fname.c_str()); + f_calib_mod->Cp(f_calib_save_name.c_str()); + + gSystem->Exit(0); +} + + +void mergeCDBTTrees(const char * infile1, const char * infile2, const char * outputfile) +{ + + CDBTTree *cdbttree1 = new CDBTTree(infile1); + CDBTTree *cdbttree2 = new CDBTTree(infile2); + CDBTTree *cdbttreeOut = new CDBTTree(outputfile); + + string m_fieldname = "Femc_datadriven_qm1_correction"; + + for(int i = 0; i < 96 ; i++) + { + for(int j = 0; j < 256; j++) + { + unsigned int key = TowerInfoDefs::encode_emcal(i,j); + float val1 = cdbttree1->GetFloatValue(key, m_fieldname); + float val2 = cdbttree2->GetFloatValue(key, m_fieldname); + cdbttreeOut->SetFloatValue(key,m_fieldname,val1*val2); + } + } + + cdbttreeOut->Commit(); + cdbttreeOut->WriteCDBTTree(); + delete cdbttreeOut; + delete cdbttree1; + delete cdbttree2; + +}//end macro + + + +void TSCtoCDBTTree(const char * infile, const char * outputfile) +{ + + bool chk4file = gSystem->AccessPathName(infile); + TFile *f = nullptr; + + if(!chk4file) + { + f = new TFile(infile,"READ"); + } + else + { + std::cout << "File " << infile << " cant be found in current directory." << std::endl; + exit(0); + } + + //write to cdb tree + CDBTTree *cdbttree = new CDBTTree(outputfile); + + //gain values lie in the 2d histogram called corrPat + TH2F *cp = (TH2F *)f->Get("corrPat"); + + for(int i = 0; i < 96 ; i++) + { + for(int j = 0; j < 256; j++) + { + unsigned int key = TowerInfoDefs::encode_emcal(i,j); + float gain = (1.0 / cp->GetBinContent(i+1,j+1) ); + if (cp->GetBinContent(i+1,j+1) <= 0) gain = 0; + if (isnan(cp->GetBinContent(i+1,j+1))) {gain = 0; cout << "nan calib from tsc " << i << "," << j << endl;} + cdbttree->SetFloatValue(key,"Femc_datadriven_qm1_correction",gain); + } + } + + cdbttree->Commit(); + cdbttree->WriteCDBTTree(); + //cdbttree->Print(); + f->Close(); + delete f; + delete cdbttree; + +} diff --git a/calibrations/calo/emcal_calib_year1/runLists/21560_21594.txt b/calibrations/calo/emcal_calib_year1/runLists/21560_21594.txt new file mode 100644 index 000000000..3b5500cd3 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/runLists/21560_21594.txt @@ -0,0 +1,15 @@ +21560 +21561 +21562 +21564 +21565 +21567 +21568 +21578 +21579 +21580 +21581 +21584 +21587 +21589 +21594 diff --git a/calibrations/calo/emcal_calib_year1/runLists/21598_21627.txt b/calibrations/calo/emcal_calib_year1/runLists/21598_21627.txt new file mode 100644 index 000000000..02ae6cbfa --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/runLists/21598_21627.txt @@ -0,0 +1,8 @@ +21598 +21609 +21608 +21599 +21616 +21615 +21626 +21627 diff --git a/calibrations/calo/emcal_calib_year1/runLists/21733_21754.txt b/calibrations/calo/emcal_calib_year1/runLists/21733_21754.txt new file mode 100644 index 000000000..0bb9685a6 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/runLists/21733_21754.txt @@ -0,0 +1,10 @@ +21733 +21739 +21740 +21744 +21745 +21747 +21748 +21750 +21751 +21754 diff --git a/calibrations/calo/emcal_calib_year1/runLists/23543_23619.txt b/calibrations/calo/emcal_calib_year1/runLists/23543_23619.txt new file mode 100644 index 000000000..f8231fd43 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/runLists/23543_23619.txt @@ -0,0 +1,22 @@ +23619 +23618 +23617 +23605 +23604 +23594 +23592 +23590 +23582 +23575 +23574 +23572 +23568 +23566 +23563 +23562 +23561 +23558 +23552 +23550 +23547 +23543 diff --git a/calibrations/calo/emcal_calib_year1/runLists/23671_23702.txt b/calibrations/calo/emcal_calib_year1/runLists/23671_23702.txt new file mode 100644 index 000000000..e3fc39ad5 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/runLists/23671_23702.txt @@ -0,0 +1,14 @@ +23702 +23699 +23697 +23696 +23695 +23694 +23693 +23690 +23687 +23682 +23681 +23676 +23672 +23671 diff --git a/calibrations/calo/emcal_calib_year1/runLists/23726_23746.txt b/calibrations/calo/emcal_calib_year1/runLists/23726_23746.txt new file mode 100644 index 000000000..d97a3e2c2 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/runLists/23726_23746.txt @@ -0,0 +1,11 @@ +23726 +23727 +23728 +23735 +23737 +23738 +23739 +23740 +23743 +23745 +23746 diff --git a/calibrations/calo/emcal_calib_year1/track_calib/Fun4All_EMCal.C b/calibrations/calo/emcal_calib_year1/track_calib/Fun4All_EMCal.C new file mode 100644 index 000000000..71cd675a6 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/track_calib/Fun4All_EMCal.C @@ -0,0 +1,93 @@ +#ifndef FUN4ALL_EMCAL_C +#define FUN4ALL_EMCAL_C + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include // for CDBTTree +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libcdbobjects) +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libffamodules.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) + +void createLocalEMCalCalibFile(const string fname, int runNumber); + + + + +void Fun4All_EMCal(int nevents = 100, const std::string &fname = "inputdata.txt") +{ + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + // se->Verbosity(verbosity); + recoConsts *rc = recoConsts::instance(); + + ifstream file(fname); + string first_file; + getline(file, first_file); + + //=============== + // conditions DB flags + //=============== + pair runseg = Fun4AllUtils::GetRunSegment(first_file); + int runnumber = runseg.first; + cout << "run number = " << runnumber << endl; + + // global tag + rc->set_StringFlag("CDB_GLOBALTAG", "MDC2"); + // // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP", runnumber); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DST_TOWERS"); + in->AddListFile(fname); + se->registerInputManager(in); + + std::string filename = first_file.substr(first_file.find_last_of("/\\") + 1); + std::string OutFile = Form("OUTHIST_%s",filename.c_str()); + + + LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC",OutFile); + eval7e->CaloType(LiteCaloEval::CEMC); + eval7e->setInputTowerNodeName("TOWERINFO_CALIB_CEMC"); + se->registerSubsystem(eval7e); + + + se->run(nevents); + se->End(); + se->PrintTimer(); + delete se; + +} + + + + +#endif diff --git a/calibrations/calo/emcal_calib_year1/track_calib/condor/CondorRun.sh b/calibrations/calo/emcal_calib_year1/track_calib/condor/CondorRun.sh new file mode 100644 index 000000000..0ed9e85cd --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/track_calib/condor/CondorRun.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo "------------------setting up environment--------------------" +export Cur_dir=$(pwd) +echo "running area:" ${Cur_dir} +echo "-------------------------running----------------------------" +cd ${Cur_dir} +ls +root '' > notes.log + + +# Run the ROOT macro with the file path as the second argument +root "Fun4All_EMCal.C(0,\"inputdata.txt\")" + +echo "JOB COMPLETE!" diff --git a/calibrations/calo/emcal_calib_year1/track_calib/condor/hadd.sh b/calibrations/calo/emcal_calib_year1/track_calib/condor/hadd.sh new file mode 100644 index 000000000..9eab09e83 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/track_calib/condor/hadd.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +export TargetDir="$PWD"/combine_out + +if [ ! -d ${TargetDir} ]; then + mkdir ${TargetDir} +fi + +while read dir; do # read each line of dirs.txt as dir + rm $TargetDir/out_"$dir".root + hadd -k $TargetDir/out_"$dir".root condorout/OutDir*/OUTHIST_*"$dir"*.root +done < runList.txt diff --git a/calibrations/calo/emcal_calib_year1/track_calib/condor/runList.txt b/calibrations/calo/emcal_calib_year1/track_calib/condor/runList.txt new file mode 100644 index 000000000..d97a3e2c2 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/track_calib/condor/runList.txt @@ -0,0 +1,11 @@ +23726 +23727 +23728 +23735 +23737 +23738 +23739 +23740 +23743 +23745 +23746 diff --git a/calibrations/calo/emcal_calib_year1/track_calib/condor/run_condor.sh b/calibrations/calo/emcal_calib_year1/track_calib/condor/run_condor.sh new file mode 100755 index 000000000..7a55b8097 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/track_calib/condor/run_condor.sh @@ -0,0 +1,90 @@ +#!/usr/bin/bash + +export TargetDir="$PWD"/condorout + +if [ -d ${TargetDir} ]; then + if [ -d ${TargetDir}/OutDir0 ]; then + rm -rf ${TargetDir}/OutDir* + fi +else + mkdir ${TargetDir} +fi + +i=0 +while read dir; do + li=$(printf "%04d" $i) + + rm inputdata.txt + +# creates a list of all files for a particular run +for file in /sphenix/lustre01/sphnxpro/commissioning/DST_ana395_2023p007/DST_CALO*-000"$dir"-*.root +do +cat >>inputdata.txt<< EOF +$file +EOF +done + + j=10 #jobs per a run + tot_files=$( cat inputdata.txt | wc -l ) + echo "total files: $tot_files" + rem=$(( $tot_files%$j )) + files_per_job=$(( $tot_files/$j )) + njob=$j + if [ $rem -ne 0 ]; then + files_per_job=$(( $files_per_job+1 )) + fi + rem2=$(( $tot_files%$files_per_job )) + njob=$(( $tot_files/$files_per_job )) + if [ $rem2 -ne 0 ]; then + njob=$(( ($tot_files/$files_per_job)+1 )) + fi + echo "files per job: $files_per_job" + echo "njob: $njob" + + + for((q=0;q<$njob;q++)); + do + + mkdir ${TargetDir}/OutDir$i + export WorkDir="${TargetDir}/OutDir$i" + echo "WorkDir:" ${WorkDir} + start_file=$(( $q*$files_per_job+1 )) + end_file=$(( $start_file+$files_per_job-1 )) + echo "start file: $start_file end file: $end_file" + + sed -n $start_file\,${end_file}p inputdata.txt > tmp.txt + mv tmp.txt ${WorkDir}/inputdata.txt + + pushd ${WorkDir} + + + + cp -v "$PWD"/../../CondorRun.sh CondorRunJob$li.sh + cp -v "$PWD"/../../../Fun4All_EMCal.C . + + chmod +x CondorRunJob$li.sh + + + cat >>ff.sub<< EOF ++JobFlavour = "workday" +transfer_input_files = ${WorkDir}/CondorRunJob$li.sh, ${WorkDir}/input.txt +Executable = CondorRunJob$li.sh +request_memory = 10GB +Universe = vanilla +Notification = Never +GetEnv = True +Priority = +12 +Output = condor.out +Error = condor.err +Log = /tmp/condor$li.log +Notify_user = bs3402@columbia.edu + +Queue +EOF + + condor_submit ff.sub + popd + + i=$((i+1)) + done +done < runList.txt # redirect the input of the diff --git a/calibrations/calo/emcal_calib_year1/track_calib/do_eta_fit_emc.C b/calibrations/calo/emcal_calib_year1/track_calib/do_eta_fit_emc.C new file mode 100644 index 000000000..1aaca7e90 --- /dev/null +++ b/calibrations/calo/emcal_calib_year1/track_calib/do_eta_fit_emc.C @@ -0,0 +1,46 @@ +#include + +#include "litecaloeval/LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +// File parameters - not modified histos, modified histos, output +void do_eta_fit_emc(const char * reffile = "condor/combine_out/out_sum.root", const char * infile="condor/combine_out/out_23746.root", const char * modfile="calib.root") +{ + + TStopwatch t; + t.Start(); + + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + + /// create LCE objects, one for a mod set of histos (modlce) and other for non mod set of histos (reflce) + LiteCaloEval reflce, modlce; + + + ///set the calo type to run over + reflce.CaloType(LiteCaloEval::CEMC); + modlce.CaloType(LiteCaloEval::CEMC); + + + /// get histograms for not mod histos + reflce.Get_Histos(reffile); + + /// get histograms for mod histos + modlce.Get_Histos(infile,modfile); + + ///set the fit range + modlce.setFitMin(0.12); + modlce.setFitMax(0.7); + + + /*Fit histos,obtain fit values. Second parameter determines smoothing/include phi loop (individual towers). + If set to e.g. 10 - do 1 smoothing and run over phi. + If set to 11, do one smoothing and dont do phi loop. Can do just 0 or 1. Which would be no smoothing, and + include phi if 0, and dont include if 1. + */ + modlce.FitRelativeShifts(&reflce,10); + + t.Stop(); + t.Print(); + +} diff --git a/calibrations/calo/tower_slope_macro/Fun4All_G4_SlopeCal.C b/calibrations/calo/tower_slope_macro/Fun4All_G4_SlopeCal.C new file mode 100644 index 000000000..1ebadd407 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/Fun4All_G4_SlopeCal.C @@ -0,0 +1,56 @@ +// these include guards are not really needed, but if we ever include this +// file somewhere they would be missed and we will have to refurbish all macros +#ifndef MACRO_FUN4ALLG4SLOPECAL_C +#define MACRO_FUN4ALLG4SLOPECAL_C + +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) + +void Fun4All_G4_SlopeCal( + const int nEvents = 1, + const string &inputClustersFileList = "dst_calo_cluster.list", + const string &outputFile = "test1") +{ + // this convenience library knows all our i/o objects so you don't + // have to figure out what is in each dst type + gSystem->Load("libg4dst.so"); + gSystem->Load("libLiteCaloEvalTowSlope.so"); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(); // set it to 1 if you want event printouts + + Fun4AllInputManager *in = new Fun4AllDstInputManager("DSTClusters"); + in->AddListFile(inputClustersFileList); + se->registerInputManager(in); + + string outputfile = outputFile + "_g4cemc_eval.root"; + string outputfile2 = outputFile + "_g4hcalin_eval.root"; + string outputfile3 = outputFile + "_g4hcalout_eval.root"; + + LiteCaloEval *eval = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile); + // eval->Verbosity(verbosity); + eval->CaloType(LiteCaloEval::CEMC); + se->registerSubsystem(eval); + + LiteCaloEval *eval2 = new LiteCaloEval("HINEVALUATOR", "HCALIN", outputfile2); + eval2->CaloType(LiteCaloEval::HCALIN); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval2); + + LiteCaloEval *eval3 = new LiteCaloEval("HOUTEVALUATOR", "HCALOUT", outputfile3); + // eval->Verbosity(verbosity); + eval3->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval3); + + se->run(nEvents); + se->End(); + delete se; + gSystem->Exit(0); +} + +#endif //MACRO_FUN4ALLG4SLOPECAL_C diff --git a/calibrations/calo/tower_slope_macro/G4_CEmc_Spacal.C b/calibrations/calo/tower_slope_macro/G4_CEmc_Spacal.C new file mode 100644 index 000000000..add4658d6 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/G4_CEmc_Spacal.C @@ -0,0 +1,588 @@ +#ifndef MACRO_G4CEMCSPACAL_C +#define MACRO_G4CEMCSPACAL_C + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +double +CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); + +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool CEMC = false; + bool CEMC_ABSORBER = false; + bool CEMC_OVERLAPCHECK = false; + bool CEMC_CELL = false; + bool CEMC_TOWER = false; + bool CEMC_CLUSTER = false; + bool CEMC_EVAL = false; + bool CEMC_QA = false; + int CEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4CEMC +{ + int Min_cemc_layer = 1; + int Max_cemc_layer = 1; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kNo_digitization; + // directly pass the energy of sim tower to digitized tower + // kNo_digitization + // simple digitization with photon statistics, single amplitude ADC conversion and pedestal + // kSimple_photon_digitization + // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal + // kSiPM_photon_digitization + + // set a default value for SPACAL configuration + // // 1D azimuthal projective SPACAL (fast) + //int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal; + // 2D azimuthal projective SPACAL (slow) + int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; + + enum enu_Cemc_clusterizer + { + kCemcGraphClusterizer, + + kCemcTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; + +} // namespace G4CEMC + +// black hole parameters are set in CEmc function +// needs a dummy argument to play with current G4Setup_sPHENIX.C +void CEmcInit(const int i = 0) +{ +} + +//! EMCal main setup macro +double +CEmc(PHG4Reco *g4Reco, double radius, const int crossings) +{ + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + return CEmc_1DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); + } + else + { + std::cout + << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; + exit(-1); + return 0; + } +} + +//! EMCal setup macro - 1D azimuthal projective SPACAL +double +CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + + double emc_inner_radius = 95.; // emc inner radius from engineering drawing + double cemcthickness = 12.7; + double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius + + if (radius > emc_inner_radius) + { + cout << "inconsistency: pstof outer radius: " << radius + << " larger than emc inner radius: " << emc_inner_radius + << endl; + gSystem->Exit(-1); + } + + // boundary check + if (radius > emc_inner_radius - 1.5 - no_overlapp) + { + cout << "G4_CEmc_Spacal.C::CEmc() - expect radius < " << emc_inner_radius - 1.5 - no_overlapp << " to install SPACAL" << endl; + exit(1); + } + radius = emc_inner_radius - 1.5 - no_overlapp; + + // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->SuperDetector("CEMC_ELECTRONICS"); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", 1.5); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius += 1.5; + radius += no_overlapp; + + int ilayer = G4CEMC::Min_cemc_layer; + PHG4SpacalSubsystem *cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + cemc->set_double_param("radius", emc_inner_radius); + cemc->set_double_param("thickness", cemcthickness); + + cemc->SetActive(); + cemc->SuperDetector("CEMC"); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + if (ilayer > G4CEMC::Max_cemc_layer) + { + cout << "layer discrepancy, current layer " << ilayer + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; + } + + radius += cemcthickness; + radius += no_overlapp; + + // 0.5cm thick Stainless Steel as an approximation for EMCAl support system + cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); + cyl->SuperDetector("CEMC_SPT"); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel + cyl->set_double_param("thickness", 0.5); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + radius += 0.5; + // this is the z extend and outer radius of the support structure and therefore the z extend + // and radius of the surrounding black holes + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 149.47); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -149.47); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius); + radius += no_overlapp; + + return radius; +} + +//! 2D full projective SPACAL +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + + double emc_inner_radius = 92; // emc inner radius from engineering drawing + double cemcthickness = 24.00000 - no_overlapp; + + //max radius is 116 cm; + double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius + assert(emc_outer_radius < 116); + + if (radius > emc_inner_radius) + { + cout << "inconsistency: preshower radius+thickness: " << radius + << " larger than emc inner radius: " << emc_inner_radius << endl; + gSystem->Exit(-1); + } + + // the radii are only to determined the thickness of the cemc + radius = emc_inner_radius; + + // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", 1.5 - no_overlapp); + cyl->SuperDetector("CEMC_ELECTRONICS"); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius += 1.5; + cemcthickness -= 1.5 + no_overlapp; + + // 0.5cm thick Stainless Steel as an approximation for EMCAl support system + cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); + cyl->SuperDetector("CEMC_SPT"); + cyl->set_double_param("radius", radius + cemcthickness - 0.5); + cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel + cyl->set_double_param("thickness", 0.5 - no_overlapp); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + // this is the z extend and outer radius of the support structure and therefore the z extend + // and radius of the surrounding black holes + double sptlen = PHG4Utils::GetLengthForRapidityCoverage(radius + cemcthickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, sptlen); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -sptlen); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + cemcthickness); + + cemcthickness -= 0.5 + no_overlapp; + + int ilayer = 0; + PHG4SpacalSubsystem *cemc; + + cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + + cemc->set_int_param("virualize_fiber", 0); + cemc->set_int_param("azimuthal_seg_visible", 1); + cemc->set_int_param("construction_verbose", 0); + cemc->Verbosity(0); + + cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); + cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2018ProjTilted/")); + cemc->set_double_param("radius", radius); // overwrite minimal radius + cemc->set_double_param("thickness", cemcthickness); // overwrite thickness + + cemc->SetActive(); + cemc->SuperDetector("CEMC"); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + if (ilayer > G4CEMC::Max_cemc_layer) + { + cout << "layer discrepancy, current layer " << ilayer + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; + } + + radius += cemcthickness; + radius += no_overlapp; + + return radius; +} + +void CEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + for (int i = G4CEMC::Min_cemc_layer; i <= G4CEMC::Max_cemc_layer; i++) + { + // cemc_cells->etaphisize(i, 0.024, 0.024); + const double radius = 95; + cemc_cells->cellsize(i, 2 * M_PI / 256. * radius, 2 * M_PI / 256. * radius); + } + se->registerSubsystem(cemc_cells); + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + cemc_cells->get_light_collection_model().load_data_file( + string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype3Module.xml"), + "data_grid_light_guide_efficiency", "data_grid_fiber_trans"); + se->registerSubsystem(cemc_cells); + } + else + { + cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + + return; +} + +void CEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); + TowerBuilder->Detector("CEMC"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + double sampling_fraction = 1; + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + sampling_fraction = 0.0234335; //from production:/gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal1d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + // sampling_fraction = 0.02244; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 2.36081e-02; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 1.90951e-02; // 2017 Tilt porjective SPACAL, 8 GeV photon, eta = 0.3 - 0.4 + sampling_fraction = 2e-02; // 2017 Tilt porjective SPACAL, tower-by-tower calibration + } + else + { + std::cout + << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << std::endl; + exit(-1); + return; + } + + const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition + + bool doSimple = true; + + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + TowerDigitizer->Detector("CEMC"); + TowerDigitizer->Verbosity(verbosity); + TowerDigitizer->set_digi_algorithm(G4CEMC::TowerDigi); + TowerDigitizer->set_variable_pedestal(true); //read ped central and width from calibrations file comment next 2 lines if true + // TowerDigitizer->set_pedstal_central_ADC(0); + // TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + TowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error + TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); + TowerDigitizer->set_variable_zero_suppression(true); //read zs values from calibrations file comment next line if true + // TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + TowerDigitizer->GetParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + + + // tower digitizer settings for doing decalibration -JEF May '22 + + TowerDigitizer->set_UseConditionsDB(false); + + //--------------- + // if conditions db is enabled in the line above, how to handle filename + // needs decided see below examples (TBD by Chris P) + //------------------ + // Some standard decal files specification where full decal is happening + // uses the same db file accessor api as for TowerCalib and thus format + // (format can change along with accessor internals, but user + // needs to know/give a readable format file). + // Decal tower by tow. factors in file are apply as a multiplicative + // factor to raw energy/adc see below about adc level + //--- + // TowerDigitizer->set_DoTowerDecal(true,"emcal_corr_sec12bands.root",false); + // TowerDigitizer->set_DoTowerDecal(true,"emcal_corr1_29.root",false); + TowerDigitizer->set_DoTowerDecal(true,"emcal_newPatternCinco.root",false); + + // third parameter (doInverse) specifies if you want + //to instead apply the reciprocal of the TowbyTow factors + // in the db file as a multiplicative factor + // here is an example of that + //TowerDigitizer->set_DoTowerDecal(true,"emcal_newPatternCinco.root",true); + + // in actuality we do not actually suffer from digitization + // effects on the entire pulse amplitude but rather sample + // ~12-14 times (pulse/pedestal itself about ~8 times) + // and both the pedestal and pulse are extracted as continuous + // (or near continous) quantities. In the near future the + // simple ("old fashioned") digitization scheme needs to implement + // a full sim of the pulse extraction procedure. + // therefore for now when running in decal mode, as a temporary + // more realistic approximation of this procedure, we change the + // energy response to continuous adc/energy values rather than digitized. + // this behavior currently only occurs if running in the decal mode + // .... + // If you want to apply this non-digitizing part of the code + // WITHOUT mod'ing the energy (ie w/o decal), call the DoDecal function without + // specifiying a filename as in the following example + // + // TowerDigitizer->set_DoTowerDecal(true, "",false); + + se->registerSubsystem(TowerDigitizer); + + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + TowerCalibration->Detector("CEMC"); + TowerCalibration->Verbosity(verbosity); + + + + + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // just use sampling fraction set previously + TowerCalibration->set_calib_const_GeV_ADC(1.0 / sampling_fraction); + } + else + { + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV); + TowerCalibration->set_pedstal_ADC(0); + } + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // just use sampling fraction set previously + TowerCalibration->set_calib_const_GeV_ADC(1.0 / sampling_fraction); + } + else + { + + if (!doSimple) + { + + + //for tower by tower cal + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kTower_by_tower_calibration); + TowerCalibration->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + TowerCalibration->set_variable_GeV_ADC(true); //read GeV per ADC from calibrations file comment next line if true + // TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_variable_pedestal(true); //read pedestals from calibrations file comment next line if true + // TowerCalibration->set_pedstal_ADC(0); + /////////////////////////// + + } + else // dosimple + { + + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kDbfile_tbt_gain_corr); + TowerCalibration->set_UseConditionsDB(false); + + // Some standard db calo calibration files specification + // + // uses the db file accessor api and thus format + // (format can change along with accessor internals, but user + // needs to know/give a readable format file). + // Decal tower by tow. factors in file are apply as a multiplicative + + //TowerCalibration->set_CalibrationFileName("emcal_corr1_29.root"); + //TowerCalibration->set_CalibrationFileName("inv_emcal_corr_sec12bands.root"); + TowerCalibration->set_CalibrationFileName("emcal_corr1_00.root"); + //TowerCalibration->set_CalibrationFileName("emcal_newPatternCinco.root"); + + // since for this loop we avert the tower by tower improvements + // in the kTower_by_tower xml-file based cemc calibration + // which can be reimplemented in the new tower by tower dbfile format + // but for now we make a single overall reduction factor of 0.87 + // that matches the same average calibration correction + // changing the following line to the one after it. -JEF + // TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_calib_const_GeV_ADC(0.87 * 1./ photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_pedstal_ADC(0); + // note that in the TowerCalibration object, the pedestal subtraction is no + // longer applied, the above line simply follows suit with all the other + // "calib_algorithms" on that object + + /////////////////////////// + } + + } + } + else + { + cout << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + se->registerSubsystem(TowerCalibration); + + return; +} + +void CEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + se->registerSubsystem(ClusterBuilder); + } + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "CEMC_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + + clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + + clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, + //raw location + string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); + + clusterCorrection->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection); + + return; +} +void CEMC_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void CEMC_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("CEMC"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/calibrations/calo/tower_slope_macro/G4_HcalIn_ref.C b/calibrations/calo/tower_slope_macro/G4_HcalIn_ref.C new file mode 100644 index 000000000..c1568be24 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/G4_HcalIn_ref.C @@ -0,0 +1,355 @@ +//Inner HCal reconstruction macro +#ifndef MACRO_G4HCALINREF_C +#define MACRO_G4HCALINREF_C + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +void HCalInner_SupportRing(PHG4Reco *g4Reco); + +namespace Enable +{ + bool HCALIN = false; + bool HCALIN_ABSORBER = false; + bool HCALIN_OVERLAPCHECK = false; + bool HCALIN_CELL = false; + bool HCALIN_TOWER = false; + bool HCALIN_CLUSTER = false; + bool HCALIN_EVAL = false; + bool HCALIN_QA = false; + bool HCALIN_SUPPORT = false; + int HCALIN_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALIN +{ + double support_ring_outer_radius = 178.0 - 0.001; + double support_ring_z_ring2 = (2150 + 2175) / 2. / 10.; + double dz = 25. / 10.; + + //Inner HCal absorber material selector: + //false - old version, absorber material is SS310 + //true - default Choose if you want Aluminum + bool inner_hcal_material_Al = true; + + int inner_hcal_eic = 0; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // directly pass the energy of sim tower to digitized tower + // kNo_digitization + // simple digitization with photon statistics, single amplitude ADC conversion and pedestal + // kSimple_photon_digitization + // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal + // kSiPM_photon_digitization + + enum enu_HCalIn_clusterizer + { + kHCalInGraphClusterizer, + + kHCalInTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; +} // namespace G4HCALIN + +// Init is called by G4Setup.C +void HCalInnerInit(const int iflag = 0) +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALIN::support_ring_outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALIN::support_ring_z_ring2 + G4HCALIN::dz / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALIN::support_ring_z_ring2 - G4HCALIN::dz / 2.); + if (iflag == 1) + { + G4HCALIN::inner_hcal_eic = 1; + } +} + +double HCalInner(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALIN_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + // all sizes are in cm! + PHG4InnerHcalSubsystem *hcal = new PHG4InnerHcalSubsystem("HCALIN"); + // these are the parameters you can change with their default settings + // hcal->set_string_param("material","SS310"); + if (G4HCALIN::inner_hcal_material_Al) + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + } + hcal->set_string_param("material", "G4_Al"); + } + else + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + } + hcal->set_string_param("material", "SS310"); + } + // hcal->set_double_param("inner_radius", 117.27); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", 134.42); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_gap", 0.85); + // hcal->set_double_param("scinti_outer_gap", 1.22 * (5.0 / 4.0)); + // hcal->set_double_param("scinti_outer_radius", 133.3); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", 175.94 * 2); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", 36.15); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 4); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "SS310"); + + hcal->SetActive(); + hcal->SuperDetector("HCALIN"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + hcal->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(hcal); + + radius = hcal->get_double_param("outer_radius"); + + HCalInner_SupportRing(g4Reco); + + radius += no_overlapp; + return radius; +} + +//! A rough version of the inner HCal support ring, from Richie's CAD drawing. - Jin +void HCalInner_SupportRing(PHG4Reco *g4Reco) +{ + bool AbsorberActive = Enable::SUPPORT || Enable::HCALIN_SUPPORT; + + const double z_ring1 = (2025 + 2050) / 2. / 10.; + const double innerradius_sphenix = 116.; + const double innerradius_ephenix_hadronside = 138.; + const double z_rings[] = + {-G4HCALIN::support_ring_z_ring2, -z_ring1, z_ring1, G4HCALIN::support_ring_z_ring2}; + + PHG4CylinderSubsystem *cyl; + + for (int i = 0; i < 4; i++) + { + double innerradius = innerradius_sphenix; + if (z_rings[i] > 0 && G4HCALIN::inner_hcal_eic == 1) + { + innerradius = innerradius_ephenix_hadronside; + } + cyl = new PHG4CylinderSubsystem("HCALIN_SPT_N1", i); + cyl->set_double_param("place_z", z_rings[i]); + cyl->SuperDetector("HCALIN_SPT"); + cyl->set_double_param("radius", innerradius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4HCALIN::dz); + cyl->set_string_param("material", "SS310"); + cyl->set_double_param("thickness", G4HCALIN::support_ring_outer_radius - innerradius); + if (AbsorberActive) + { + cyl->SetActive(); + } + g4Reco->registerSubsystem(cyl); + } + + return; +} + +void HCALInner_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); + hc->Detector("HCALIN"); + // hc->Verbosity(2); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALInner_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); + TowerBuilder->Detector("HCALIN"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalInRawTowerDigitizer"); + TowerDigitizer->Detector("HCALIN"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALIN::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(32. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + se->registerSubsystem(TowerDigitizer); + + //Default sampling fraction for SS310 + double visible_sample_fraction_HCALIN = 0.0631283; //, /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV-0000.root_qa.rootQA_Draw_HCALIN_G4Hit.pdf + + if (G4HCALIN::inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalInRawTowerCalibration"); + TowerCalibration->Detector("HCALIN"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + + // TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kDbfile_tbt_gain_corr); + TowerCalibration->set_UseConditionsDB(false); + // see documentation in github/jtaou/coresoft + // ...[calib/towerslope] /macros/G4_CEmc_Spacal.C + // for more info about TowerCalibration dbfile mode + + // TowerCalibration->set_CalibrationFileName("HCALIN_GainsCalib1.22.txt"); + TowerCalibration->set_CalibrationFileName("HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt"); + + + if (G4HCALIN::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.176 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.176); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); + } + TowerCalibration->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALInner_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCalIn_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + return; +} + +void HCALInner_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALInner_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALIN"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/calibrations/calo/tower_slope_macro/G4_HcalOut_ref.C b/calibrations/calo/tower_slope_macro/G4_HcalOut_ref.C new file mode 100644 index 000000000..d06d44bb0 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/G4_HcalOut_ref.C @@ -0,0 +1,284 @@ +#ifndef MACRO_G4HCALOUTREF_C +#define MACRO_G4HCALOUTREF_C + +#include +#include + +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool HCALOUT = false; + bool HCALOUT_ABSORBER = false; + bool HCALOUT_OVERLAPCHECK = false; + bool HCALOUT_CELL = false; + bool HCALOUT_TOWER = false; + bool HCALOUT_CLUSTER = false; + bool HCALOUT_EVAL = false; + bool HCALOUT_QA = false; + int HCALOUT_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALOUT +{ + double outer_radius = 264.71; + double size_z = 304.91 * 2; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // directly pass the energy of sim tower to digitized tower + // kNo_digitization + // simple digitization with photon statistics, single amplitude ADC conversion and pedestal + // kSimple_photon_digitization + // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal + // kSiPM_photon_digitization + + enum enu_HCalOut_clusterizer + { + kHCalOutGraphClusterizer, + kHCalOutTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + //enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; +} // namespace G4HCALOUT + +// Init is called by G4Setup.C +void HCalOuterInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALOUT::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALOUT::size_z / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALOUT::size_z / 2.); +} + +double HCalOuter(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALOUT_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT"); + // hcal->set_double_param("inner_radius", 183.3); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->set_double_param("magnet_cutout_radius", 195.31); + // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", G4HCALOUT::outer_radius); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap", 0.85); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_radius",183.89); + // hcal->set_double_param("scinti_outer_radius",263.27); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", G4HCALOUT::size_z); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", -11.23); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("magnet_cutout_first_scinti", 8); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 5); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "Steel_1006"); + + hcal->SetActive(); + hcal->SuperDetector("HCALOUT"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + hcal->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(hcal); + + radius = hcal->get_double_param("outer_radius"); + + radius += no_overlapp; + + return radius; +} + +void HCALOuter_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); + hc->Detector("HCALOUT"); + // hc->Verbosity(2); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALOuter_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); + TowerBuilder->Detector("HCALOUT"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer"); + TowerDigitizer->Detector("HCALOUT"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALOUT::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(16. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + se->registerSubsystem(TowerDigitizer); + + const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration"); + TowerCalibration->Detector("HCALOUT"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + + //TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + + + // see documentation in github/jtaou/coresoft + // ...[calib/towerslope] /macros/G4_CEmc_Spacal.C + // for more info about TowerCalibration dbfile mode + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kDbfile_tbt_gain_corr); + TowerCalibration->set_UseConditionsDB(false); + // + //TowerCalibration->set_CalibrationFileName("HCALOUT_GainsCalib1.22.txt"); + TowerCalibration->set_CalibrationFileName("HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt"); + + + if (G4HCALOUT::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.033 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.033); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); + } + TowerCalibration->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALOuter_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCALOuter_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + return; +} + +void HCALOuter_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALOuter_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALOUT"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt new file mode 100644 index 000000000..aba66f7cb --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt @@ -0,0 +1,1536 @@ +0 0 1.0 +0 1 1.0 +0 2 1.0 +0 3 1.0 +0 4 1.0 +0 5 1.0 +0 6 1.0 +0 7 1.0 +0 8 1.0 +0 9 1.0 +0 10 1.0 +0 11 1.0 +0 12 1.0 +0 13 1.0 +0 14 1.0 +0 15 1.0 +0 16 1.0 +0 17 1.0 +0 18 1.0 +0 19 1.0 +0 20 1.0 +0 21 1.0 +0 22 1.0 +0 23 1.0 +0 24 1.0 +0 25 1.0 +0 26 1.0 +0 27 1.0 +0 28 1.0 +0 29 1.0 +0 30 1.0 +0 31 1.0 +0 32 1.0 +0 33 1.0 +0 34 1.0 +0 35 1.0 +0 36 1.0 +0 37 1.0 +0 38 1.0 +0 39 1.0 +0 40 1.0 +0 41 1.0 +0 42 1.0 +0 43 1.0 +0 44 1.0 +0 45 1.0 +0 46 1.0 +0 47 1.0 +0 48 1.0 +0 49 1.0 +0 50 1.0 +0 51 1.0 +0 52 1.0 +0 53 1.0 +0 54 1.0 +0 55 1.0 +0 56 1.0 +0 57 1.0 +0 58 1.0 +0 59 1.0 +0 60 1.0 +0 61 1.0 +0 62 1.0 +0 63 1.0 +1 0 1.0 +1 1 1.0 +1 2 1.0 +1 3 1.0 +1 4 1.0 +1 5 1.0 +1 6 1.0 +1 7 1.0 +1 8 1.0 +1 9 1.0 +1 10 1.0 +1 11 1.0 +1 12 1.0 +1 13 1.0 +1 14 1.0 +1 15 1.0 +1 16 1.0 +1 17 1.0 +1 18 1.0 +1 19 1.0 +1 20 1.0 +1 21 1.0 +1 22 1.0 +1 23 1.0 +1 24 1.0 +1 25 1.0 +1 26 1.0 +1 27 1.0 +1 28 1.0 +1 29 1.0 +1 30 1.0 +1 31 1.0 +1 32 1.0 +1 33 1.0 +1 34 1.0 +1 35 1.0 +1 36 1.0 +1 37 1.0 +1 38 1.0 +1 39 1.0 +1 40 1.0 +1 41 1.0 +1 42 1.0 +1 43 1.0 +1 44 1.0 +1 45 1.0 +1 46 1.0 +1 47 1.0 +1 48 1.0 +1 49 1.0 +1 50 1.0 +1 51 1.0 +1 52 1.0 +1 53 1.0 +1 54 1.0 +1 55 1.0 +1 56 1.0 +1 57 1.0 +1 58 1.0 +1 59 1.0 +1 60 1.0 +1 61 1.0 +1 62 1.0 +1 63 1.0 +2 0 1.0 +2 1 1.0 +2 2 1.0 +2 3 1.0 +2 4 1.0 +2 5 1.0 +2 6 1.0 +2 7 1.0 +2 8 1.0 +2 9 1.0 +2 10 1.0 +2 11 1.0 +2 12 1.0 +2 13 1.0 +2 14 1.0 +2 15 1.0 +2 16 1.0 +2 17 1.0 +2 18 1.0 +2 19 1.0 +2 20 1.0 +2 21 1.0 +2 22 1.0 +2 23 1.0 +2 24 1.0 +2 25 1.0 +2 26 1.0 +2 27 1.0 +2 28 1.0 +2 29 1.0 +2 30 1.0 +2 31 1.0 +2 32 1.0 +2 33 1.0 +2 34 1.0 +2 35 1.0 +2 36 1.0 +2 37 1.0 +2 38 1.0 +2 39 1.0 +2 40 1.0 +2 41 1.0 +2 42 1.0 +2 43 1.0 +2 44 1.0 +2 45 1.0 +2 46 1.0 +2 47 1.0 +2 48 1.0 +2 49 1.0 +2 50 1.0 +2 51 1.0 +2 52 1.0 +2 53 1.0 +2 54 1.0 +2 55 1.0 +2 56 1.0 +2 57 1.0 +2 58 1.0 +2 59 1.0 +2 60 1.0 +2 61 1.0 +2 62 1.0 +2 63 1.0 +3 0 1.0 +3 1 1.0 +3 2 1.0 +3 3 1.0 +3 4 1.0 +3 5 1.0 +3 6 1.0 +3 7 1.0 +3 8 1.0 +3 9 1.0 +3 10 1.0 +3 11 1.0 +3 12 1.0 +3 13 1.0 +3 14 1.0 +3 15 1.0 +3 16 1.0 +3 17 1.0 +3 18 1.0 +3 19 1.0 +3 20 1.0 +3 21 1.0 +3 22 1.0 +3 23 1.0 +3 24 1.0 +3 25 1.0 +3 26 1.0 +3 27 1.0 +3 28 1.0 +3 29 1.0 +3 30 1.0 +3 31 1.0 +3 32 1.0 +3 33 1.0 +3 34 1.0 +3 35 1.0 +3 36 1.0 +3 37 1.0 +3 38 1.0 +3 39 1.0 +3 40 1.0 +3 41 1.0 +3 42 1.0 +3 43 1.0 +3 44 1.0 +3 45 1.0 +3 46 1.0 +3 47 1.0 +3 48 1.0 +3 49 1.0 +3 50 1.0 +3 51 1.0 +3 52 1.0 +3 53 1.0 +3 54 1.0 +3 55 1.0 +3 56 1.0 +3 57 1.0 +3 58 1.0 +3 59 1.0 +3 60 1.0 +3 61 1.0 +3 62 1.0 +3 63 1.0 +4 0 1.0 +4 1 1.0 +4 2 1.0 +4 3 1.0 +4 4 1.0 +4 5 1.0 +4 6 1.0 +4 7 1.0 +4 8 1.0 +4 9 1.0 +4 10 1.0 +4 11 1.0 +4 12 1.0 +4 13 1.0 +4 14 1.0 +4 15 1.0 +4 16 1.0 +4 17 1.0 +4 18 1.0 +4 19 1.0 +4 20 1.0 +4 21 1.0 +4 22 1.0 +4 23 1.0 +4 24 1.0 +4 25 1.0 +4 26 1.0 +4 27 1.0 +4 28 1.0 +4 29 1.0 +4 30 1.0 +4 31 1.0 +4 32 1.0 +4 33 1.0 +4 34 1.0 +4 35 1.0 +4 36 1.0 +4 37 1.0 +4 38 1.0 +4 39 1.0 +4 40 1.0 +4 41 1.0 +4 42 1.0 +4 43 1.0 +4 44 1.0 +4 45 1.0 +4 46 1.0 +4 47 1.0 +4 48 1.0 +4 49 1.0 +4 50 1.0 +4 51 1.0 +4 52 1.0 +4 53 1.0 +4 54 1.0 +4 55 1.0 +4 56 1.0 +4 57 1.0 +4 58 1.0 +4 59 1.0 +4 60 1.0 +4 61 1.0 +4 62 1.0 +4 63 1.0 +5 0 1.0 +5 1 1.0 +5 2 1.0 +5 3 1.0 +5 4 1.0 +5 5 1.0 +5 6 1.0 +5 7 1.0 +5 8 1.0 +5 9 1.0 +5 10 1.0 +5 11 1.0 +5 12 1.0 +5 13 1.0 +5 14 1.0 +5 15 1.0 +5 16 1.0 +5 17 1.0 +5 18 1.0 +5 19 1.0 +5 20 1.0 +5 21 1.0 +5 22 1.0 +5 23 1.0 +5 24 1.0 +5 25 1.0 +5 26 1.0 +5 27 1.0 +5 28 1.0 +5 29 1.0 +5 30 1.0 +5 31 1.0 +5 32 1.0 +5 33 1.0 +5 34 1.0 +5 35 1.0 +5 36 1.0 +5 37 1.0 +5 38 1.0 +5 39 1.0 +5 40 1.0 +5 41 1.0 +5 42 1.0 +5 43 1.0 +5 44 1.0 +5 45 1.0 +5 46 1.0 +5 47 1.0 +5 48 1.0 +5 49 1.0 +5 50 1.0 +5 51 1.0 +5 52 1.0 +5 53 1.0 +5 54 1.0 +5 55 1.0 +5 56 1.0 +5 57 1.0 +5 58 1.0 +5 59 1.0 +5 60 1.0 +5 61 1.0 +5 62 1.0 +5 63 1.0 +6 0 1.0 +6 1 1.0 +6 2 1.0 +6 3 1.0 +6 4 1.0 +6 5 1.0 +6 6 1.0 +6 7 1.0 +6 8 1.0 +6 9 1.0 +6 10 1.0 +6 11 1.0 +6 12 1.0 +6 13 1.0 +6 14 1.0 +6 15 1.0 +6 16 1.0 +6 17 1.0 +6 18 1.0 +6 19 1.0 +6 20 1.0 +6 21 1.0 +6 22 1.0 +6 23 1.0 +6 24 1.0 +6 25 1.0 +6 26 1.0 +6 27 1.0 +6 28 1.0 +6 29 1.0 +6 30 1.0 +6 31 1.0 +6 32 1.0 +6 33 1.0 +6 34 1.0 +6 35 1.0 +6 36 1.0 +6 37 1.0 +6 38 1.0 +6 39 1.0 +6 40 1.0 +6 41 1.0 +6 42 1.0 +6 43 1.0 +6 44 1.0 +6 45 1.0 +6 46 1.0 +6 47 1.0 +6 48 1.0 +6 49 1.0 +6 50 1.0 +6 51 1.0 +6 52 1.0 +6 53 1.0 +6 54 1.0 +6 55 1.0 +6 56 1.0 +6 57 1.0 +6 58 1.0 +6 59 1.0 +6 60 1.0 +6 61 1.0 +6 62 1.0 +6 63 1.0 +7 0 1.0 +7 1 1.0 +7 2 1.0 +7 3 1.0 +7 4 1.0 +7 5 1.0 +7 6 1.0 +7 7 1.0 +7 8 1.0 +7 9 1.0 +7 10 1.0 +7 11 1.0 +7 12 1.0 +7 13 1.0 +7 14 1.0 +7 15 1.0 +7 16 1.0 +7 17 1.0 +7 18 1.0 +7 19 1.0 +7 20 1.0 +7 21 1.0 +7 22 1.0 +7 23 1.0 +7 24 1.0 +7 25 1.0 +7 26 1.0 +7 27 1.0 +7 28 1.0 +7 29 1.0 +7 30 1.0 +7 31 1.0 +7 32 1.0 +7 33 1.0 +7 34 1.0 +7 35 1.0 +7 36 1.0 +7 37 1.0 +7 38 1.0 +7 39 1.0 +7 40 1.0 +7 41 1.0 +7 42 1.0 +7 43 1.0 +7 44 1.0 +7 45 1.0 +7 46 1.0 +7 47 1.0 +7 48 1.0 +7 49 1.0 +7 50 1.0 +7 51 1.0 +7 52 1.0 +7 53 1.0 +7 54 1.0 +7 55 1.0 +7 56 1.0 +7 57 1.0 +7 58 1.0 +7 59 1.0 +7 60 1.0 +7 61 1.0 +7 62 1.0 +7 63 1.0 +8 0 1.0 +8 1 1.0 +8 2 1.0 +8 3 1.0 +8 4 1.0 +8 5 1.0 +8 6 1.0 +8 7 1.0 +8 8 1.0 +8 9 1.0 +8 10 1.0 +8 11 1.0 +8 12 1.0 +8 13 1.0 +8 14 1.0 +8 15 1.0 +8 16 1.0 +8 17 1.0 +8 18 1.0 +8 19 1.0 +8 20 1.0 +8 21 1.0 +8 22 1.0 +8 23 1.0 +8 24 1.0 +8 25 1.0 +8 26 1.0 +8 27 1.0 +8 28 1.0 +8 29 1.0 +8 30 1.0 +8 31 1.0 +8 32 1.0 +8 33 1.0 +8 34 1.0 +8 35 1.0 +8 36 1.0 +8 37 1.0 +8 38 1.0 +8 39 1.0 +8 40 1.0 +8 41 1.0 +8 42 1.0 +8 43 1.0 +8 44 1.0 +8 45 1.0 +8 46 1.0 +8 47 1.0 +8 48 1.0 +8 49 1.0 +8 50 1.0 +8 51 1.0 +8 52 1.0 +8 53 1.0 +8 54 1.0 +8 55 1.0 +8 56 1.0 +8 57 1.0 +8 58 1.0 +8 59 1.0 +8 60 1.0 +8 61 1.0 +8 62 1.0 +8 63 1.0 +9 0 1.0 +9 1 1.0 +9 2 1.0 +9 3 1.0 +9 4 1.0 +9 5 1.0 +9 6 1.0 +9 7 1.0 +9 8 1.0 +9 9 1.0 +9 10 1.0 +9 11 1.0 +9 12 1.0 +9 13 1.0 +9 14 1.0 +9 15 1.0 +9 16 1.0 +9 17 1.0 +9 18 1.0 +9 19 1.0 +9 20 1.0 +9 21 1.0 +9 22 1.0 +9 23 1.0 +9 24 1.0 +9 25 1.0 +9 26 1.0 +9 27 1.0 +9 28 1.0 +9 29 1.0 +9 30 1.0 +9 31 1.0 +9 32 1.0 +9 33 1.0 +9 34 1.0 +9 35 1.0 +9 36 1.0 +9 37 1.0 +9 38 1.0 +9 39 1.0 +9 40 1.0 +9 41 1.0 +9 42 1.0 +9 43 1.0 +9 44 1.0 +9 45 1.0 +9 46 1.0 +9 47 1.0 +9 48 1.0 +9 49 1.0 +9 50 1.0 +9 51 1.0 +9 52 1.0 +9 53 1.0 +9 54 1.0 +9 55 1.0 +9 56 1.0 +9 57 1.0 +9 58 1.0 +9 59 1.0 +9 60 1.0 +9 61 1.0 +9 62 1.0 +9 63 1.0 +10 0 1.0 +10 1 1.0 +10 2 1.0 +10 3 1.0 +10 4 1.0 +10 5 1.0 +10 6 1.0 +10 7 1.0 +10 8 1.0 +10 9 1.0 +10 10 1.0 +10 11 1.0 +10 12 1.0 +10 13 1.0 +10 14 1.0 +10 15 1.0 +10 16 1.0 +10 17 1.0 +10 18 1.0 +10 19 1.0 +10 20 1.0 +10 21 1.0 +10 22 1.0 +10 23 1.0 +10 24 1.0 +10 25 1.0 +10 26 1.0 +10 27 1.0 +10 28 1.0 +10 29 1.0 +10 30 1.0 +10 31 1.0 +10 32 1.0 +10 33 1.0 +10 34 1.0 +10 35 1.0 +10 36 1.0 +10 37 1.0 +10 38 1.0 +10 39 1.0 +10 40 1.0 +10 41 1.0 +10 42 1.0 +10 43 1.0 +10 44 1.0 +10 45 1.0 +10 46 1.0 +10 47 1.0 +10 48 1.0 +10 49 1.0 +10 50 1.0 +10 51 1.0 +10 52 1.0 +10 53 1.0 +10 54 1.0 +10 55 1.0 +10 56 1.0 +10 57 1.0 +10 58 1.0 +10 59 1.0 +10 60 1.0 +10 61 1.0 +10 62 1.0 +10 63 1.0 +11 0 1.0 +11 1 1.0 +11 2 1.0 +11 3 1.0 +11 4 1.0 +11 5 1.0 +11 6 1.0 +11 7 1.0 +11 8 1.0 +11 9 1.0 +11 10 1.0 +11 11 1.0 +11 12 1.0 +11 13 1.0 +11 14 1.0 +11 15 1.0 +11 16 1.0 +11 17 1.0 +11 18 1.0 +11 19 1.0 +11 20 1.0 +11 21 1.0 +11 22 1.0 +11 23 1.0 +11 24 1.0 +11 25 1.0 +11 26 1.0 +11 27 1.0 +11 28 1.0 +11 29 1.0 +11 30 1.0 +11 31 1.0 +11 32 1.0 +11 33 1.0 +11 34 1.0 +11 35 1.0 +11 36 1.0 +11 37 1.0 +11 38 1.0 +11 39 1.0 +11 40 1.0 +11 41 1.0 +11 42 1.0 +11 43 1.0 +11 44 1.0 +11 45 1.0 +11 46 1.0 +11 47 1.0 +11 48 1.0 +11 49 1.0 +11 50 1.0 +11 51 1.0 +11 52 1.0 +11 53 1.0 +11 54 1.0 +11 55 1.0 +11 56 1.0 +11 57 1.0 +11 58 1.0 +11 59 1.0 +11 60 1.0 +11 61 1.0 +11 62 1.0 +11 63 1.0 +12 0 1.12 +12 1 1.12 +12 2 1.12 +12 3 1.12 +12 4 1.12 +12 5 1.12 +12 6 1.12 +12 7 1.12 +12 8 1.12 +12 9 1.12 +12 10 1.12 +12 11 1.12 +12 12 1.12 +12 13 1.12 +12 14 1.12 +12 15 1.12 +12 16 1.12 +12 17 1.12 +12 18 1.12 +12 19 1.12 +12 20 1.12 +12 21 1.12 +12 22 1.12 +12 23 1.12 +12 24 1.12 +12 25 1.12 +12 26 1.12 +12 27 1.12 +12 28 1.12 +12 29 1.12 +12 30 1.12 +12 31 1.12 +12 32 1.12 +12 33 1.12 +12 34 1.12 +12 35 1.12 +12 36 1.12 +12 37 1.12 +12 38 1.12 +12 39 1.12 +12 40 1.12 +12 41 1.12 +12 42 1.12 +12 43 1.12 +12 44 1.12 +12 45 1.12 +12 46 1.12 +12 47 1.12 +12 48 1.12 +12 49 1.12 +12 50 1.12 +12 51 1.12 +12 52 1.12 +12 53 1.12 +12 54 1.12 +12 55 1.12 +12 56 1.12 +12 57 1.12 +12 58 1.12 +12 59 1.12 +12 60 1.12 +12 61 1.12 +12 62 1.12 +12 63 1.12 +13 0 1.12 +13 1 1.12 +13 2 1.12 +13 3 1.12 +13 4 1.12 +13 5 1.12 +13 6 1.12 +13 7 1.12 +13 8 1.12 +13 9 1.12 +13 10 1.12 +13 11 1.12 +13 12 1.12 +13 13 1.12 +13 14 1.12 +13 15 1.12 +13 16 1.12 +13 17 1.12 +13 18 1.12 +13 19 1.12 +13 20 1.12 +13 21 1.12 +13 22 1.12 +13 23 1.12 +13 24 1.12 +13 25 1.12 +13 26 1.12 +13 27 1.12 +13 28 1.12 +13 29 1.12 +13 30 1.12 +13 31 1.12 +13 32 1.12 +13 33 1.12 +13 34 1.12 +13 35 1.12 +13 36 1.12 +13 37 1.12 +13 38 1.12 +13 39 1.12 +13 40 1.12 +13 41 1.12 +13 42 1.12 +13 43 1.12 +13 44 1.12 +13 45 1.12 +13 46 1.12 +13 47 1.12 +13 48 1.12 +13 49 1.12 +13 50 1.12 +13 51 1.12 +13 52 1.12 +13 53 1.12 +13 54 1.12 +13 55 1.12 +13 56 1.12 +13 57 1.12 +13 58 1.12 +13 59 1.12 +13 60 1.12 +13 61 1.12 +13 62 1.12 +13 63 1.12 +14 0 1.12 +14 1 1.12 +14 2 1.12 +14 3 1.12 +14 4 1.12 +14 5 1.12 +14 6 1.12 +14 7 1.12 +14 8 1.12 +14 9 1.12 +14 10 1.12 +14 11 1.12 +14 12 1.12 +14 13 1.12 +14 14 1.12 +14 15 1.12 +14 16 1.12 +14 17 1.12 +14 18 1.12 +14 19 1.12 +14 20 1.12 +14 21 1.12 +14 22 1.12 +14 23 1.12 +14 24 1.12 +14 25 1.12 +14 26 1.12 +14 27 1.12 +14 28 1.12 +14 29 1.12 +14 30 1.12 +14 31 1.12 +14 32 1.12 +14 33 1.12 +14 34 1.12 +14 35 1.12 +14 36 1.12 +14 37 1.12 +14 38 1.12 +14 39 1.12 +14 40 1.12 +14 41 1.12 +14 42 1.12 +14 43 1.12 +14 44 1.12 +14 45 1.12 +14 46 1.12 +14 47 1.12 +14 48 1.12 +14 49 1.12 +14 50 1.12 +14 51 1.12 +14 52 1.12 +14 53 1.12 +14 54 1.12 +14 55 1.12 +14 56 1.12 +14 57 1.12 +14 58 1.12 +14 59 1.12 +14 60 1.12 +14 61 1.12 +14 62 1.12 +14 63 1.12 +15 0 1.12 +15 1 1.12 +15 2 1.12 +15 3 1.12 +15 4 1.12 +15 5 1.12 +15 6 1.12 +15 7 1.12 +15 8 1.12 +15 9 1.12 +15 10 1.12 +15 11 1.12 +15 12 1.12 +15 13 1.12 +15 14 1.12 +15 15 1.12 +15 16 1.12 +15 17 1.12 +15 18 1.12 +15 19 1.12 +15 20 1.12 +15 21 1.12 +15 22 1.12 +15 23 1.12 +15 24 1.12 +15 25 1.12 +15 26 1.12 +15 27 1.12 +15 28 1.12 +15 29 1.12 +15 30 1.12 +15 31 1.12 +15 32 1.12 +15 33 1.12 +15 34 1.12 +15 35 1.12 +15 36 1.12 +15 37 1.12 +15 38 1.12 +15 39 1.12 +15 40 1.12 +15 41 1.12 +15 42 1.12 +15 43 1.12 +15 44 1.12 +15 45 1.12 +15 46 1.12 +15 47 1.12 +15 48 1.12 +15 49 1.12 +15 50 1.12 +15 51 1.12 +15 52 1.12 +15 53 1.12 +15 54 1.12 +15 55 1.12 +15 56 1.12 +15 57 1.12 +15 58 1.12 +15 59 1.12 +15 60 1.12 +15 61 1.12 +15 62 1.12 +15 63 1.12 +16 0 1.12 +16 1 1.12 +16 2 1.12 +16 3 1.12 +16 4 1.12 +16 5 1.12 +16 6 1.12 +16 7 1.12 +16 8 1.12 +16 9 1.12 +16 10 1.12 +16 11 1.12 +16 12 1.12 +16 13 1.12 +16 14 1.12 +16 15 1.12 +16 16 1.12 +16 17 1.12 +16 18 1.12 +16 19 1.12 +16 20 1.12 +16 21 1.12 +16 22 1.12 +16 23 1.12 +16 24 1.12 +16 25 1.12 +16 26 1.12 +16 27 1.12 +16 28 1.12 +16 29 1.12 +16 30 1.12 +16 31 1.12 +16 32 1.12 +16 33 1.12 +16 34 1.12 +16 35 1.12 +16 36 1.12 +16 37 1.12 +16 38 1.12 +16 39 1.12 +16 40 1.12 +16 41 1.12 +16 42 1.12 +16 43 1.12 +16 44 1.12 +16 45 1.12 +16 46 1.12 +16 47 1.12 +16 48 1.12 +16 49 1.12 +16 50 1.12 +16 51 1.12 +16 52 1.12 +16 53 1.12 +16 54 1.12 +16 55 1.12 +16 56 1.12 +16 57 1.12 +16 58 1.12 +16 59 1.12 +16 60 1.12 +16 61 1.12 +16 62 1.12 +16 63 1.12 +17 0 1.12 +17 1 1.12 +17 2 1.12 +17 3 1.12 +17 4 1.12 +17 5 1.12 +17 6 1.12 +17 7 1.12 +17 8 1.12 +17 9 1.12 +17 10 1.12 +17 11 1.12 +17 12 1.12 +17 13 1.12 +17 14 1.12 +17 15 1.12 +17 16 1.12 +17 17 1.12 +17 18 1.12 +17 19 1.12 +17 20 1.12 +17 21 1.12 +17 22 1.12 +17 23 1.12 +17 24 1.12 +17 25 1.12 +17 26 1.12 +17 27 1.12 +17 28 1.12 +17 29 1.12 +17 30 1.12 +17 31 1.12 +17 32 1.12 +17 33 1.12 +17 34 1.12 +17 35 1.12 +17 36 1.12 +17 37 1.12 +17 38 1.12 +17 39 1.12 +17 40 1.12 +17 41 1.12 +17 42 1.12 +17 43 1.12 +17 44 1.12 +17 45 1.12 +17 46 1.12 +17 47 1.12 +17 48 1.12 +17 49 1.12 +17 50 1.12 +17 51 1.12 +17 52 1.12 +17 53 1.12 +17 54 1.12 +17 55 1.12 +17 56 1.12 +17 57 1.12 +17 58 1.12 +17 59 1.12 +17 60 1.12 +17 61 1.12 +17 62 1.12 +17 63 1.12 +18 0 1.12 +18 1 1.12 +18 2 1.12 +18 3 1.12 +18 4 1.12 +18 5 1.12 +18 6 1.12 +18 7 1.12 +18 8 1.12 +18 9 1.12 +18 10 1.12 +18 11 1.12 +18 12 1.12 +18 13 1.12 +18 14 1.12 +18 15 1.12 +18 16 1.12 +18 17 1.12 +18 18 1.12 +18 19 1.12 +18 20 1.12 +18 21 1.12 +18 22 1.12 +18 23 1.12 +18 24 1.12 +18 25 1.12 +18 26 1.12 +18 27 1.12 +18 28 1.12 +18 29 1.12 +18 30 1.12 +18 31 1.12 +18 32 1.12 +18 33 1.12 +18 34 1.12 +18 35 1.12 +18 36 1.12 +18 37 1.12 +18 38 1.12 +18 39 1.12 +18 40 1.12 +18 41 1.12 +18 42 1.12 +18 43 1.12 +18 44 1.12 +18 45 1.12 +18 46 1.12 +18 47 1.12 +18 48 1.12 +18 49 1.12 +18 50 1.12 +18 51 1.12 +18 52 1.12 +18 53 1.12 +18 54 1.12 +18 55 1.12 +18 56 1.12 +18 57 1.12 +18 58 1.12 +18 59 1.12 +18 60 1.12 +18 61 1.12 +18 62 1.12 +18 63 1.12 +19 0 1.12 +19 1 1.12 +19 2 1.12 +19 3 1.12 +19 4 1.12 +19 5 1.12 +19 6 1.12 +19 7 1.12 +19 8 1.12 +19 9 1.12 +19 10 1.12 +19 11 1.12 +19 12 1.12 +19 13 1.12 +19 14 1.12 +19 15 1.12 +19 16 1.12 +19 17 1.12 +19 18 1.12 +19 19 1.12 +19 20 1.12 +19 21 1.12 +19 22 1.12 +19 23 1.12 +19 24 1.12 +19 25 1.12 +19 26 1.12 +19 27 1.12 +19 28 1.12 +19 29 1.12 +19 30 1.12 +19 31 1.12 +19 32 1.12 +19 33 1.12 +19 34 1.12 +19 35 1.12 +19 36 1.12 +19 37 1.12 +19 38 1.12 +19 39 1.12 +19 40 1.12 +19 41 1.12 +19 42 1.12 +19 43 1.12 +19 44 1.12 +19 45 1.12 +19 46 1.12 +19 47 1.12 +19 48 1.12 +19 49 1.12 +19 50 1.12 +19 51 1.12 +19 52 1.12 +19 53 1.12 +19 54 1.12 +19 55 1.12 +19 56 1.12 +19 57 1.12 +19 58 1.12 +19 59 1.12 +19 60 1.12 +19 61 1.12 +19 62 1.12 +19 63 1.12 +20 0 1.12 +20 1 1.12 +20 2 1.12 +20 3 1.12 +20 4 1.12 +20 5 1.12 +20 6 1.12 +20 7 1.12 +20 8 1.12 +20 9 1.12 +20 10 1.12 +20 11 1.12 +20 12 1.12 +20 13 1.12 +20 14 1.12 +20 15 1.12 +20 16 1.12 +20 17 1.12 +20 18 1.12 +20 19 1.12 +20 20 1.12 +20 21 1.12 +20 22 1.12 +20 23 1.12 +20 24 1.12 +20 25 1.12 +20 26 1.12 +20 27 1.12 +20 28 1.12 +20 29 1.12 +20 30 1.12 +20 31 1.12 +20 32 1.12 +20 33 1.12 +20 34 1.12 +20 35 1.12 +20 36 1.12 +20 37 1.12 +20 38 1.12 +20 39 1.12 +20 40 1.12 +20 41 1.12 +20 42 1.12 +20 43 1.12 +20 44 1.12 +20 45 1.12 +20 46 1.12 +20 47 1.12 +20 48 1.12 +20 49 1.12 +20 50 1.12 +20 51 1.12 +20 52 1.12 +20 53 1.12 +20 54 1.12 +20 55 1.12 +20 56 1.12 +20 57 1.12 +20 58 1.12 +20 59 1.12 +20 60 1.12 +20 61 1.12 +20 62 1.12 +20 63 1.12 +21 0 1.12 +21 1 1.12 +21 2 1.12 +21 3 1.12 +21 4 1.12 +21 5 1.12 +21 6 1.12 +21 7 1.12 +21 8 1.12 +21 9 1.12 +21 10 1.12 +21 11 1.12 +21 12 1.12 +21 13 1.12 +21 14 1.12 +21 15 1.12 +21 16 1.12 +21 17 1.12 +21 18 1.12 +21 19 1.12 +21 20 1.12 +21 21 1.12 +21 22 1.12 +21 23 1.12 +21 24 1.12 +21 25 1.12 +21 26 1.12 +21 27 1.12 +21 28 1.12 +21 29 1.12 +21 30 1.12 +21 31 1.12 +21 32 1.12 +21 33 1.12 +21 34 1.12 +21 35 1.12 +21 36 1.12 +21 37 1.12 +21 38 1.12 +21 39 1.12 +21 40 1.12 +21 41 1.12 +21 42 1.12 +21 43 1.12 +21 44 1.12 +21 45 1.12 +21 46 1.12 +21 47 1.12 +21 48 1.12 +21 49 1.12 +21 50 1.12 +21 51 1.12 +21 52 1.12 +21 53 1.12 +21 54 1.12 +21 55 1.12 +21 56 1.12 +21 57 1.12 +21 58 1.12 +21 59 1.12 +21 60 1.12 +21 61 1.12 +21 62 1.12 +21 63 1.12 +22 0 1.12 +22 1 1.12 +22 2 1.12 +22 3 1.12 +22 4 1.12 +22 5 1.12 +22 6 1.12 +22 7 1.12 +22 8 1.12 +22 9 1.12 +22 10 1.12 +22 11 1.12 +22 12 1.12 +22 13 1.12 +22 14 1.12 +22 15 1.12 +22 16 1.12 +22 17 1.12 +22 18 1.12 +22 19 1.12 +22 20 1.12 +22 21 1.12 +22 22 1.12 +22 23 1.12 +22 24 1.12 +22 25 1.12 +22 26 1.12 +22 27 1.12 +22 28 1.12 +22 29 1.12 +22 30 1.12 +22 31 1.12 +22 32 1.12 +22 33 1.12 +22 34 1.12 +22 35 1.12 +22 36 1.12 +22 37 1.12 +22 38 1.12 +22 39 1.12 +22 40 1.12 +22 41 1.12 +22 42 1.12 +22 43 1.12 +22 44 1.12 +22 45 1.12 +22 46 1.12 +22 47 1.12 +22 48 1.12 +22 49 1.12 +22 50 1.12 +22 51 1.12 +22 52 1.12 +22 53 1.12 +22 54 1.12 +22 55 1.12 +22 56 1.12 +22 57 1.12 +22 58 1.12 +22 59 1.12 +22 60 1.12 +22 61 1.12 +22 62 1.12 +22 63 1.12 +23 0 1.12 +23 1 1.12 +23 2 1.12 +23 3 1.12 +23 4 1.12 +23 5 1.12 +23 6 1.12 +23 7 1.12 +23 8 1.12 +23 9 1.12 +23 10 1.12 +23 11 1.12 +23 12 1.12 +23 13 1.12 +23 14 1.12 +23 15 1.12 +23 16 1.12 +23 17 1.12 +23 18 1.12 +23 19 1.12 +23 20 1.12 +23 21 1.12 +23 22 1.12 +23 23 1.12 +23 24 1.12 +23 25 1.12 +23 26 1.12 +23 27 1.12 +23 28 1.12 +23 29 1.12 +23 30 1.12 +23 31 1.12 +23 32 1.12 +23 33 1.12 +23 34 1.12 +23 35 1.12 +23 36 1.12 +23 37 1.12 +23 38 1.12 +23 39 1.12 +23 40 1.12 +23 41 1.12 +23 42 1.12 +23 43 1.12 +23 44 1.12 +23 45 1.12 +23 46 1.12 +23 47 1.12 +23 48 1.12 +23 49 1.12 +23 50 1.12 +23 51 1.12 +23 52 1.12 +23 53 1.12 +23 54 1.12 +23 55 1.12 +23 56 1.12 +23 57 1.12 +23 58 1.12 +23 59 1.12 +23 60 1.12 +23 61 1.12 +23 62 1.12 +23 63 1.12 diff --git a/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.22.txt b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.22.txt new file mode 100644 index 000000000..7138c4c00 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALIN_GainsCalib1.22.txt @@ -0,0 +1,1536 @@ +0 0 1.22 +0 1 1.22 +0 2 1.22 +0 3 1.22 +0 4 1.22 +0 5 1.22 +0 6 1.22 +0 7 1.22 +0 8 1.22 +0 9 1.22 +0 10 1.22 +0 11 1.22 +0 12 1.22 +0 13 1.22 +0 14 1.22 +0 15 1.22 +0 16 1.22 +0 17 1.22 +0 18 1.22 +0 19 1.22 +0 20 1.22 +0 21 1.22 +0 22 1.22 +0 23 1.22 +0 24 1.22 +0 25 1.22 +0 26 1.22 +0 27 1.22 +0 28 1.22 +0 29 1.22 +0 30 1.22 +0 31 1.22 +0 32 1.22 +0 33 1.22 +0 34 1.22 +0 35 1.22 +0 36 1.22 +0 37 1.22 +0 38 1.22 +0 39 1.22 +0 40 1.22 +0 41 1.22 +0 42 1.22 +0 43 1.22 +0 44 1.22 +0 45 1.22 +0 46 1.22 +0 47 1.22 +0 48 1.22 +0 49 1.22 +0 50 1.22 +0 51 1.22 +0 52 1.22 +0 53 1.22 +0 54 1.22 +0 55 1.22 +0 56 1.22 +0 57 1.22 +0 58 1.22 +0 59 1.22 +0 60 1.22 +0 61 1.22 +0 62 1.22 +0 63 1.22 +1 0 1.22 +1 1 1.22 +1 2 1.22 +1 3 1.22 +1 4 1.22 +1 5 1.22 +1 6 1.22 +1 7 1.22 +1 8 1.22 +1 9 1.22 +1 10 1.22 +1 11 1.22 +1 12 1.22 +1 13 1.22 +1 14 1.22 +1 15 1.22 +1 16 1.22 +1 17 1.22 +1 18 1.22 +1 19 1.22 +1 20 1.22 +1 21 1.22 +1 22 1.22 +1 23 1.22 +1 24 1.22 +1 25 1.22 +1 26 1.22 +1 27 1.22 +1 28 1.22 +1 29 1.22 +1 30 1.22 +1 31 1.22 +1 32 1.22 +1 33 1.22 +1 34 1.22 +1 35 1.22 +1 36 1.22 +1 37 1.22 +1 38 1.22 +1 39 1.22 +1 40 1.22 +1 41 1.22 +1 42 1.22 +1 43 1.22 +1 44 1.22 +1 45 1.22 +1 46 1.22 +1 47 1.22 +1 48 1.22 +1 49 1.22 +1 50 1.22 +1 51 1.22 +1 52 1.22 +1 53 1.22 +1 54 1.22 +1 55 1.22 +1 56 1.22 +1 57 1.22 +1 58 1.22 +1 59 1.22 +1 60 1.22 +1 61 1.22 +1 62 1.22 +1 63 1.22 +2 0 1.22 +2 1 1.22 +2 2 1.22 +2 3 1.22 +2 4 1.22 +2 5 1.22 +2 6 1.22 +2 7 1.22 +2 8 1.22 +2 9 1.22 +2 10 1.22 +2 11 1.22 +2 12 1.22 +2 13 1.22 +2 14 1.22 +2 15 1.22 +2 16 1.22 +2 17 1.22 +2 18 1.22 +2 19 1.22 +2 20 1.22 +2 21 1.22 +2 22 1.22 +2 23 1.22 +2 24 1.22 +2 25 1.22 +2 26 1.22 +2 27 1.22 +2 28 1.22 +2 29 1.22 +2 30 1.22 +2 31 1.22 +2 32 1.22 +2 33 1.22 +2 34 1.22 +2 35 1.22 +2 36 1.22 +2 37 1.22 +2 38 1.22 +2 39 1.22 +2 40 1.22 +2 41 1.22 +2 42 1.22 +2 43 1.22 +2 44 1.22 +2 45 1.22 +2 46 1.22 +2 47 1.22 +2 48 1.22 +2 49 1.22 +2 50 1.22 +2 51 1.22 +2 52 1.22 +2 53 1.22 +2 54 1.22 +2 55 1.22 +2 56 1.22 +2 57 1.22 +2 58 1.22 +2 59 1.22 +2 60 1.22 +2 61 1.22 +2 62 1.22 +2 63 1.22 +3 0 1.22 +3 1 1.22 +3 2 1.22 +3 3 1.22 +3 4 1.22 +3 5 1.22 +3 6 1.22 +3 7 1.22 +3 8 1.22 +3 9 1.22 +3 10 1.22 +3 11 1.22 +3 12 1.22 +3 13 1.22 +3 14 1.22 +3 15 1.22 +3 16 1.22 +3 17 1.22 +3 18 1.22 +3 19 1.22 +3 20 1.22 +3 21 1.22 +3 22 1.22 +3 23 1.22 +3 24 1.22 +3 25 1.22 +3 26 1.22 +3 27 1.22 +3 28 1.22 +3 29 1.22 +3 30 1.22 +3 31 1.22 +3 32 1.22 +3 33 1.22 +3 34 1.22 +3 35 1.22 +3 36 1.22 +3 37 1.22 +3 38 1.22 +3 39 1.22 +3 40 1.22 +3 41 1.22 +3 42 1.22 +3 43 1.22 +3 44 1.22 +3 45 1.22 +3 46 1.22 +3 47 1.22 +3 48 1.22 +3 49 1.22 +3 50 1.22 +3 51 1.22 +3 52 1.22 +3 53 1.22 +3 54 1.22 +3 55 1.22 +3 56 1.22 +3 57 1.22 +3 58 1.22 +3 59 1.22 +3 60 1.22 +3 61 1.22 +3 62 1.22 +3 63 1.22 +4 0 1.22 +4 1 1.22 +4 2 1.22 +4 3 1.22 +4 4 1.22 +4 5 1.22 +4 6 1.22 +4 7 1.22 +4 8 1.22 +4 9 1.22 +4 10 1.22 +4 11 1.22 +4 12 1.22 +4 13 1.22 +4 14 1.22 +4 15 1.22 +4 16 1.22 +4 17 1.22 +4 18 1.22 +4 19 1.22 +4 20 1.22 +4 21 1.22 +4 22 1.22 +4 23 1.22 +4 24 1.22 +4 25 1.22 +4 26 1.22 +4 27 1.22 +4 28 1.22 +4 29 1.22 +4 30 1.22 +4 31 1.22 +4 32 1.22 +4 33 1.22 +4 34 1.22 +4 35 1.22 +4 36 1.22 +4 37 1.22 +4 38 1.22 +4 39 1.22 +4 40 1.22 +4 41 1.22 +4 42 1.22 +4 43 1.22 +4 44 1.22 +4 45 1.22 +4 46 1.22 +4 47 1.22 +4 48 1.22 +4 49 1.22 +4 50 1.22 +4 51 1.22 +4 52 1.22 +4 53 1.22 +4 54 1.22 +4 55 1.22 +4 56 1.22 +4 57 1.22 +4 58 1.22 +4 59 1.22 +4 60 1.22 +4 61 1.22 +4 62 1.22 +4 63 1.22 +5 0 1.22 +5 1 1.22 +5 2 1.22 +5 3 1.22 +5 4 1.22 +5 5 1.22 +5 6 1.22 +5 7 1.22 +5 8 1.22 +5 9 1.22 +5 10 1.22 +5 11 1.22 +5 12 1.22 +5 13 1.22 +5 14 1.22 +5 15 1.22 +5 16 1.22 +5 17 1.22 +5 18 1.22 +5 19 1.22 +5 20 1.22 +5 21 1.22 +5 22 1.22 +5 23 1.22 +5 24 1.22 +5 25 1.22 +5 26 1.22 +5 27 1.22 +5 28 1.22 +5 29 1.22 +5 30 1.22 +5 31 1.22 +5 32 1.22 +5 33 1.22 +5 34 1.22 +5 35 1.22 +5 36 1.22 +5 37 1.22 +5 38 1.22 +5 39 1.22 +5 40 1.22 +5 41 1.22 +5 42 1.22 +5 43 1.22 +5 44 1.22 +5 45 1.22 +5 46 1.22 +5 47 1.22 +5 48 1.22 +5 49 1.22 +5 50 1.22 +5 51 1.22 +5 52 1.22 +5 53 1.22 +5 54 1.22 +5 55 1.22 +5 56 1.22 +5 57 1.22 +5 58 1.22 +5 59 1.22 +5 60 1.22 +5 61 1.22 +5 62 1.22 +5 63 1.22 +6 0 1.22 +6 1 1.22 +6 2 1.22 +6 3 1.22 +6 4 1.22 +6 5 1.22 +6 6 1.22 +6 7 1.22 +6 8 1.22 +6 9 1.22 +6 10 1.22 +6 11 1.22 +6 12 1.22 +6 13 1.22 +6 14 1.22 +6 15 1.22 +6 16 1.22 +6 17 1.22 +6 18 1.22 +6 19 1.22 +6 20 1.22 +6 21 1.22 +6 22 1.22 +6 23 1.22 +6 24 1.22 +6 25 1.22 +6 26 1.22 +6 27 1.22 +6 28 1.22 +6 29 1.22 +6 30 1.22 +6 31 1.22 +6 32 1.22 +6 33 1.22 +6 34 1.22 +6 35 1.22 +6 36 1.22 +6 37 1.22 +6 38 1.22 +6 39 1.22 +6 40 1.22 +6 41 1.22 +6 42 1.22 +6 43 1.22 +6 44 1.22 +6 45 1.22 +6 46 1.22 +6 47 1.22 +6 48 1.22 +6 49 1.22 +6 50 1.22 +6 51 1.22 +6 52 1.22 +6 53 1.22 +6 54 1.22 +6 55 1.22 +6 56 1.22 +6 57 1.22 +6 58 1.22 +6 59 1.22 +6 60 1.22 +6 61 1.22 +6 62 1.22 +6 63 1.22 +7 0 1.22 +7 1 1.22 +7 2 1.22 +7 3 1.22 +7 4 1.22 +7 5 1.22 +7 6 1.22 +7 7 1.22 +7 8 1.22 +7 9 1.22 +7 10 1.22 +7 11 1.22 +7 12 1.22 +7 13 1.22 +7 14 1.22 +7 15 1.22 +7 16 1.22 +7 17 1.22 +7 18 1.22 +7 19 1.22 +7 20 1.22 +7 21 1.22 +7 22 1.22 +7 23 1.22 +7 24 1.22 +7 25 1.22 +7 26 1.22 +7 27 1.22 +7 28 1.22 +7 29 1.22 +7 30 1.22 +7 31 1.22 +7 32 1.22 +7 33 1.22 +7 34 1.22 +7 35 1.22 +7 36 1.22 +7 37 1.22 +7 38 1.22 +7 39 1.22 +7 40 1.22 +7 41 1.22 +7 42 1.22 +7 43 1.22 +7 44 1.22 +7 45 1.22 +7 46 1.22 +7 47 1.22 +7 48 1.22 +7 49 1.22 +7 50 1.22 +7 51 1.22 +7 52 1.22 +7 53 1.22 +7 54 1.22 +7 55 1.22 +7 56 1.22 +7 57 1.22 +7 58 1.22 +7 59 1.22 +7 60 1.22 +7 61 1.22 +7 62 1.22 +7 63 1.22 +8 0 1.22 +8 1 1.22 +8 2 1.22 +8 3 1.22 +8 4 1.22 +8 5 1.22 +8 6 1.22 +8 7 1.22 +8 8 1.22 +8 9 1.22 +8 10 1.22 +8 11 1.22 +8 12 1.22 +8 13 1.22 +8 14 1.22 +8 15 1.22 +8 16 1.22 +8 17 1.22 +8 18 1.22 +8 19 1.22 +8 20 1.22 +8 21 1.22 +8 22 1.22 +8 23 1.22 +8 24 1.22 +8 25 1.22 +8 26 1.22 +8 27 1.22 +8 28 1.22 +8 29 1.22 +8 30 1.22 +8 31 1.22 +8 32 1.22 +8 33 1.22 +8 34 1.22 +8 35 1.22 +8 36 1.22 +8 37 1.22 +8 38 1.22 +8 39 1.22 +8 40 1.22 +8 41 1.22 +8 42 1.22 +8 43 1.22 +8 44 1.22 +8 45 1.22 +8 46 1.22 +8 47 1.22 +8 48 1.22 +8 49 1.22 +8 50 1.22 +8 51 1.22 +8 52 1.22 +8 53 1.22 +8 54 1.22 +8 55 1.22 +8 56 1.22 +8 57 1.22 +8 58 1.22 +8 59 1.22 +8 60 1.22 +8 61 1.22 +8 62 1.22 +8 63 1.22 +9 0 1.22 +9 1 1.22 +9 2 1.22 +9 3 1.22 +9 4 1.22 +9 5 1.22 +9 6 1.22 +9 7 1.22 +9 8 1.22 +9 9 1.22 +9 10 1.22 +9 11 1.22 +9 12 1.22 +9 13 1.22 +9 14 1.22 +9 15 1.22 +9 16 1.22 +9 17 1.22 +9 18 1.22 +9 19 1.22 +9 20 1.22 +9 21 1.22 +9 22 1.22 +9 23 1.22 +9 24 1.22 +9 25 1.22 +9 26 1.22 +9 27 1.22 +9 28 1.22 +9 29 1.22 +9 30 1.22 +9 31 1.22 +9 32 1.22 +9 33 1.22 +9 34 1.22 +9 35 1.22 +9 36 1.22 +9 37 1.22 +9 38 1.22 +9 39 1.22 +9 40 1.22 +9 41 1.22 +9 42 1.22 +9 43 1.22 +9 44 1.22 +9 45 1.22 +9 46 1.22 +9 47 1.22 +9 48 1.22 +9 49 1.22 +9 50 1.22 +9 51 1.22 +9 52 1.22 +9 53 1.22 +9 54 1.22 +9 55 1.22 +9 56 1.22 +9 57 1.22 +9 58 1.22 +9 59 1.22 +9 60 1.22 +9 61 1.22 +9 62 1.22 +9 63 1.22 +10 0 1.22 +10 1 1.22 +10 2 1.22 +10 3 1.22 +10 4 1.22 +10 5 1.22 +10 6 1.22 +10 7 1.22 +10 8 1.22 +10 9 1.22 +10 10 1.22 +10 11 1.22 +10 12 1.22 +10 13 1.22 +10 14 1.22 +10 15 1.22 +10 16 1.22 +10 17 1.22 +10 18 1.22 +10 19 1.22 +10 20 1.22 +10 21 1.22 +10 22 1.22 +10 23 1.22 +10 24 1.22 +10 25 1.22 +10 26 1.22 +10 27 1.22 +10 28 1.22 +10 29 1.22 +10 30 1.22 +10 31 1.22 +10 32 1.22 +10 33 1.22 +10 34 1.22 +10 35 1.22 +10 36 1.22 +10 37 1.22 +10 38 1.22 +10 39 1.22 +10 40 1.22 +10 41 1.22 +10 42 1.22 +10 43 1.22 +10 44 1.22 +10 45 1.22 +10 46 1.22 +10 47 1.22 +10 48 1.22 +10 49 1.22 +10 50 1.22 +10 51 1.22 +10 52 1.22 +10 53 1.22 +10 54 1.22 +10 55 1.22 +10 56 1.22 +10 57 1.22 +10 58 1.22 +10 59 1.22 +10 60 1.22 +10 61 1.22 +10 62 1.22 +10 63 1.22 +11 0 1.22 +11 1 1.22 +11 2 1.22 +11 3 1.22 +11 4 1.22 +11 5 1.22 +11 6 1.22 +11 7 1.22 +11 8 1.22 +11 9 1.22 +11 10 1.22 +11 11 1.22 +11 12 1.22 +11 13 1.22 +11 14 1.22 +11 15 1.22 +11 16 1.22 +11 17 1.22 +11 18 1.22 +11 19 1.22 +11 20 1.22 +11 21 1.22 +11 22 1.22 +11 23 1.22 +11 24 1.22 +11 25 1.22 +11 26 1.22 +11 27 1.22 +11 28 1.22 +11 29 1.22 +11 30 1.22 +11 31 1.22 +11 32 1.22 +11 33 1.22 +11 34 1.22 +11 35 1.22 +11 36 1.22 +11 37 1.22 +11 38 1.22 +11 39 1.22 +11 40 1.22 +11 41 1.22 +11 42 1.22 +11 43 1.22 +11 44 1.22 +11 45 1.22 +11 46 1.22 +11 47 1.22 +11 48 1.22 +11 49 1.22 +11 50 1.22 +11 51 1.22 +11 52 1.22 +11 53 1.22 +11 54 1.22 +11 55 1.22 +11 56 1.22 +11 57 1.22 +11 58 1.22 +11 59 1.22 +11 60 1.22 +11 61 1.22 +11 62 1.22 +11 63 1.22 +12 0 1.22 +12 1 1.22 +12 2 1.22 +12 3 1.22 +12 4 1.22 +12 5 1.22 +12 6 1.22 +12 7 1.22 +12 8 1.22 +12 9 1.22 +12 10 1.22 +12 11 1.22 +12 12 1.22 +12 13 1.22 +12 14 1.22 +12 15 1.22 +12 16 1.22 +12 17 1.22 +12 18 1.22 +12 19 1.22 +12 20 1.22 +12 21 1.22 +12 22 1.22 +12 23 1.22 +12 24 1.22 +12 25 1.22 +12 26 1.22 +12 27 1.22 +12 28 1.22 +12 29 1.22 +12 30 1.22 +12 31 1.22 +12 32 1.22 +12 33 1.22 +12 34 1.22 +12 35 1.22 +12 36 1.22 +12 37 1.22 +12 38 1.22 +12 39 1.22 +12 40 1.22 +12 41 1.22 +12 42 1.22 +12 43 1.22 +12 44 1.22 +12 45 1.22 +12 46 1.22 +12 47 1.22 +12 48 1.22 +12 49 1.22 +12 50 1.22 +12 51 1.22 +12 52 1.22 +12 53 1.22 +12 54 1.22 +12 55 1.22 +12 56 1.22 +12 57 1.22 +12 58 1.22 +12 59 1.22 +12 60 1.22 +12 61 1.22 +12 62 1.22 +12 63 1.22 +13 0 1.22 +13 1 1.22 +13 2 1.22 +13 3 1.22 +13 4 1.22 +13 5 1.22 +13 6 1.22 +13 7 1.22 +13 8 1.22 +13 9 1.22 +13 10 1.22 +13 11 1.22 +13 12 1.22 +13 13 1.22 +13 14 1.22 +13 15 1.22 +13 16 1.22 +13 17 1.22 +13 18 1.22 +13 19 1.22 +13 20 1.22 +13 21 1.22 +13 22 1.22 +13 23 1.22 +13 24 1.22 +13 25 1.22 +13 26 1.22 +13 27 1.22 +13 28 1.22 +13 29 1.22 +13 30 1.22 +13 31 1.22 +13 32 1.22 +13 33 1.22 +13 34 1.22 +13 35 1.22 +13 36 1.22 +13 37 1.22 +13 38 1.22 +13 39 1.22 +13 40 1.22 +13 41 1.22 +13 42 1.22 +13 43 1.22 +13 44 1.22 +13 45 1.22 +13 46 1.22 +13 47 1.22 +13 48 1.22 +13 49 1.22 +13 50 1.22 +13 51 1.22 +13 52 1.22 +13 53 1.22 +13 54 1.22 +13 55 1.22 +13 56 1.22 +13 57 1.22 +13 58 1.22 +13 59 1.22 +13 60 1.22 +13 61 1.22 +13 62 1.22 +13 63 1.22 +14 0 1.22 +14 1 1.22 +14 2 1.22 +14 3 1.22 +14 4 1.22 +14 5 1.22 +14 6 1.22 +14 7 1.22 +14 8 1.22 +14 9 1.22 +14 10 1.22 +14 11 1.22 +14 12 1.22 +14 13 1.22 +14 14 1.22 +14 15 1.22 +14 16 1.22 +14 17 1.22 +14 18 1.22 +14 19 1.22 +14 20 1.22 +14 21 1.22 +14 22 1.22 +14 23 1.22 +14 24 1.22 +14 25 1.22 +14 26 1.22 +14 27 1.22 +14 28 1.22 +14 29 1.22 +14 30 1.22 +14 31 1.22 +14 32 1.22 +14 33 1.22 +14 34 1.22 +14 35 1.22 +14 36 1.22 +14 37 1.22 +14 38 1.22 +14 39 1.22 +14 40 1.22 +14 41 1.22 +14 42 1.22 +14 43 1.22 +14 44 1.22 +14 45 1.22 +14 46 1.22 +14 47 1.22 +14 48 1.22 +14 49 1.22 +14 50 1.22 +14 51 1.22 +14 52 1.22 +14 53 1.22 +14 54 1.22 +14 55 1.22 +14 56 1.22 +14 57 1.22 +14 58 1.22 +14 59 1.22 +14 60 1.22 +14 61 1.22 +14 62 1.22 +14 63 1.22 +15 0 1.22 +15 1 1.22 +15 2 1.22 +15 3 1.22 +15 4 1.22 +15 5 1.22 +15 6 1.22 +15 7 1.22 +15 8 1.22 +15 9 1.22 +15 10 1.22 +15 11 1.22 +15 12 1.22 +15 13 1.22 +15 14 1.22 +15 15 1.22 +15 16 1.22 +15 17 1.22 +15 18 1.22 +15 19 1.22 +15 20 1.22 +15 21 1.22 +15 22 1.22 +15 23 1.22 +15 24 1.22 +15 25 1.22 +15 26 1.22 +15 27 1.22 +15 28 1.22 +15 29 1.22 +15 30 1.22 +15 31 1.22 +15 32 1.22 +15 33 1.22 +15 34 1.22 +15 35 1.22 +15 36 1.22 +15 37 1.22 +15 38 1.22 +15 39 1.22 +15 40 1.22 +15 41 1.22 +15 42 1.22 +15 43 1.22 +15 44 1.22 +15 45 1.22 +15 46 1.22 +15 47 1.22 +15 48 1.22 +15 49 1.22 +15 50 1.22 +15 51 1.22 +15 52 1.22 +15 53 1.22 +15 54 1.22 +15 55 1.22 +15 56 1.22 +15 57 1.22 +15 58 1.22 +15 59 1.22 +15 60 1.22 +15 61 1.22 +15 62 1.22 +15 63 1.22 +16 0 1.22 +16 1 1.22 +16 2 1.22 +16 3 1.22 +16 4 1.22 +16 5 1.22 +16 6 1.22 +16 7 1.22 +16 8 1.22 +16 9 1.22 +16 10 1.22 +16 11 1.22 +16 12 1.22 +16 13 1.22 +16 14 1.22 +16 15 1.22 +16 16 1.22 +16 17 1.22 +16 18 1.22 +16 19 1.22 +16 20 1.22 +16 21 1.22 +16 22 1.22 +16 23 1.22 +16 24 1.22 +16 25 1.22 +16 26 1.22 +16 27 1.22 +16 28 1.22 +16 29 1.22 +16 30 1.22 +16 31 1.22 +16 32 1.22 +16 33 1.22 +16 34 1.22 +16 35 1.22 +16 36 1.22 +16 37 1.22 +16 38 1.22 +16 39 1.22 +16 40 1.22 +16 41 1.22 +16 42 1.22 +16 43 1.22 +16 44 1.22 +16 45 1.22 +16 46 1.22 +16 47 1.22 +16 48 1.22 +16 49 1.22 +16 50 1.22 +16 51 1.22 +16 52 1.22 +16 53 1.22 +16 54 1.22 +16 55 1.22 +16 56 1.22 +16 57 1.22 +16 58 1.22 +16 59 1.22 +16 60 1.22 +16 61 1.22 +16 62 1.22 +16 63 1.22 +17 0 1.22 +17 1 1.22 +17 2 1.22 +17 3 1.22 +17 4 1.22 +17 5 1.22 +17 6 1.22 +17 7 1.22 +17 8 1.22 +17 9 1.22 +17 10 1.22 +17 11 1.22 +17 12 1.22 +17 13 1.22 +17 14 1.22 +17 15 1.22 +17 16 1.22 +17 17 1.22 +17 18 1.22 +17 19 1.22 +17 20 1.22 +17 21 1.22 +17 22 1.22 +17 23 1.22 +17 24 1.22 +17 25 1.22 +17 26 1.22 +17 27 1.22 +17 28 1.22 +17 29 1.22 +17 30 1.22 +17 31 1.22 +17 32 1.22 +17 33 1.22 +17 34 1.22 +17 35 1.22 +17 36 1.22 +17 37 1.22 +17 38 1.22 +17 39 1.22 +17 40 1.22 +17 41 1.22 +17 42 1.22 +17 43 1.22 +17 44 1.22 +17 45 1.22 +17 46 1.22 +17 47 1.22 +17 48 1.22 +17 49 1.22 +17 50 1.22 +17 51 1.22 +17 52 1.22 +17 53 1.22 +17 54 1.22 +17 55 1.22 +17 56 1.22 +17 57 1.22 +17 58 1.22 +17 59 1.22 +17 60 1.22 +17 61 1.22 +17 62 1.22 +17 63 1.22 +18 0 1.22 +18 1 1.22 +18 2 1.22 +18 3 1.22 +18 4 1.22 +18 5 1.22 +18 6 1.22 +18 7 1.22 +18 8 1.22 +18 9 1.22 +18 10 1.22 +18 11 1.22 +18 12 1.22 +18 13 1.22 +18 14 1.22 +18 15 1.22 +18 16 1.22 +18 17 1.22 +18 18 1.22 +18 19 1.22 +18 20 1.22 +18 21 1.22 +18 22 1.22 +18 23 1.22 +18 24 1.22 +18 25 1.22 +18 26 1.22 +18 27 1.22 +18 28 1.22 +18 29 1.22 +18 30 1.22 +18 31 1.22 +18 32 1.22 +18 33 1.22 +18 34 1.22 +18 35 1.22 +18 36 1.22 +18 37 1.22 +18 38 1.22 +18 39 1.22 +18 40 1.22 +18 41 1.22 +18 42 1.22 +18 43 1.22 +18 44 1.22 +18 45 1.22 +18 46 1.22 +18 47 1.22 +18 48 1.22 +18 49 1.22 +18 50 1.22 +18 51 1.22 +18 52 1.22 +18 53 1.22 +18 54 1.22 +18 55 1.22 +18 56 1.22 +18 57 1.22 +18 58 1.22 +18 59 1.22 +18 60 1.22 +18 61 1.22 +18 62 1.22 +18 63 1.22 +19 0 1.22 +19 1 1.22 +19 2 1.22 +19 3 1.22 +19 4 1.22 +19 5 1.22 +19 6 1.22 +19 7 1.22 +19 8 1.22 +19 9 1.22 +19 10 1.22 +19 11 1.22 +19 12 1.22 +19 13 1.22 +19 14 1.22 +19 15 1.22 +19 16 1.22 +19 17 1.22 +19 18 1.22 +19 19 1.22 +19 20 1.22 +19 21 1.22 +19 22 1.22 +19 23 1.22 +19 24 1.22 +19 25 1.22 +19 26 1.22 +19 27 1.22 +19 28 1.22 +19 29 1.22 +19 30 1.22 +19 31 1.22 +19 32 1.22 +19 33 1.22 +19 34 1.22 +19 35 1.22 +19 36 1.22 +19 37 1.22 +19 38 1.22 +19 39 1.22 +19 40 1.22 +19 41 1.22 +19 42 1.22 +19 43 1.22 +19 44 1.22 +19 45 1.22 +19 46 1.22 +19 47 1.22 +19 48 1.22 +19 49 1.22 +19 50 1.22 +19 51 1.22 +19 52 1.22 +19 53 1.22 +19 54 1.22 +19 55 1.22 +19 56 1.22 +19 57 1.22 +19 58 1.22 +19 59 1.22 +19 60 1.22 +19 61 1.22 +19 62 1.22 +19 63 1.22 +20 0 1.22 +20 1 1.22 +20 2 1.22 +20 3 1.22 +20 4 1.22 +20 5 1.22 +20 6 1.22 +20 7 1.22 +20 8 1.22 +20 9 1.22 +20 10 1.22 +20 11 1.22 +20 12 1.22 +20 13 1.22 +20 14 1.22 +20 15 1.22 +20 16 1.22 +20 17 1.22 +20 18 1.22 +20 19 1.22 +20 20 1.22 +20 21 1.22 +20 22 1.22 +20 23 1.22 +20 24 1.22 +20 25 1.22 +20 26 1.22 +20 27 1.22 +20 28 1.22 +20 29 1.22 +20 30 1.22 +20 31 1.22 +20 32 1.22 +20 33 1.22 +20 34 1.22 +20 35 1.22 +20 36 1.22 +20 37 1.22 +20 38 1.22 +20 39 1.22 +20 40 1.22 +20 41 1.22 +20 42 1.22 +20 43 1.22 +20 44 1.22 +20 45 1.22 +20 46 1.22 +20 47 1.22 +20 48 1.22 +20 49 1.22 +20 50 1.22 +20 51 1.22 +20 52 1.22 +20 53 1.22 +20 54 1.22 +20 55 1.22 +20 56 1.22 +20 57 1.22 +20 58 1.22 +20 59 1.22 +20 60 1.22 +20 61 1.22 +20 62 1.22 +20 63 1.22 +21 0 1.22 +21 1 1.22 +21 2 1.22 +21 3 1.22 +21 4 1.22 +21 5 1.22 +21 6 1.22 +21 7 1.22 +21 8 1.22 +21 9 1.22 +21 10 1.22 +21 11 1.22 +21 12 1.22 +21 13 1.22 +21 14 1.22 +21 15 1.22 +21 16 1.22 +21 17 1.22 +21 18 1.22 +21 19 1.22 +21 20 1.22 +21 21 1.22 +21 22 1.22 +21 23 1.22 +21 24 1.22 +21 25 1.22 +21 26 1.22 +21 27 1.22 +21 28 1.22 +21 29 1.22 +21 30 1.22 +21 31 1.22 +21 32 1.22 +21 33 1.22 +21 34 1.22 +21 35 1.22 +21 36 1.22 +21 37 1.22 +21 38 1.22 +21 39 1.22 +21 40 1.22 +21 41 1.22 +21 42 1.22 +21 43 1.22 +21 44 1.22 +21 45 1.22 +21 46 1.22 +21 47 1.22 +21 48 1.22 +21 49 1.22 +21 50 1.22 +21 51 1.22 +21 52 1.22 +21 53 1.22 +21 54 1.22 +21 55 1.22 +21 56 1.22 +21 57 1.22 +21 58 1.22 +21 59 1.22 +21 60 1.22 +21 61 1.22 +21 62 1.22 +21 63 1.22 +22 0 1.22 +22 1 1.22 +22 2 1.22 +22 3 1.22 +22 4 1.22 +22 5 1.22 +22 6 1.22 +22 7 1.22 +22 8 1.22 +22 9 1.22 +22 10 1.22 +22 11 1.22 +22 12 1.22 +22 13 1.22 +22 14 1.22 +22 15 1.22 +22 16 1.22 +22 17 1.22 +22 18 1.22 +22 19 1.22 +22 20 1.22 +22 21 1.22 +22 22 1.22 +22 23 1.22 +22 24 1.22 +22 25 1.22 +22 26 1.22 +22 27 1.22 +22 28 1.22 +22 29 1.22 +22 30 1.22 +22 31 1.22 +22 32 1.22 +22 33 1.22 +22 34 1.22 +22 35 1.22 +22 36 1.22 +22 37 1.22 +22 38 1.22 +22 39 1.22 +22 40 1.22 +22 41 1.22 +22 42 1.22 +22 43 1.22 +22 44 1.22 +22 45 1.22 +22 46 1.22 +22 47 1.22 +22 48 1.22 +22 49 1.22 +22 50 1.22 +22 51 1.22 +22 52 1.22 +22 53 1.22 +22 54 1.22 +22 55 1.22 +22 56 1.22 +22 57 1.22 +22 58 1.22 +22 59 1.22 +22 60 1.22 +22 61 1.22 +22 62 1.22 +22 63 1.22 +23 0 1.22 +23 1 1.22 +23 2 1.22 +23 3 1.22 +23 4 1.22 +23 5 1.22 +23 6 1.22 +23 7 1.22 +23 8 1.22 +23 9 1.22 +23 10 1.22 +23 11 1.22 +23 12 1.22 +23 13 1.22 +23 14 1.22 +23 15 1.22 +23 16 1.22 +23 17 1.22 +23 18 1.22 +23 19 1.22 +23 20 1.22 +23 21 1.22 +23 22 1.22 +23 23 1.22 +23 24 1.22 +23 25 1.22 +23 26 1.22 +23 27 1.22 +23 28 1.22 +23 29 1.22 +23 30 1.22 +23 31 1.22 +23 32 1.22 +23 33 1.22 +23 34 1.22 +23 35 1.22 +23 36 1.22 +23 37 1.22 +23 38 1.22 +23 39 1.22 +23 40 1.22 +23 41 1.22 +23 42 1.22 +23 43 1.22 +23 44 1.22 +23 45 1.22 +23 46 1.22 +23 47 1.22 +23 48 1.22 +23 49 1.22 +23 50 1.22 +23 51 1.22 +23 52 1.22 +23 53 1.22 +23 54 1.22 +23 55 1.22 +23 56 1.22 +23 57 1.22 +23 58 1.22 +23 59 1.22 +23 60 1.22 +23 61 1.22 +23 62 1.22 +23 63 1.22 diff --git a/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt new file mode 100644 index 000000000..aba66f7cb --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt @@ -0,0 +1,1536 @@ +0 0 1.0 +0 1 1.0 +0 2 1.0 +0 3 1.0 +0 4 1.0 +0 5 1.0 +0 6 1.0 +0 7 1.0 +0 8 1.0 +0 9 1.0 +0 10 1.0 +0 11 1.0 +0 12 1.0 +0 13 1.0 +0 14 1.0 +0 15 1.0 +0 16 1.0 +0 17 1.0 +0 18 1.0 +0 19 1.0 +0 20 1.0 +0 21 1.0 +0 22 1.0 +0 23 1.0 +0 24 1.0 +0 25 1.0 +0 26 1.0 +0 27 1.0 +0 28 1.0 +0 29 1.0 +0 30 1.0 +0 31 1.0 +0 32 1.0 +0 33 1.0 +0 34 1.0 +0 35 1.0 +0 36 1.0 +0 37 1.0 +0 38 1.0 +0 39 1.0 +0 40 1.0 +0 41 1.0 +0 42 1.0 +0 43 1.0 +0 44 1.0 +0 45 1.0 +0 46 1.0 +0 47 1.0 +0 48 1.0 +0 49 1.0 +0 50 1.0 +0 51 1.0 +0 52 1.0 +0 53 1.0 +0 54 1.0 +0 55 1.0 +0 56 1.0 +0 57 1.0 +0 58 1.0 +0 59 1.0 +0 60 1.0 +0 61 1.0 +0 62 1.0 +0 63 1.0 +1 0 1.0 +1 1 1.0 +1 2 1.0 +1 3 1.0 +1 4 1.0 +1 5 1.0 +1 6 1.0 +1 7 1.0 +1 8 1.0 +1 9 1.0 +1 10 1.0 +1 11 1.0 +1 12 1.0 +1 13 1.0 +1 14 1.0 +1 15 1.0 +1 16 1.0 +1 17 1.0 +1 18 1.0 +1 19 1.0 +1 20 1.0 +1 21 1.0 +1 22 1.0 +1 23 1.0 +1 24 1.0 +1 25 1.0 +1 26 1.0 +1 27 1.0 +1 28 1.0 +1 29 1.0 +1 30 1.0 +1 31 1.0 +1 32 1.0 +1 33 1.0 +1 34 1.0 +1 35 1.0 +1 36 1.0 +1 37 1.0 +1 38 1.0 +1 39 1.0 +1 40 1.0 +1 41 1.0 +1 42 1.0 +1 43 1.0 +1 44 1.0 +1 45 1.0 +1 46 1.0 +1 47 1.0 +1 48 1.0 +1 49 1.0 +1 50 1.0 +1 51 1.0 +1 52 1.0 +1 53 1.0 +1 54 1.0 +1 55 1.0 +1 56 1.0 +1 57 1.0 +1 58 1.0 +1 59 1.0 +1 60 1.0 +1 61 1.0 +1 62 1.0 +1 63 1.0 +2 0 1.0 +2 1 1.0 +2 2 1.0 +2 3 1.0 +2 4 1.0 +2 5 1.0 +2 6 1.0 +2 7 1.0 +2 8 1.0 +2 9 1.0 +2 10 1.0 +2 11 1.0 +2 12 1.0 +2 13 1.0 +2 14 1.0 +2 15 1.0 +2 16 1.0 +2 17 1.0 +2 18 1.0 +2 19 1.0 +2 20 1.0 +2 21 1.0 +2 22 1.0 +2 23 1.0 +2 24 1.0 +2 25 1.0 +2 26 1.0 +2 27 1.0 +2 28 1.0 +2 29 1.0 +2 30 1.0 +2 31 1.0 +2 32 1.0 +2 33 1.0 +2 34 1.0 +2 35 1.0 +2 36 1.0 +2 37 1.0 +2 38 1.0 +2 39 1.0 +2 40 1.0 +2 41 1.0 +2 42 1.0 +2 43 1.0 +2 44 1.0 +2 45 1.0 +2 46 1.0 +2 47 1.0 +2 48 1.0 +2 49 1.0 +2 50 1.0 +2 51 1.0 +2 52 1.0 +2 53 1.0 +2 54 1.0 +2 55 1.0 +2 56 1.0 +2 57 1.0 +2 58 1.0 +2 59 1.0 +2 60 1.0 +2 61 1.0 +2 62 1.0 +2 63 1.0 +3 0 1.0 +3 1 1.0 +3 2 1.0 +3 3 1.0 +3 4 1.0 +3 5 1.0 +3 6 1.0 +3 7 1.0 +3 8 1.0 +3 9 1.0 +3 10 1.0 +3 11 1.0 +3 12 1.0 +3 13 1.0 +3 14 1.0 +3 15 1.0 +3 16 1.0 +3 17 1.0 +3 18 1.0 +3 19 1.0 +3 20 1.0 +3 21 1.0 +3 22 1.0 +3 23 1.0 +3 24 1.0 +3 25 1.0 +3 26 1.0 +3 27 1.0 +3 28 1.0 +3 29 1.0 +3 30 1.0 +3 31 1.0 +3 32 1.0 +3 33 1.0 +3 34 1.0 +3 35 1.0 +3 36 1.0 +3 37 1.0 +3 38 1.0 +3 39 1.0 +3 40 1.0 +3 41 1.0 +3 42 1.0 +3 43 1.0 +3 44 1.0 +3 45 1.0 +3 46 1.0 +3 47 1.0 +3 48 1.0 +3 49 1.0 +3 50 1.0 +3 51 1.0 +3 52 1.0 +3 53 1.0 +3 54 1.0 +3 55 1.0 +3 56 1.0 +3 57 1.0 +3 58 1.0 +3 59 1.0 +3 60 1.0 +3 61 1.0 +3 62 1.0 +3 63 1.0 +4 0 1.0 +4 1 1.0 +4 2 1.0 +4 3 1.0 +4 4 1.0 +4 5 1.0 +4 6 1.0 +4 7 1.0 +4 8 1.0 +4 9 1.0 +4 10 1.0 +4 11 1.0 +4 12 1.0 +4 13 1.0 +4 14 1.0 +4 15 1.0 +4 16 1.0 +4 17 1.0 +4 18 1.0 +4 19 1.0 +4 20 1.0 +4 21 1.0 +4 22 1.0 +4 23 1.0 +4 24 1.0 +4 25 1.0 +4 26 1.0 +4 27 1.0 +4 28 1.0 +4 29 1.0 +4 30 1.0 +4 31 1.0 +4 32 1.0 +4 33 1.0 +4 34 1.0 +4 35 1.0 +4 36 1.0 +4 37 1.0 +4 38 1.0 +4 39 1.0 +4 40 1.0 +4 41 1.0 +4 42 1.0 +4 43 1.0 +4 44 1.0 +4 45 1.0 +4 46 1.0 +4 47 1.0 +4 48 1.0 +4 49 1.0 +4 50 1.0 +4 51 1.0 +4 52 1.0 +4 53 1.0 +4 54 1.0 +4 55 1.0 +4 56 1.0 +4 57 1.0 +4 58 1.0 +4 59 1.0 +4 60 1.0 +4 61 1.0 +4 62 1.0 +4 63 1.0 +5 0 1.0 +5 1 1.0 +5 2 1.0 +5 3 1.0 +5 4 1.0 +5 5 1.0 +5 6 1.0 +5 7 1.0 +5 8 1.0 +5 9 1.0 +5 10 1.0 +5 11 1.0 +5 12 1.0 +5 13 1.0 +5 14 1.0 +5 15 1.0 +5 16 1.0 +5 17 1.0 +5 18 1.0 +5 19 1.0 +5 20 1.0 +5 21 1.0 +5 22 1.0 +5 23 1.0 +5 24 1.0 +5 25 1.0 +5 26 1.0 +5 27 1.0 +5 28 1.0 +5 29 1.0 +5 30 1.0 +5 31 1.0 +5 32 1.0 +5 33 1.0 +5 34 1.0 +5 35 1.0 +5 36 1.0 +5 37 1.0 +5 38 1.0 +5 39 1.0 +5 40 1.0 +5 41 1.0 +5 42 1.0 +5 43 1.0 +5 44 1.0 +5 45 1.0 +5 46 1.0 +5 47 1.0 +5 48 1.0 +5 49 1.0 +5 50 1.0 +5 51 1.0 +5 52 1.0 +5 53 1.0 +5 54 1.0 +5 55 1.0 +5 56 1.0 +5 57 1.0 +5 58 1.0 +5 59 1.0 +5 60 1.0 +5 61 1.0 +5 62 1.0 +5 63 1.0 +6 0 1.0 +6 1 1.0 +6 2 1.0 +6 3 1.0 +6 4 1.0 +6 5 1.0 +6 6 1.0 +6 7 1.0 +6 8 1.0 +6 9 1.0 +6 10 1.0 +6 11 1.0 +6 12 1.0 +6 13 1.0 +6 14 1.0 +6 15 1.0 +6 16 1.0 +6 17 1.0 +6 18 1.0 +6 19 1.0 +6 20 1.0 +6 21 1.0 +6 22 1.0 +6 23 1.0 +6 24 1.0 +6 25 1.0 +6 26 1.0 +6 27 1.0 +6 28 1.0 +6 29 1.0 +6 30 1.0 +6 31 1.0 +6 32 1.0 +6 33 1.0 +6 34 1.0 +6 35 1.0 +6 36 1.0 +6 37 1.0 +6 38 1.0 +6 39 1.0 +6 40 1.0 +6 41 1.0 +6 42 1.0 +6 43 1.0 +6 44 1.0 +6 45 1.0 +6 46 1.0 +6 47 1.0 +6 48 1.0 +6 49 1.0 +6 50 1.0 +6 51 1.0 +6 52 1.0 +6 53 1.0 +6 54 1.0 +6 55 1.0 +6 56 1.0 +6 57 1.0 +6 58 1.0 +6 59 1.0 +6 60 1.0 +6 61 1.0 +6 62 1.0 +6 63 1.0 +7 0 1.0 +7 1 1.0 +7 2 1.0 +7 3 1.0 +7 4 1.0 +7 5 1.0 +7 6 1.0 +7 7 1.0 +7 8 1.0 +7 9 1.0 +7 10 1.0 +7 11 1.0 +7 12 1.0 +7 13 1.0 +7 14 1.0 +7 15 1.0 +7 16 1.0 +7 17 1.0 +7 18 1.0 +7 19 1.0 +7 20 1.0 +7 21 1.0 +7 22 1.0 +7 23 1.0 +7 24 1.0 +7 25 1.0 +7 26 1.0 +7 27 1.0 +7 28 1.0 +7 29 1.0 +7 30 1.0 +7 31 1.0 +7 32 1.0 +7 33 1.0 +7 34 1.0 +7 35 1.0 +7 36 1.0 +7 37 1.0 +7 38 1.0 +7 39 1.0 +7 40 1.0 +7 41 1.0 +7 42 1.0 +7 43 1.0 +7 44 1.0 +7 45 1.0 +7 46 1.0 +7 47 1.0 +7 48 1.0 +7 49 1.0 +7 50 1.0 +7 51 1.0 +7 52 1.0 +7 53 1.0 +7 54 1.0 +7 55 1.0 +7 56 1.0 +7 57 1.0 +7 58 1.0 +7 59 1.0 +7 60 1.0 +7 61 1.0 +7 62 1.0 +7 63 1.0 +8 0 1.0 +8 1 1.0 +8 2 1.0 +8 3 1.0 +8 4 1.0 +8 5 1.0 +8 6 1.0 +8 7 1.0 +8 8 1.0 +8 9 1.0 +8 10 1.0 +8 11 1.0 +8 12 1.0 +8 13 1.0 +8 14 1.0 +8 15 1.0 +8 16 1.0 +8 17 1.0 +8 18 1.0 +8 19 1.0 +8 20 1.0 +8 21 1.0 +8 22 1.0 +8 23 1.0 +8 24 1.0 +8 25 1.0 +8 26 1.0 +8 27 1.0 +8 28 1.0 +8 29 1.0 +8 30 1.0 +8 31 1.0 +8 32 1.0 +8 33 1.0 +8 34 1.0 +8 35 1.0 +8 36 1.0 +8 37 1.0 +8 38 1.0 +8 39 1.0 +8 40 1.0 +8 41 1.0 +8 42 1.0 +8 43 1.0 +8 44 1.0 +8 45 1.0 +8 46 1.0 +8 47 1.0 +8 48 1.0 +8 49 1.0 +8 50 1.0 +8 51 1.0 +8 52 1.0 +8 53 1.0 +8 54 1.0 +8 55 1.0 +8 56 1.0 +8 57 1.0 +8 58 1.0 +8 59 1.0 +8 60 1.0 +8 61 1.0 +8 62 1.0 +8 63 1.0 +9 0 1.0 +9 1 1.0 +9 2 1.0 +9 3 1.0 +9 4 1.0 +9 5 1.0 +9 6 1.0 +9 7 1.0 +9 8 1.0 +9 9 1.0 +9 10 1.0 +9 11 1.0 +9 12 1.0 +9 13 1.0 +9 14 1.0 +9 15 1.0 +9 16 1.0 +9 17 1.0 +9 18 1.0 +9 19 1.0 +9 20 1.0 +9 21 1.0 +9 22 1.0 +9 23 1.0 +9 24 1.0 +9 25 1.0 +9 26 1.0 +9 27 1.0 +9 28 1.0 +9 29 1.0 +9 30 1.0 +9 31 1.0 +9 32 1.0 +9 33 1.0 +9 34 1.0 +9 35 1.0 +9 36 1.0 +9 37 1.0 +9 38 1.0 +9 39 1.0 +9 40 1.0 +9 41 1.0 +9 42 1.0 +9 43 1.0 +9 44 1.0 +9 45 1.0 +9 46 1.0 +9 47 1.0 +9 48 1.0 +9 49 1.0 +9 50 1.0 +9 51 1.0 +9 52 1.0 +9 53 1.0 +9 54 1.0 +9 55 1.0 +9 56 1.0 +9 57 1.0 +9 58 1.0 +9 59 1.0 +9 60 1.0 +9 61 1.0 +9 62 1.0 +9 63 1.0 +10 0 1.0 +10 1 1.0 +10 2 1.0 +10 3 1.0 +10 4 1.0 +10 5 1.0 +10 6 1.0 +10 7 1.0 +10 8 1.0 +10 9 1.0 +10 10 1.0 +10 11 1.0 +10 12 1.0 +10 13 1.0 +10 14 1.0 +10 15 1.0 +10 16 1.0 +10 17 1.0 +10 18 1.0 +10 19 1.0 +10 20 1.0 +10 21 1.0 +10 22 1.0 +10 23 1.0 +10 24 1.0 +10 25 1.0 +10 26 1.0 +10 27 1.0 +10 28 1.0 +10 29 1.0 +10 30 1.0 +10 31 1.0 +10 32 1.0 +10 33 1.0 +10 34 1.0 +10 35 1.0 +10 36 1.0 +10 37 1.0 +10 38 1.0 +10 39 1.0 +10 40 1.0 +10 41 1.0 +10 42 1.0 +10 43 1.0 +10 44 1.0 +10 45 1.0 +10 46 1.0 +10 47 1.0 +10 48 1.0 +10 49 1.0 +10 50 1.0 +10 51 1.0 +10 52 1.0 +10 53 1.0 +10 54 1.0 +10 55 1.0 +10 56 1.0 +10 57 1.0 +10 58 1.0 +10 59 1.0 +10 60 1.0 +10 61 1.0 +10 62 1.0 +10 63 1.0 +11 0 1.0 +11 1 1.0 +11 2 1.0 +11 3 1.0 +11 4 1.0 +11 5 1.0 +11 6 1.0 +11 7 1.0 +11 8 1.0 +11 9 1.0 +11 10 1.0 +11 11 1.0 +11 12 1.0 +11 13 1.0 +11 14 1.0 +11 15 1.0 +11 16 1.0 +11 17 1.0 +11 18 1.0 +11 19 1.0 +11 20 1.0 +11 21 1.0 +11 22 1.0 +11 23 1.0 +11 24 1.0 +11 25 1.0 +11 26 1.0 +11 27 1.0 +11 28 1.0 +11 29 1.0 +11 30 1.0 +11 31 1.0 +11 32 1.0 +11 33 1.0 +11 34 1.0 +11 35 1.0 +11 36 1.0 +11 37 1.0 +11 38 1.0 +11 39 1.0 +11 40 1.0 +11 41 1.0 +11 42 1.0 +11 43 1.0 +11 44 1.0 +11 45 1.0 +11 46 1.0 +11 47 1.0 +11 48 1.0 +11 49 1.0 +11 50 1.0 +11 51 1.0 +11 52 1.0 +11 53 1.0 +11 54 1.0 +11 55 1.0 +11 56 1.0 +11 57 1.0 +11 58 1.0 +11 59 1.0 +11 60 1.0 +11 61 1.0 +11 62 1.0 +11 63 1.0 +12 0 1.12 +12 1 1.12 +12 2 1.12 +12 3 1.12 +12 4 1.12 +12 5 1.12 +12 6 1.12 +12 7 1.12 +12 8 1.12 +12 9 1.12 +12 10 1.12 +12 11 1.12 +12 12 1.12 +12 13 1.12 +12 14 1.12 +12 15 1.12 +12 16 1.12 +12 17 1.12 +12 18 1.12 +12 19 1.12 +12 20 1.12 +12 21 1.12 +12 22 1.12 +12 23 1.12 +12 24 1.12 +12 25 1.12 +12 26 1.12 +12 27 1.12 +12 28 1.12 +12 29 1.12 +12 30 1.12 +12 31 1.12 +12 32 1.12 +12 33 1.12 +12 34 1.12 +12 35 1.12 +12 36 1.12 +12 37 1.12 +12 38 1.12 +12 39 1.12 +12 40 1.12 +12 41 1.12 +12 42 1.12 +12 43 1.12 +12 44 1.12 +12 45 1.12 +12 46 1.12 +12 47 1.12 +12 48 1.12 +12 49 1.12 +12 50 1.12 +12 51 1.12 +12 52 1.12 +12 53 1.12 +12 54 1.12 +12 55 1.12 +12 56 1.12 +12 57 1.12 +12 58 1.12 +12 59 1.12 +12 60 1.12 +12 61 1.12 +12 62 1.12 +12 63 1.12 +13 0 1.12 +13 1 1.12 +13 2 1.12 +13 3 1.12 +13 4 1.12 +13 5 1.12 +13 6 1.12 +13 7 1.12 +13 8 1.12 +13 9 1.12 +13 10 1.12 +13 11 1.12 +13 12 1.12 +13 13 1.12 +13 14 1.12 +13 15 1.12 +13 16 1.12 +13 17 1.12 +13 18 1.12 +13 19 1.12 +13 20 1.12 +13 21 1.12 +13 22 1.12 +13 23 1.12 +13 24 1.12 +13 25 1.12 +13 26 1.12 +13 27 1.12 +13 28 1.12 +13 29 1.12 +13 30 1.12 +13 31 1.12 +13 32 1.12 +13 33 1.12 +13 34 1.12 +13 35 1.12 +13 36 1.12 +13 37 1.12 +13 38 1.12 +13 39 1.12 +13 40 1.12 +13 41 1.12 +13 42 1.12 +13 43 1.12 +13 44 1.12 +13 45 1.12 +13 46 1.12 +13 47 1.12 +13 48 1.12 +13 49 1.12 +13 50 1.12 +13 51 1.12 +13 52 1.12 +13 53 1.12 +13 54 1.12 +13 55 1.12 +13 56 1.12 +13 57 1.12 +13 58 1.12 +13 59 1.12 +13 60 1.12 +13 61 1.12 +13 62 1.12 +13 63 1.12 +14 0 1.12 +14 1 1.12 +14 2 1.12 +14 3 1.12 +14 4 1.12 +14 5 1.12 +14 6 1.12 +14 7 1.12 +14 8 1.12 +14 9 1.12 +14 10 1.12 +14 11 1.12 +14 12 1.12 +14 13 1.12 +14 14 1.12 +14 15 1.12 +14 16 1.12 +14 17 1.12 +14 18 1.12 +14 19 1.12 +14 20 1.12 +14 21 1.12 +14 22 1.12 +14 23 1.12 +14 24 1.12 +14 25 1.12 +14 26 1.12 +14 27 1.12 +14 28 1.12 +14 29 1.12 +14 30 1.12 +14 31 1.12 +14 32 1.12 +14 33 1.12 +14 34 1.12 +14 35 1.12 +14 36 1.12 +14 37 1.12 +14 38 1.12 +14 39 1.12 +14 40 1.12 +14 41 1.12 +14 42 1.12 +14 43 1.12 +14 44 1.12 +14 45 1.12 +14 46 1.12 +14 47 1.12 +14 48 1.12 +14 49 1.12 +14 50 1.12 +14 51 1.12 +14 52 1.12 +14 53 1.12 +14 54 1.12 +14 55 1.12 +14 56 1.12 +14 57 1.12 +14 58 1.12 +14 59 1.12 +14 60 1.12 +14 61 1.12 +14 62 1.12 +14 63 1.12 +15 0 1.12 +15 1 1.12 +15 2 1.12 +15 3 1.12 +15 4 1.12 +15 5 1.12 +15 6 1.12 +15 7 1.12 +15 8 1.12 +15 9 1.12 +15 10 1.12 +15 11 1.12 +15 12 1.12 +15 13 1.12 +15 14 1.12 +15 15 1.12 +15 16 1.12 +15 17 1.12 +15 18 1.12 +15 19 1.12 +15 20 1.12 +15 21 1.12 +15 22 1.12 +15 23 1.12 +15 24 1.12 +15 25 1.12 +15 26 1.12 +15 27 1.12 +15 28 1.12 +15 29 1.12 +15 30 1.12 +15 31 1.12 +15 32 1.12 +15 33 1.12 +15 34 1.12 +15 35 1.12 +15 36 1.12 +15 37 1.12 +15 38 1.12 +15 39 1.12 +15 40 1.12 +15 41 1.12 +15 42 1.12 +15 43 1.12 +15 44 1.12 +15 45 1.12 +15 46 1.12 +15 47 1.12 +15 48 1.12 +15 49 1.12 +15 50 1.12 +15 51 1.12 +15 52 1.12 +15 53 1.12 +15 54 1.12 +15 55 1.12 +15 56 1.12 +15 57 1.12 +15 58 1.12 +15 59 1.12 +15 60 1.12 +15 61 1.12 +15 62 1.12 +15 63 1.12 +16 0 1.12 +16 1 1.12 +16 2 1.12 +16 3 1.12 +16 4 1.12 +16 5 1.12 +16 6 1.12 +16 7 1.12 +16 8 1.12 +16 9 1.12 +16 10 1.12 +16 11 1.12 +16 12 1.12 +16 13 1.12 +16 14 1.12 +16 15 1.12 +16 16 1.12 +16 17 1.12 +16 18 1.12 +16 19 1.12 +16 20 1.12 +16 21 1.12 +16 22 1.12 +16 23 1.12 +16 24 1.12 +16 25 1.12 +16 26 1.12 +16 27 1.12 +16 28 1.12 +16 29 1.12 +16 30 1.12 +16 31 1.12 +16 32 1.12 +16 33 1.12 +16 34 1.12 +16 35 1.12 +16 36 1.12 +16 37 1.12 +16 38 1.12 +16 39 1.12 +16 40 1.12 +16 41 1.12 +16 42 1.12 +16 43 1.12 +16 44 1.12 +16 45 1.12 +16 46 1.12 +16 47 1.12 +16 48 1.12 +16 49 1.12 +16 50 1.12 +16 51 1.12 +16 52 1.12 +16 53 1.12 +16 54 1.12 +16 55 1.12 +16 56 1.12 +16 57 1.12 +16 58 1.12 +16 59 1.12 +16 60 1.12 +16 61 1.12 +16 62 1.12 +16 63 1.12 +17 0 1.12 +17 1 1.12 +17 2 1.12 +17 3 1.12 +17 4 1.12 +17 5 1.12 +17 6 1.12 +17 7 1.12 +17 8 1.12 +17 9 1.12 +17 10 1.12 +17 11 1.12 +17 12 1.12 +17 13 1.12 +17 14 1.12 +17 15 1.12 +17 16 1.12 +17 17 1.12 +17 18 1.12 +17 19 1.12 +17 20 1.12 +17 21 1.12 +17 22 1.12 +17 23 1.12 +17 24 1.12 +17 25 1.12 +17 26 1.12 +17 27 1.12 +17 28 1.12 +17 29 1.12 +17 30 1.12 +17 31 1.12 +17 32 1.12 +17 33 1.12 +17 34 1.12 +17 35 1.12 +17 36 1.12 +17 37 1.12 +17 38 1.12 +17 39 1.12 +17 40 1.12 +17 41 1.12 +17 42 1.12 +17 43 1.12 +17 44 1.12 +17 45 1.12 +17 46 1.12 +17 47 1.12 +17 48 1.12 +17 49 1.12 +17 50 1.12 +17 51 1.12 +17 52 1.12 +17 53 1.12 +17 54 1.12 +17 55 1.12 +17 56 1.12 +17 57 1.12 +17 58 1.12 +17 59 1.12 +17 60 1.12 +17 61 1.12 +17 62 1.12 +17 63 1.12 +18 0 1.12 +18 1 1.12 +18 2 1.12 +18 3 1.12 +18 4 1.12 +18 5 1.12 +18 6 1.12 +18 7 1.12 +18 8 1.12 +18 9 1.12 +18 10 1.12 +18 11 1.12 +18 12 1.12 +18 13 1.12 +18 14 1.12 +18 15 1.12 +18 16 1.12 +18 17 1.12 +18 18 1.12 +18 19 1.12 +18 20 1.12 +18 21 1.12 +18 22 1.12 +18 23 1.12 +18 24 1.12 +18 25 1.12 +18 26 1.12 +18 27 1.12 +18 28 1.12 +18 29 1.12 +18 30 1.12 +18 31 1.12 +18 32 1.12 +18 33 1.12 +18 34 1.12 +18 35 1.12 +18 36 1.12 +18 37 1.12 +18 38 1.12 +18 39 1.12 +18 40 1.12 +18 41 1.12 +18 42 1.12 +18 43 1.12 +18 44 1.12 +18 45 1.12 +18 46 1.12 +18 47 1.12 +18 48 1.12 +18 49 1.12 +18 50 1.12 +18 51 1.12 +18 52 1.12 +18 53 1.12 +18 54 1.12 +18 55 1.12 +18 56 1.12 +18 57 1.12 +18 58 1.12 +18 59 1.12 +18 60 1.12 +18 61 1.12 +18 62 1.12 +18 63 1.12 +19 0 1.12 +19 1 1.12 +19 2 1.12 +19 3 1.12 +19 4 1.12 +19 5 1.12 +19 6 1.12 +19 7 1.12 +19 8 1.12 +19 9 1.12 +19 10 1.12 +19 11 1.12 +19 12 1.12 +19 13 1.12 +19 14 1.12 +19 15 1.12 +19 16 1.12 +19 17 1.12 +19 18 1.12 +19 19 1.12 +19 20 1.12 +19 21 1.12 +19 22 1.12 +19 23 1.12 +19 24 1.12 +19 25 1.12 +19 26 1.12 +19 27 1.12 +19 28 1.12 +19 29 1.12 +19 30 1.12 +19 31 1.12 +19 32 1.12 +19 33 1.12 +19 34 1.12 +19 35 1.12 +19 36 1.12 +19 37 1.12 +19 38 1.12 +19 39 1.12 +19 40 1.12 +19 41 1.12 +19 42 1.12 +19 43 1.12 +19 44 1.12 +19 45 1.12 +19 46 1.12 +19 47 1.12 +19 48 1.12 +19 49 1.12 +19 50 1.12 +19 51 1.12 +19 52 1.12 +19 53 1.12 +19 54 1.12 +19 55 1.12 +19 56 1.12 +19 57 1.12 +19 58 1.12 +19 59 1.12 +19 60 1.12 +19 61 1.12 +19 62 1.12 +19 63 1.12 +20 0 1.12 +20 1 1.12 +20 2 1.12 +20 3 1.12 +20 4 1.12 +20 5 1.12 +20 6 1.12 +20 7 1.12 +20 8 1.12 +20 9 1.12 +20 10 1.12 +20 11 1.12 +20 12 1.12 +20 13 1.12 +20 14 1.12 +20 15 1.12 +20 16 1.12 +20 17 1.12 +20 18 1.12 +20 19 1.12 +20 20 1.12 +20 21 1.12 +20 22 1.12 +20 23 1.12 +20 24 1.12 +20 25 1.12 +20 26 1.12 +20 27 1.12 +20 28 1.12 +20 29 1.12 +20 30 1.12 +20 31 1.12 +20 32 1.12 +20 33 1.12 +20 34 1.12 +20 35 1.12 +20 36 1.12 +20 37 1.12 +20 38 1.12 +20 39 1.12 +20 40 1.12 +20 41 1.12 +20 42 1.12 +20 43 1.12 +20 44 1.12 +20 45 1.12 +20 46 1.12 +20 47 1.12 +20 48 1.12 +20 49 1.12 +20 50 1.12 +20 51 1.12 +20 52 1.12 +20 53 1.12 +20 54 1.12 +20 55 1.12 +20 56 1.12 +20 57 1.12 +20 58 1.12 +20 59 1.12 +20 60 1.12 +20 61 1.12 +20 62 1.12 +20 63 1.12 +21 0 1.12 +21 1 1.12 +21 2 1.12 +21 3 1.12 +21 4 1.12 +21 5 1.12 +21 6 1.12 +21 7 1.12 +21 8 1.12 +21 9 1.12 +21 10 1.12 +21 11 1.12 +21 12 1.12 +21 13 1.12 +21 14 1.12 +21 15 1.12 +21 16 1.12 +21 17 1.12 +21 18 1.12 +21 19 1.12 +21 20 1.12 +21 21 1.12 +21 22 1.12 +21 23 1.12 +21 24 1.12 +21 25 1.12 +21 26 1.12 +21 27 1.12 +21 28 1.12 +21 29 1.12 +21 30 1.12 +21 31 1.12 +21 32 1.12 +21 33 1.12 +21 34 1.12 +21 35 1.12 +21 36 1.12 +21 37 1.12 +21 38 1.12 +21 39 1.12 +21 40 1.12 +21 41 1.12 +21 42 1.12 +21 43 1.12 +21 44 1.12 +21 45 1.12 +21 46 1.12 +21 47 1.12 +21 48 1.12 +21 49 1.12 +21 50 1.12 +21 51 1.12 +21 52 1.12 +21 53 1.12 +21 54 1.12 +21 55 1.12 +21 56 1.12 +21 57 1.12 +21 58 1.12 +21 59 1.12 +21 60 1.12 +21 61 1.12 +21 62 1.12 +21 63 1.12 +22 0 1.12 +22 1 1.12 +22 2 1.12 +22 3 1.12 +22 4 1.12 +22 5 1.12 +22 6 1.12 +22 7 1.12 +22 8 1.12 +22 9 1.12 +22 10 1.12 +22 11 1.12 +22 12 1.12 +22 13 1.12 +22 14 1.12 +22 15 1.12 +22 16 1.12 +22 17 1.12 +22 18 1.12 +22 19 1.12 +22 20 1.12 +22 21 1.12 +22 22 1.12 +22 23 1.12 +22 24 1.12 +22 25 1.12 +22 26 1.12 +22 27 1.12 +22 28 1.12 +22 29 1.12 +22 30 1.12 +22 31 1.12 +22 32 1.12 +22 33 1.12 +22 34 1.12 +22 35 1.12 +22 36 1.12 +22 37 1.12 +22 38 1.12 +22 39 1.12 +22 40 1.12 +22 41 1.12 +22 42 1.12 +22 43 1.12 +22 44 1.12 +22 45 1.12 +22 46 1.12 +22 47 1.12 +22 48 1.12 +22 49 1.12 +22 50 1.12 +22 51 1.12 +22 52 1.12 +22 53 1.12 +22 54 1.12 +22 55 1.12 +22 56 1.12 +22 57 1.12 +22 58 1.12 +22 59 1.12 +22 60 1.12 +22 61 1.12 +22 62 1.12 +22 63 1.12 +23 0 1.12 +23 1 1.12 +23 2 1.12 +23 3 1.12 +23 4 1.12 +23 5 1.12 +23 6 1.12 +23 7 1.12 +23 8 1.12 +23 9 1.12 +23 10 1.12 +23 11 1.12 +23 12 1.12 +23 13 1.12 +23 14 1.12 +23 15 1.12 +23 16 1.12 +23 17 1.12 +23 18 1.12 +23 19 1.12 +23 20 1.12 +23 21 1.12 +23 22 1.12 +23 23 1.12 +23 24 1.12 +23 25 1.12 +23 26 1.12 +23 27 1.12 +23 28 1.12 +23 29 1.12 +23 30 1.12 +23 31 1.12 +23 32 1.12 +23 33 1.12 +23 34 1.12 +23 35 1.12 +23 36 1.12 +23 37 1.12 +23 38 1.12 +23 39 1.12 +23 40 1.12 +23 41 1.12 +23 42 1.12 +23 43 1.12 +23 44 1.12 +23 45 1.12 +23 46 1.12 +23 47 1.12 +23 48 1.12 +23 49 1.12 +23 50 1.12 +23 51 1.12 +23 52 1.12 +23 53 1.12 +23 54 1.12 +23 55 1.12 +23 56 1.12 +23 57 1.12 +23 58 1.12 +23 59 1.12 +23 60 1.12 +23 61 1.12 +23 62 1.12 +23 63 1.12 diff --git a/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.22.txt b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.22.txt new file mode 100644 index 000000000..7138c4c00 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/HCALOUT_GainsCalib1.22.txt @@ -0,0 +1,1536 @@ +0 0 1.22 +0 1 1.22 +0 2 1.22 +0 3 1.22 +0 4 1.22 +0 5 1.22 +0 6 1.22 +0 7 1.22 +0 8 1.22 +0 9 1.22 +0 10 1.22 +0 11 1.22 +0 12 1.22 +0 13 1.22 +0 14 1.22 +0 15 1.22 +0 16 1.22 +0 17 1.22 +0 18 1.22 +0 19 1.22 +0 20 1.22 +0 21 1.22 +0 22 1.22 +0 23 1.22 +0 24 1.22 +0 25 1.22 +0 26 1.22 +0 27 1.22 +0 28 1.22 +0 29 1.22 +0 30 1.22 +0 31 1.22 +0 32 1.22 +0 33 1.22 +0 34 1.22 +0 35 1.22 +0 36 1.22 +0 37 1.22 +0 38 1.22 +0 39 1.22 +0 40 1.22 +0 41 1.22 +0 42 1.22 +0 43 1.22 +0 44 1.22 +0 45 1.22 +0 46 1.22 +0 47 1.22 +0 48 1.22 +0 49 1.22 +0 50 1.22 +0 51 1.22 +0 52 1.22 +0 53 1.22 +0 54 1.22 +0 55 1.22 +0 56 1.22 +0 57 1.22 +0 58 1.22 +0 59 1.22 +0 60 1.22 +0 61 1.22 +0 62 1.22 +0 63 1.22 +1 0 1.22 +1 1 1.22 +1 2 1.22 +1 3 1.22 +1 4 1.22 +1 5 1.22 +1 6 1.22 +1 7 1.22 +1 8 1.22 +1 9 1.22 +1 10 1.22 +1 11 1.22 +1 12 1.22 +1 13 1.22 +1 14 1.22 +1 15 1.22 +1 16 1.22 +1 17 1.22 +1 18 1.22 +1 19 1.22 +1 20 1.22 +1 21 1.22 +1 22 1.22 +1 23 1.22 +1 24 1.22 +1 25 1.22 +1 26 1.22 +1 27 1.22 +1 28 1.22 +1 29 1.22 +1 30 1.22 +1 31 1.22 +1 32 1.22 +1 33 1.22 +1 34 1.22 +1 35 1.22 +1 36 1.22 +1 37 1.22 +1 38 1.22 +1 39 1.22 +1 40 1.22 +1 41 1.22 +1 42 1.22 +1 43 1.22 +1 44 1.22 +1 45 1.22 +1 46 1.22 +1 47 1.22 +1 48 1.22 +1 49 1.22 +1 50 1.22 +1 51 1.22 +1 52 1.22 +1 53 1.22 +1 54 1.22 +1 55 1.22 +1 56 1.22 +1 57 1.22 +1 58 1.22 +1 59 1.22 +1 60 1.22 +1 61 1.22 +1 62 1.22 +1 63 1.22 +2 0 1.22 +2 1 1.22 +2 2 1.22 +2 3 1.22 +2 4 1.22 +2 5 1.22 +2 6 1.22 +2 7 1.22 +2 8 1.22 +2 9 1.22 +2 10 1.22 +2 11 1.22 +2 12 1.22 +2 13 1.22 +2 14 1.22 +2 15 1.22 +2 16 1.22 +2 17 1.22 +2 18 1.22 +2 19 1.22 +2 20 1.22 +2 21 1.22 +2 22 1.22 +2 23 1.22 +2 24 1.22 +2 25 1.22 +2 26 1.22 +2 27 1.22 +2 28 1.22 +2 29 1.22 +2 30 1.22 +2 31 1.22 +2 32 1.22 +2 33 1.22 +2 34 1.22 +2 35 1.22 +2 36 1.22 +2 37 1.22 +2 38 1.22 +2 39 1.22 +2 40 1.22 +2 41 1.22 +2 42 1.22 +2 43 1.22 +2 44 1.22 +2 45 1.22 +2 46 1.22 +2 47 1.22 +2 48 1.22 +2 49 1.22 +2 50 1.22 +2 51 1.22 +2 52 1.22 +2 53 1.22 +2 54 1.22 +2 55 1.22 +2 56 1.22 +2 57 1.22 +2 58 1.22 +2 59 1.22 +2 60 1.22 +2 61 1.22 +2 62 1.22 +2 63 1.22 +3 0 1.22 +3 1 1.22 +3 2 1.22 +3 3 1.22 +3 4 1.22 +3 5 1.22 +3 6 1.22 +3 7 1.22 +3 8 1.22 +3 9 1.22 +3 10 1.22 +3 11 1.22 +3 12 1.22 +3 13 1.22 +3 14 1.22 +3 15 1.22 +3 16 1.22 +3 17 1.22 +3 18 1.22 +3 19 1.22 +3 20 1.22 +3 21 1.22 +3 22 1.22 +3 23 1.22 +3 24 1.22 +3 25 1.22 +3 26 1.22 +3 27 1.22 +3 28 1.22 +3 29 1.22 +3 30 1.22 +3 31 1.22 +3 32 1.22 +3 33 1.22 +3 34 1.22 +3 35 1.22 +3 36 1.22 +3 37 1.22 +3 38 1.22 +3 39 1.22 +3 40 1.22 +3 41 1.22 +3 42 1.22 +3 43 1.22 +3 44 1.22 +3 45 1.22 +3 46 1.22 +3 47 1.22 +3 48 1.22 +3 49 1.22 +3 50 1.22 +3 51 1.22 +3 52 1.22 +3 53 1.22 +3 54 1.22 +3 55 1.22 +3 56 1.22 +3 57 1.22 +3 58 1.22 +3 59 1.22 +3 60 1.22 +3 61 1.22 +3 62 1.22 +3 63 1.22 +4 0 1.22 +4 1 1.22 +4 2 1.22 +4 3 1.22 +4 4 1.22 +4 5 1.22 +4 6 1.22 +4 7 1.22 +4 8 1.22 +4 9 1.22 +4 10 1.22 +4 11 1.22 +4 12 1.22 +4 13 1.22 +4 14 1.22 +4 15 1.22 +4 16 1.22 +4 17 1.22 +4 18 1.22 +4 19 1.22 +4 20 1.22 +4 21 1.22 +4 22 1.22 +4 23 1.22 +4 24 1.22 +4 25 1.22 +4 26 1.22 +4 27 1.22 +4 28 1.22 +4 29 1.22 +4 30 1.22 +4 31 1.22 +4 32 1.22 +4 33 1.22 +4 34 1.22 +4 35 1.22 +4 36 1.22 +4 37 1.22 +4 38 1.22 +4 39 1.22 +4 40 1.22 +4 41 1.22 +4 42 1.22 +4 43 1.22 +4 44 1.22 +4 45 1.22 +4 46 1.22 +4 47 1.22 +4 48 1.22 +4 49 1.22 +4 50 1.22 +4 51 1.22 +4 52 1.22 +4 53 1.22 +4 54 1.22 +4 55 1.22 +4 56 1.22 +4 57 1.22 +4 58 1.22 +4 59 1.22 +4 60 1.22 +4 61 1.22 +4 62 1.22 +4 63 1.22 +5 0 1.22 +5 1 1.22 +5 2 1.22 +5 3 1.22 +5 4 1.22 +5 5 1.22 +5 6 1.22 +5 7 1.22 +5 8 1.22 +5 9 1.22 +5 10 1.22 +5 11 1.22 +5 12 1.22 +5 13 1.22 +5 14 1.22 +5 15 1.22 +5 16 1.22 +5 17 1.22 +5 18 1.22 +5 19 1.22 +5 20 1.22 +5 21 1.22 +5 22 1.22 +5 23 1.22 +5 24 1.22 +5 25 1.22 +5 26 1.22 +5 27 1.22 +5 28 1.22 +5 29 1.22 +5 30 1.22 +5 31 1.22 +5 32 1.22 +5 33 1.22 +5 34 1.22 +5 35 1.22 +5 36 1.22 +5 37 1.22 +5 38 1.22 +5 39 1.22 +5 40 1.22 +5 41 1.22 +5 42 1.22 +5 43 1.22 +5 44 1.22 +5 45 1.22 +5 46 1.22 +5 47 1.22 +5 48 1.22 +5 49 1.22 +5 50 1.22 +5 51 1.22 +5 52 1.22 +5 53 1.22 +5 54 1.22 +5 55 1.22 +5 56 1.22 +5 57 1.22 +5 58 1.22 +5 59 1.22 +5 60 1.22 +5 61 1.22 +5 62 1.22 +5 63 1.22 +6 0 1.22 +6 1 1.22 +6 2 1.22 +6 3 1.22 +6 4 1.22 +6 5 1.22 +6 6 1.22 +6 7 1.22 +6 8 1.22 +6 9 1.22 +6 10 1.22 +6 11 1.22 +6 12 1.22 +6 13 1.22 +6 14 1.22 +6 15 1.22 +6 16 1.22 +6 17 1.22 +6 18 1.22 +6 19 1.22 +6 20 1.22 +6 21 1.22 +6 22 1.22 +6 23 1.22 +6 24 1.22 +6 25 1.22 +6 26 1.22 +6 27 1.22 +6 28 1.22 +6 29 1.22 +6 30 1.22 +6 31 1.22 +6 32 1.22 +6 33 1.22 +6 34 1.22 +6 35 1.22 +6 36 1.22 +6 37 1.22 +6 38 1.22 +6 39 1.22 +6 40 1.22 +6 41 1.22 +6 42 1.22 +6 43 1.22 +6 44 1.22 +6 45 1.22 +6 46 1.22 +6 47 1.22 +6 48 1.22 +6 49 1.22 +6 50 1.22 +6 51 1.22 +6 52 1.22 +6 53 1.22 +6 54 1.22 +6 55 1.22 +6 56 1.22 +6 57 1.22 +6 58 1.22 +6 59 1.22 +6 60 1.22 +6 61 1.22 +6 62 1.22 +6 63 1.22 +7 0 1.22 +7 1 1.22 +7 2 1.22 +7 3 1.22 +7 4 1.22 +7 5 1.22 +7 6 1.22 +7 7 1.22 +7 8 1.22 +7 9 1.22 +7 10 1.22 +7 11 1.22 +7 12 1.22 +7 13 1.22 +7 14 1.22 +7 15 1.22 +7 16 1.22 +7 17 1.22 +7 18 1.22 +7 19 1.22 +7 20 1.22 +7 21 1.22 +7 22 1.22 +7 23 1.22 +7 24 1.22 +7 25 1.22 +7 26 1.22 +7 27 1.22 +7 28 1.22 +7 29 1.22 +7 30 1.22 +7 31 1.22 +7 32 1.22 +7 33 1.22 +7 34 1.22 +7 35 1.22 +7 36 1.22 +7 37 1.22 +7 38 1.22 +7 39 1.22 +7 40 1.22 +7 41 1.22 +7 42 1.22 +7 43 1.22 +7 44 1.22 +7 45 1.22 +7 46 1.22 +7 47 1.22 +7 48 1.22 +7 49 1.22 +7 50 1.22 +7 51 1.22 +7 52 1.22 +7 53 1.22 +7 54 1.22 +7 55 1.22 +7 56 1.22 +7 57 1.22 +7 58 1.22 +7 59 1.22 +7 60 1.22 +7 61 1.22 +7 62 1.22 +7 63 1.22 +8 0 1.22 +8 1 1.22 +8 2 1.22 +8 3 1.22 +8 4 1.22 +8 5 1.22 +8 6 1.22 +8 7 1.22 +8 8 1.22 +8 9 1.22 +8 10 1.22 +8 11 1.22 +8 12 1.22 +8 13 1.22 +8 14 1.22 +8 15 1.22 +8 16 1.22 +8 17 1.22 +8 18 1.22 +8 19 1.22 +8 20 1.22 +8 21 1.22 +8 22 1.22 +8 23 1.22 +8 24 1.22 +8 25 1.22 +8 26 1.22 +8 27 1.22 +8 28 1.22 +8 29 1.22 +8 30 1.22 +8 31 1.22 +8 32 1.22 +8 33 1.22 +8 34 1.22 +8 35 1.22 +8 36 1.22 +8 37 1.22 +8 38 1.22 +8 39 1.22 +8 40 1.22 +8 41 1.22 +8 42 1.22 +8 43 1.22 +8 44 1.22 +8 45 1.22 +8 46 1.22 +8 47 1.22 +8 48 1.22 +8 49 1.22 +8 50 1.22 +8 51 1.22 +8 52 1.22 +8 53 1.22 +8 54 1.22 +8 55 1.22 +8 56 1.22 +8 57 1.22 +8 58 1.22 +8 59 1.22 +8 60 1.22 +8 61 1.22 +8 62 1.22 +8 63 1.22 +9 0 1.22 +9 1 1.22 +9 2 1.22 +9 3 1.22 +9 4 1.22 +9 5 1.22 +9 6 1.22 +9 7 1.22 +9 8 1.22 +9 9 1.22 +9 10 1.22 +9 11 1.22 +9 12 1.22 +9 13 1.22 +9 14 1.22 +9 15 1.22 +9 16 1.22 +9 17 1.22 +9 18 1.22 +9 19 1.22 +9 20 1.22 +9 21 1.22 +9 22 1.22 +9 23 1.22 +9 24 1.22 +9 25 1.22 +9 26 1.22 +9 27 1.22 +9 28 1.22 +9 29 1.22 +9 30 1.22 +9 31 1.22 +9 32 1.22 +9 33 1.22 +9 34 1.22 +9 35 1.22 +9 36 1.22 +9 37 1.22 +9 38 1.22 +9 39 1.22 +9 40 1.22 +9 41 1.22 +9 42 1.22 +9 43 1.22 +9 44 1.22 +9 45 1.22 +9 46 1.22 +9 47 1.22 +9 48 1.22 +9 49 1.22 +9 50 1.22 +9 51 1.22 +9 52 1.22 +9 53 1.22 +9 54 1.22 +9 55 1.22 +9 56 1.22 +9 57 1.22 +9 58 1.22 +9 59 1.22 +9 60 1.22 +9 61 1.22 +9 62 1.22 +9 63 1.22 +10 0 1.22 +10 1 1.22 +10 2 1.22 +10 3 1.22 +10 4 1.22 +10 5 1.22 +10 6 1.22 +10 7 1.22 +10 8 1.22 +10 9 1.22 +10 10 1.22 +10 11 1.22 +10 12 1.22 +10 13 1.22 +10 14 1.22 +10 15 1.22 +10 16 1.22 +10 17 1.22 +10 18 1.22 +10 19 1.22 +10 20 1.22 +10 21 1.22 +10 22 1.22 +10 23 1.22 +10 24 1.22 +10 25 1.22 +10 26 1.22 +10 27 1.22 +10 28 1.22 +10 29 1.22 +10 30 1.22 +10 31 1.22 +10 32 1.22 +10 33 1.22 +10 34 1.22 +10 35 1.22 +10 36 1.22 +10 37 1.22 +10 38 1.22 +10 39 1.22 +10 40 1.22 +10 41 1.22 +10 42 1.22 +10 43 1.22 +10 44 1.22 +10 45 1.22 +10 46 1.22 +10 47 1.22 +10 48 1.22 +10 49 1.22 +10 50 1.22 +10 51 1.22 +10 52 1.22 +10 53 1.22 +10 54 1.22 +10 55 1.22 +10 56 1.22 +10 57 1.22 +10 58 1.22 +10 59 1.22 +10 60 1.22 +10 61 1.22 +10 62 1.22 +10 63 1.22 +11 0 1.22 +11 1 1.22 +11 2 1.22 +11 3 1.22 +11 4 1.22 +11 5 1.22 +11 6 1.22 +11 7 1.22 +11 8 1.22 +11 9 1.22 +11 10 1.22 +11 11 1.22 +11 12 1.22 +11 13 1.22 +11 14 1.22 +11 15 1.22 +11 16 1.22 +11 17 1.22 +11 18 1.22 +11 19 1.22 +11 20 1.22 +11 21 1.22 +11 22 1.22 +11 23 1.22 +11 24 1.22 +11 25 1.22 +11 26 1.22 +11 27 1.22 +11 28 1.22 +11 29 1.22 +11 30 1.22 +11 31 1.22 +11 32 1.22 +11 33 1.22 +11 34 1.22 +11 35 1.22 +11 36 1.22 +11 37 1.22 +11 38 1.22 +11 39 1.22 +11 40 1.22 +11 41 1.22 +11 42 1.22 +11 43 1.22 +11 44 1.22 +11 45 1.22 +11 46 1.22 +11 47 1.22 +11 48 1.22 +11 49 1.22 +11 50 1.22 +11 51 1.22 +11 52 1.22 +11 53 1.22 +11 54 1.22 +11 55 1.22 +11 56 1.22 +11 57 1.22 +11 58 1.22 +11 59 1.22 +11 60 1.22 +11 61 1.22 +11 62 1.22 +11 63 1.22 +12 0 1.22 +12 1 1.22 +12 2 1.22 +12 3 1.22 +12 4 1.22 +12 5 1.22 +12 6 1.22 +12 7 1.22 +12 8 1.22 +12 9 1.22 +12 10 1.22 +12 11 1.22 +12 12 1.22 +12 13 1.22 +12 14 1.22 +12 15 1.22 +12 16 1.22 +12 17 1.22 +12 18 1.22 +12 19 1.22 +12 20 1.22 +12 21 1.22 +12 22 1.22 +12 23 1.22 +12 24 1.22 +12 25 1.22 +12 26 1.22 +12 27 1.22 +12 28 1.22 +12 29 1.22 +12 30 1.22 +12 31 1.22 +12 32 1.22 +12 33 1.22 +12 34 1.22 +12 35 1.22 +12 36 1.22 +12 37 1.22 +12 38 1.22 +12 39 1.22 +12 40 1.22 +12 41 1.22 +12 42 1.22 +12 43 1.22 +12 44 1.22 +12 45 1.22 +12 46 1.22 +12 47 1.22 +12 48 1.22 +12 49 1.22 +12 50 1.22 +12 51 1.22 +12 52 1.22 +12 53 1.22 +12 54 1.22 +12 55 1.22 +12 56 1.22 +12 57 1.22 +12 58 1.22 +12 59 1.22 +12 60 1.22 +12 61 1.22 +12 62 1.22 +12 63 1.22 +13 0 1.22 +13 1 1.22 +13 2 1.22 +13 3 1.22 +13 4 1.22 +13 5 1.22 +13 6 1.22 +13 7 1.22 +13 8 1.22 +13 9 1.22 +13 10 1.22 +13 11 1.22 +13 12 1.22 +13 13 1.22 +13 14 1.22 +13 15 1.22 +13 16 1.22 +13 17 1.22 +13 18 1.22 +13 19 1.22 +13 20 1.22 +13 21 1.22 +13 22 1.22 +13 23 1.22 +13 24 1.22 +13 25 1.22 +13 26 1.22 +13 27 1.22 +13 28 1.22 +13 29 1.22 +13 30 1.22 +13 31 1.22 +13 32 1.22 +13 33 1.22 +13 34 1.22 +13 35 1.22 +13 36 1.22 +13 37 1.22 +13 38 1.22 +13 39 1.22 +13 40 1.22 +13 41 1.22 +13 42 1.22 +13 43 1.22 +13 44 1.22 +13 45 1.22 +13 46 1.22 +13 47 1.22 +13 48 1.22 +13 49 1.22 +13 50 1.22 +13 51 1.22 +13 52 1.22 +13 53 1.22 +13 54 1.22 +13 55 1.22 +13 56 1.22 +13 57 1.22 +13 58 1.22 +13 59 1.22 +13 60 1.22 +13 61 1.22 +13 62 1.22 +13 63 1.22 +14 0 1.22 +14 1 1.22 +14 2 1.22 +14 3 1.22 +14 4 1.22 +14 5 1.22 +14 6 1.22 +14 7 1.22 +14 8 1.22 +14 9 1.22 +14 10 1.22 +14 11 1.22 +14 12 1.22 +14 13 1.22 +14 14 1.22 +14 15 1.22 +14 16 1.22 +14 17 1.22 +14 18 1.22 +14 19 1.22 +14 20 1.22 +14 21 1.22 +14 22 1.22 +14 23 1.22 +14 24 1.22 +14 25 1.22 +14 26 1.22 +14 27 1.22 +14 28 1.22 +14 29 1.22 +14 30 1.22 +14 31 1.22 +14 32 1.22 +14 33 1.22 +14 34 1.22 +14 35 1.22 +14 36 1.22 +14 37 1.22 +14 38 1.22 +14 39 1.22 +14 40 1.22 +14 41 1.22 +14 42 1.22 +14 43 1.22 +14 44 1.22 +14 45 1.22 +14 46 1.22 +14 47 1.22 +14 48 1.22 +14 49 1.22 +14 50 1.22 +14 51 1.22 +14 52 1.22 +14 53 1.22 +14 54 1.22 +14 55 1.22 +14 56 1.22 +14 57 1.22 +14 58 1.22 +14 59 1.22 +14 60 1.22 +14 61 1.22 +14 62 1.22 +14 63 1.22 +15 0 1.22 +15 1 1.22 +15 2 1.22 +15 3 1.22 +15 4 1.22 +15 5 1.22 +15 6 1.22 +15 7 1.22 +15 8 1.22 +15 9 1.22 +15 10 1.22 +15 11 1.22 +15 12 1.22 +15 13 1.22 +15 14 1.22 +15 15 1.22 +15 16 1.22 +15 17 1.22 +15 18 1.22 +15 19 1.22 +15 20 1.22 +15 21 1.22 +15 22 1.22 +15 23 1.22 +15 24 1.22 +15 25 1.22 +15 26 1.22 +15 27 1.22 +15 28 1.22 +15 29 1.22 +15 30 1.22 +15 31 1.22 +15 32 1.22 +15 33 1.22 +15 34 1.22 +15 35 1.22 +15 36 1.22 +15 37 1.22 +15 38 1.22 +15 39 1.22 +15 40 1.22 +15 41 1.22 +15 42 1.22 +15 43 1.22 +15 44 1.22 +15 45 1.22 +15 46 1.22 +15 47 1.22 +15 48 1.22 +15 49 1.22 +15 50 1.22 +15 51 1.22 +15 52 1.22 +15 53 1.22 +15 54 1.22 +15 55 1.22 +15 56 1.22 +15 57 1.22 +15 58 1.22 +15 59 1.22 +15 60 1.22 +15 61 1.22 +15 62 1.22 +15 63 1.22 +16 0 1.22 +16 1 1.22 +16 2 1.22 +16 3 1.22 +16 4 1.22 +16 5 1.22 +16 6 1.22 +16 7 1.22 +16 8 1.22 +16 9 1.22 +16 10 1.22 +16 11 1.22 +16 12 1.22 +16 13 1.22 +16 14 1.22 +16 15 1.22 +16 16 1.22 +16 17 1.22 +16 18 1.22 +16 19 1.22 +16 20 1.22 +16 21 1.22 +16 22 1.22 +16 23 1.22 +16 24 1.22 +16 25 1.22 +16 26 1.22 +16 27 1.22 +16 28 1.22 +16 29 1.22 +16 30 1.22 +16 31 1.22 +16 32 1.22 +16 33 1.22 +16 34 1.22 +16 35 1.22 +16 36 1.22 +16 37 1.22 +16 38 1.22 +16 39 1.22 +16 40 1.22 +16 41 1.22 +16 42 1.22 +16 43 1.22 +16 44 1.22 +16 45 1.22 +16 46 1.22 +16 47 1.22 +16 48 1.22 +16 49 1.22 +16 50 1.22 +16 51 1.22 +16 52 1.22 +16 53 1.22 +16 54 1.22 +16 55 1.22 +16 56 1.22 +16 57 1.22 +16 58 1.22 +16 59 1.22 +16 60 1.22 +16 61 1.22 +16 62 1.22 +16 63 1.22 +17 0 1.22 +17 1 1.22 +17 2 1.22 +17 3 1.22 +17 4 1.22 +17 5 1.22 +17 6 1.22 +17 7 1.22 +17 8 1.22 +17 9 1.22 +17 10 1.22 +17 11 1.22 +17 12 1.22 +17 13 1.22 +17 14 1.22 +17 15 1.22 +17 16 1.22 +17 17 1.22 +17 18 1.22 +17 19 1.22 +17 20 1.22 +17 21 1.22 +17 22 1.22 +17 23 1.22 +17 24 1.22 +17 25 1.22 +17 26 1.22 +17 27 1.22 +17 28 1.22 +17 29 1.22 +17 30 1.22 +17 31 1.22 +17 32 1.22 +17 33 1.22 +17 34 1.22 +17 35 1.22 +17 36 1.22 +17 37 1.22 +17 38 1.22 +17 39 1.22 +17 40 1.22 +17 41 1.22 +17 42 1.22 +17 43 1.22 +17 44 1.22 +17 45 1.22 +17 46 1.22 +17 47 1.22 +17 48 1.22 +17 49 1.22 +17 50 1.22 +17 51 1.22 +17 52 1.22 +17 53 1.22 +17 54 1.22 +17 55 1.22 +17 56 1.22 +17 57 1.22 +17 58 1.22 +17 59 1.22 +17 60 1.22 +17 61 1.22 +17 62 1.22 +17 63 1.22 +18 0 1.22 +18 1 1.22 +18 2 1.22 +18 3 1.22 +18 4 1.22 +18 5 1.22 +18 6 1.22 +18 7 1.22 +18 8 1.22 +18 9 1.22 +18 10 1.22 +18 11 1.22 +18 12 1.22 +18 13 1.22 +18 14 1.22 +18 15 1.22 +18 16 1.22 +18 17 1.22 +18 18 1.22 +18 19 1.22 +18 20 1.22 +18 21 1.22 +18 22 1.22 +18 23 1.22 +18 24 1.22 +18 25 1.22 +18 26 1.22 +18 27 1.22 +18 28 1.22 +18 29 1.22 +18 30 1.22 +18 31 1.22 +18 32 1.22 +18 33 1.22 +18 34 1.22 +18 35 1.22 +18 36 1.22 +18 37 1.22 +18 38 1.22 +18 39 1.22 +18 40 1.22 +18 41 1.22 +18 42 1.22 +18 43 1.22 +18 44 1.22 +18 45 1.22 +18 46 1.22 +18 47 1.22 +18 48 1.22 +18 49 1.22 +18 50 1.22 +18 51 1.22 +18 52 1.22 +18 53 1.22 +18 54 1.22 +18 55 1.22 +18 56 1.22 +18 57 1.22 +18 58 1.22 +18 59 1.22 +18 60 1.22 +18 61 1.22 +18 62 1.22 +18 63 1.22 +19 0 1.22 +19 1 1.22 +19 2 1.22 +19 3 1.22 +19 4 1.22 +19 5 1.22 +19 6 1.22 +19 7 1.22 +19 8 1.22 +19 9 1.22 +19 10 1.22 +19 11 1.22 +19 12 1.22 +19 13 1.22 +19 14 1.22 +19 15 1.22 +19 16 1.22 +19 17 1.22 +19 18 1.22 +19 19 1.22 +19 20 1.22 +19 21 1.22 +19 22 1.22 +19 23 1.22 +19 24 1.22 +19 25 1.22 +19 26 1.22 +19 27 1.22 +19 28 1.22 +19 29 1.22 +19 30 1.22 +19 31 1.22 +19 32 1.22 +19 33 1.22 +19 34 1.22 +19 35 1.22 +19 36 1.22 +19 37 1.22 +19 38 1.22 +19 39 1.22 +19 40 1.22 +19 41 1.22 +19 42 1.22 +19 43 1.22 +19 44 1.22 +19 45 1.22 +19 46 1.22 +19 47 1.22 +19 48 1.22 +19 49 1.22 +19 50 1.22 +19 51 1.22 +19 52 1.22 +19 53 1.22 +19 54 1.22 +19 55 1.22 +19 56 1.22 +19 57 1.22 +19 58 1.22 +19 59 1.22 +19 60 1.22 +19 61 1.22 +19 62 1.22 +19 63 1.22 +20 0 1.22 +20 1 1.22 +20 2 1.22 +20 3 1.22 +20 4 1.22 +20 5 1.22 +20 6 1.22 +20 7 1.22 +20 8 1.22 +20 9 1.22 +20 10 1.22 +20 11 1.22 +20 12 1.22 +20 13 1.22 +20 14 1.22 +20 15 1.22 +20 16 1.22 +20 17 1.22 +20 18 1.22 +20 19 1.22 +20 20 1.22 +20 21 1.22 +20 22 1.22 +20 23 1.22 +20 24 1.22 +20 25 1.22 +20 26 1.22 +20 27 1.22 +20 28 1.22 +20 29 1.22 +20 30 1.22 +20 31 1.22 +20 32 1.22 +20 33 1.22 +20 34 1.22 +20 35 1.22 +20 36 1.22 +20 37 1.22 +20 38 1.22 +20 39 1.22 +20 40 1.22 +20 41 1.22 +20 42 1.22 +20 43 1.22 +20 44 1.22 +20 45 1.22 +20 46 1.22 +20 47 1.22 +20 48 1.22 +20 49 1.22 +20 50 1.22 +20 51 1.22 +20 52 1.22 +20 53 1.22 +20 54 1.22 +20 55 1.22 +20 56 1.22 +20 57 1.22 +20 58 1.22 +20 59 1.22 +20 60 1.22 +20 61 1.22 +20 62 1.22 +20 63 1.22 +21 0 1.22 +21 1 1.22 +21 2 1.22 +21 3 1.22 +21 4 1.22 +21 5 1.22 +21 6 1.22 +21 7 1.22 +21 8 1.22 +21 9 1.22 +21 10 1.22 +21 11 1.22 +21 12 1.22 +21 13 1.22 +21 14 1.22 +21 15 1.22 +21 16 1.22 +21 17 1.22 +21 18 1.22 +21 19 1.22 +21 20 1.22 +21 21 1.22 +21 22 1.22 +21 23 1.22 +21 24 1.22 +21 25 1.22 +21 26 1.22 +21 27 1.22 +21 28 1.22 +21 29 1.22 +21 30 1.22 +21 31 1.22 +21 32 1.22 +21 33 1.22 +21 34 1.22 +21 35 1.22 +21 36 1.22 +21 37 1.22 +21 38 1.22 +21 39 1.22 +21 40 1.22 +21 41 1.22 +21 42 1.22 +21 43 1.22 +21 44 1.22 +21 45 1.22 +21 46 1.22 +21 47 1.22 +21 48 1.22 +21 49 1.22 +21 50 1.22 +21 51 1.22 +21 52 1.22 +21 53 1.22 +21 54 1.22 +21 55 1.22 +21 56 1.22 +21 57 1.22 +21 58 1.22 +21 59 1.22 +21 60 1.22 +21 61 1.22 +21 62 1.22 +21 63 1.22 +22 0 1.22 +22 1 1.22 +22 2 1.22 +22 3 1.22 +22 4 1.22 +22 5 1.22 +22 6 1.22 +22 7 1.22 +22 8 1.22 +22 9 1.22 +22 10 1.22 +22 11 1.22 +22 12 1.22 +22 13 1.22 +22 14 1.22 +22 15 1.22 +22 16 1.22 +22 17 1.22 +22 18 1.22 +22 19 1.22 +22 20 1.22 +22 21 1.22 +22 22 1.22 +22 23 1.22 +22 24 1.22 +22 25 1.22 +22 26 1.22 +22 27 1.22 +22 28 1.22 +22 29 1.22 +22 30 1.22 +22 31 1.22 +22 32 1.22 +22 33 1.22 +22 34 1.22 +22 35 1.22 +22 36 1.22 +22 37 1.22 +22 38 1.22 +22 39 1.22 +22 40 1.22 +22 41 1.22 +22 42 1.22 +22 43 1.22 +22 44 1.22 +22 45 1.22 +22 46 1.22 +22 47 1.22 +22 48 1.22 +22 49 1.22 +22 50 1.22 +22 51 1.22 +22 52 1.22 +22 53 1.22 +22 54 1.22 +22 55 1.22 +22 56 1.22 +22 57 1.22 +22 58 1.22 +22 59 1.22 +22 60 1.22 +22 61 1.22 +22 62 1.22 +22 63 1.22 +23 0 1.22 +23 1 1.22 +23 2 1.22 +23 3 1.22 +23 4 1.22 +23 5 1.22 +23 6 1.22 +23 7 1.22 +23 8 1.22 +23 9 1.22 +23 10 1.22 +23 11 1.22 +23 12 1.22 +23 13 1.22 +23 14 1.22 +23 15 1.22 +23 16 1.22 +23 17 1.22 +23 18 1.22 +23 19 1.22 +23 20 1.22 +23 21 1.22 +23 22 1.22 +23 23 1.22 +23 24 1.22 +23 25 1.22 +23 26 1.22 +23 27 1.22 +23 28 1.22 +23 29 1.22 +23 30 1.22 +23 31 1.22 +23 32 1.22 +23 33 1.22 +23 34 1.22 +23 35 1.22 +23 36 1.22 +23 37 1.22 +23 38 1.22 +23 39 1.22 +23 40 1.22 +23 41 1.22 +23 42 1.22 +23 43 1.22 +23 44 1.22 +23 45 1.22 +23 46 1.22 +23 47 1.22 +23 48 1.22 +23 49 1.22 +23 50 1.22 +23 51 1.22 +23 52 1.22 +23 53 1.22 +23 54 1.22 +23 55 1.22 +23 56 1.22 +23 57 1.22 +23 58 1.22 +23 59 1.22 +23 60 1.22 +23 61 1.22 +23 62 1.22 +23 63 1.22 diff --git a/calibrations/calo/tower_slope_macro/README.md b/calibrations/calo/tower_slope_macro/README.md new file mode 100644 index 000000000..ab587a6b3 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/README.md @@ -0,0 +1,84 @@ +Various macros and files for running tower slope modules in various situations: + +macros/correction files for running tower slope method on MDC2 files, +OR using various decalibration/calibration updates to the sim and reco frameworks in coresoftware, +including the database accessor wrapper class for accessing calibrations "conditions DB" files. + +Macro/script for running over MDC2 Hits files (Production 4 only) +------------------------------------------- +run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C +do_run_calo_fromMd2Hits_towslope.csh + +Notes: does not need filelist input (e.g. from CreateFileList.pl), see comments inside, takes single +integer input, assuming filenames of Production 4 MDC2 Hits files. For other production +runs beginning of macro/filename parsing part my need up dated. Note that per usual MDC2 +and presumably all sphenix default production/sim file access, only the filename is specified +and lustre system/dcache finds the file and decides/provides appropriate "full path" access method. +Valid filenames can be obtained from CreateFileLists.pl +This macro does not need any other files found in this folder to run, +but can be run in with others present to modify behavior. +Runs all three slope method modules one for each calorimeter +system in central barrel (Emc & Hcal's both) + + +Alternative G4_Setup / "common" macros for +Applying Decal/Cal through Simple Calo calibration +Databse File API's : +------------------------------------------- +G4_CEmc_Spacal.C +G4_HcalIn_ref.C +G4_HcalOut_ref.C + +Notes: place any or all of these in running directory to override those in +$OFFLINE_MAIN/root_macros (originally from sphenix "macros" repository, common/ +In order to specify calibrations and decalibrations using RawTowerCalibration/RawTowerDigitizer +as described in Calo Calibrations meetings Jan-March 2022 +See comments especially many detailed comments in G4_CEmc_Spacal.C +about how to do this. Files needed in most cases can be found below: + + +Example Simple Database Files for Decal/Cal : +------------------------------------------- +HCALIN_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt +HCALIN_GainsCalib1.22.txt +HCALOUT_GainsCalib1.22.txt +HCALOUT_GainsCalib1.12_PosEtaOnly_NegEta1.0.txt +emc_corr_files/*root *.C + +Notes: see inside G4_Setup macros in previous section. +The last emc_corr_files/ subdirectory also contains macros +(for Emc which uses a root file format as opposed to Hcal +which uses a text file format) for generating new decal or calibration +correction patterns for testing + +Macros for doing the actual fitting step +---------------------- +do_eta_fit.C +do_eta_fit2.C + +The fitting step (timeslice1 --> timeslice 2 --see above) +should generally be after merging of tower energy distribution +histogram files (the output of the tower slope module over the +mdc2/production data files). The last function called in the +macro LiteCaloEval::Fit_RelativeShift outputs the +correction which can be read as input in place of the "Example +Simple Database" files above. For CEMC, this is output +into the root file output containing all the other root +output (various graphs, etc.) into a tree with in that file +with the correct name ("emc_corr_tree"). For the Hcals, +for which the correction files should be simple text file +formats, the correction text file is outputted to: +[output_root_filename].HCAL[IN|OUT]_CORR_TXTFILE.txt as +an additional output file besides the usual output_root_file. + + +Older/out of date: (from mdc1 running) +---------------------- +Fun4All_G4_SlopeCal.C +run_f4a.csh + + + do_run_calo_fromMd2Hits_towslope.csh + + + diff --git a/calibrations/calo/tower_slope_macro/do_eta_fit.C b/calibrations/calo/tower_slope_macro/do_eta_fit.C new file mode 100644 index 000000000..6b5810355 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/do_eta_fit.C @@ -0,0 +1,21 @@ + +//double fitf(Double_t * f, Double_t *p); +//TGraph * grff = 0; +#include + +#include "LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +void do_eta_fit(const char * reffile, const char * modfile) +{ + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval reflce, modlce; + reflce.CaloType(LiteCaloEval::HCALOUT); + modlce.CaloType(LiteCaloEval::HCALOUT); + reflce.Get_Histos(reffile); + modlce.Get_Histos(modfile); + modlce.FitRelativeShifts(&reflce,21); + +} + + diff --git a/calibrations/calo/tower_slope_macro/do_eta_fit2.C b/calibrations/calo/tower_slope_macro/do_eta_fit2.C new file mode 100644 index 000000000..cdd4ea137 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/do_eta_fit2.C @@ -0,0 +1,25 @@ + +//double fitf(Double_t * f, Double_t *p); +//TGraph * grff = 0; +#include + +#include "LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +void do_eta_fit2(const char * reffile, const char * infile, const char * modfile) +{ + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval reflce, modlce; + reflce.CaloType(LiteCaloEval::CEMC); + modlce.CaloType(LiteCaloEval::CEMC); + reflce.Get_Histos(reffile); + modlce.Get_Histos(infile,modfile); + modlce.fitmin = 0.12; + modlce.fitmax = 0.7; + modlce.FitRelativeShifts(&reflce,1); + + + +} + + diff --git a/calibrations/calo/tower_slope_macro/do_run_calo_fromMd2Hits_towslope.csh b/calibrations/calo/tower_slope_macro/do_run_calo_fromMd2Hits_towslope.csh new file mode 100755 index 000000000..e229f1f07 --- /dev/null +++ b/calibrations/calo/tower_slope_macro/do_run_calo_fromMd2Hits_towslope.csh @@ -0,0 +1,66 @@ +#!/bin/csh +echo ' ' +echo 'START: '`date` +#setenv HOME /phenix/u/$LOGNAME +#source /etc/csh.login +#source $HOME/.login +#source /opt/phenix/bin/phenix_setup.c + + +#@ z = $1 + 500 +@ z = $1 + 0 + +echo hi justin doing job num $z + +source /opt/sphenix/core/bin/sphenix_setup.csh -n new + +setenv JFINSTALL /phenix/scratch/jfrantz/install/sphenix_bt_mdc2 +ls $JFINSTALL/include + +source /opt/sphenix/core/bin/setup_local.csh $JFINSTALL + +#//setenv JFINSTALL /sphenix/user/jfrantz/newgeom/install +#//setenv LD_LIBRARY_PATH $MYINSTALL/lib:$LD_LIBRARY_PATH +#//set PATH = ($MYINSTALL/bin $path) +#source ~/setldpath.csh . +#//echo $LD_LIBRARY_PATH +#//echo $MYINSTALL +echo $PATH + +#setenv CALIBRATIONROOT $JFINSTALL/share/calibrations/ +#setenv CALIBRATIONROOT /phenix/scratch/jfrantz/install/sphenix_ynewy/share/calibrations/ + +#cd /direct/phenix+u/apun/sphenixabi/macros/macros/g4simulations_embed +#cd /gpfs/mnt/gpfs04/sphenix/user/apun/gitfork/macros/macros/g4simulations +#cd /direct/phenix+u/apun/sphenixabi/macros/macros/g4simulations +#cd /direct/phenix+u/apun/Island/macros/g4simulations +cd /sphenix/user/jfrantz/caloCalib/framew/calotest/ + + root.exe -b < 2 && ket < 5) + corr = 0.88+3.5*0.04; + + if (ket == 9) + corr = 0.88+8*0.04; + + // int ket = + + /* + corr = 1.0/(0.9+ll*0.2); + // corr = 0.9+ll*0.2; + //corr = 0.3000000; + */ + if (i%8==0&& j%128==0) + cout << "towid" << towid << " corr " << corr << endl; + t1.Fill(); + + } + } + + f.Write(); + // f.Close(); + + +} diff --git a/calibrations/calo/tower_slope_macro/run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C b/calibrations/calo/tower_slope_macro/run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C new file mode 100644 index 000000000..d5fab9d6a --- /dev/null +++ b/calibrations/calo/tower_slope_macro/run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo.C @@ -0,0 +1,494 @@ +#ifndef MACRO_FUN4ALLG4CALO_C +#define MACRO_FUN4ALLG4CALO_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + + +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcaloCalibDBFile.so) +R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + + +// For HepMC Hijing +// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat + +int run_calo_fromMDC2Hits_towslope_Fun4All_G4_Calo( + const int nEvents = 2, + // const string &inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + //const string &inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root", + const int mdc2_4_file_num = 1, + const string &outputFile = "newoutput1_calo1", + // const string &inputFile0 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_CALO_G4HIT_sHijing_0_12fm-0000000001-00000.root", + // const string &inputFile1 = "/gpfs/mnt/gpfs02/sphenix/sim/sim01/sphnxpro/MDC2/sHijing_HepMC/fm_0_20/pileup/DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000003-00001.root", //"DST_VERTEX_sHijing_0_12fm-0000000001-00000.root", + // const string &outputFile = "G4sPHENIX_calo1", + const string &outdir = ".") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + + + // string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + // string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-10000.root"; + + //There are 40,000 mdc2 production 4 files. + // this piece of code allows you to simply specify which of the 40k files + // by the single integer input (from 0-40k) mdc2_4_file_num + + string inputFile0 = "DST_CALO_G4HIT_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-"; + string inputFile1 = "DST_VERTEX_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000004-"; + + + int ynum_int = 100000+ mdc2_4_file_num; + TString yn_tstr = ""; + yn_tstr += ynum_int; + yn_tstr.Remove(0,1); + inputFile0 += yn_tstr.Data(); + inputFile1 += yn_tstr.Data(); + + inputFile0 += ".root"; + inputFile1 += ".root"; + + cout << "running over these files" << endl; + cout << inputFile0 << endl; + cout << inputFile1 << endl; + + //const string &outputFile = "newoutput1_calo1", + + + //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. + PHRandomSeed::Verbosity(1); + /* + long mtime = gSystem->Now(); + TString fileOut = outputFile.c_str(); + fileOut += (mtime / 100000 - 8542922)/3; + string outputFile2 = fileOut.Data(); + */ + string outputFile2 = outputFile.c_str(); + outputFile2 = outputFile2 + ".root"; + + // just if we set some flags somewhere in this macro + recoConsts *rc = recoConsts::instance(); + // By default every random number generator uses + // PHRandomSeed() which reads /dev/urandom to get its seed + // if the RANDOMSEED flag is set its value is taken as seed + // You can either set this to a random value using PHRandomSeed() + // which will make all seeds identical (not sure what the point of + // this would be: + // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); + // or set it to a fixed value so you can debug your code + // rc->set_IntFlag("RANDOMSEED", 12345); + + //=============== + // Input options + //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 1; + // First enable the input generators + // Either: + // read previously generated g4-hits files, in this case it opens a DST and skips + // the simulations step completely. The G4Setup macro is only loaded to get information + // about the number of layers used for the cell reco code + Input::READHITS = true; + INPUTREADHITS::filename[0] = inputFile0; + INPUTREADHITS::filename[1] = inputFile1; + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + // This creates the input generator(s) + InputInit(); + + // register all input generators with Fun4All + InputRegister(); + + // set up production relatedstuff + Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + Enable::DSTOUT = false; + Enable::DSTOUT_COMPRESS = false; + DstOut::OutputDir = outdir; +// DstOut::OutputFile = outputFile; + DstOut::OutputFile = outputFile2; + + + //Option to convert DST to human command readable TTree for quick poke around the outputs + // Enable::DSTREADER = true; + + // turn the display on (default off) + Enable::DISPLAY = false; + + //====================== + // What to run + //====================== + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + Enable::CEMC = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; + Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; +// Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true; + + Enable::HCALIN = true; + Enable::HCALIN_CELL = Enable::HCALIN && true; + Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; + // Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true; +// Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true; + + Enable::HCALOUT = true; + Enable::HCALOUT_CELL = Enable::HCALOUT && true; + Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; + // Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true; +// Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true; + + +// Enable::EPD = false; + +// Enable::GLOBAL_RECO = true; + // Enable::GLOBAL_FASTSIM = true; + +// Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + +// Enable::JETS = true; +// Enable::JETS_EVAL = Enable::JETS && true; + + // HI Jet Reco for p+Au / Au+Au collisions (default is false for + // single particle / p+p-only simulations, or for p+Au / Au+Au + // simulations which don't particularly care about jets) +// Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + + // 3-D topoCluster reconstruction, potentially in all calorimeter layers +// Enable::TOPOCLUSTER = true && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER; + // particle flow jet reconstruction - needs topoClusters! +// Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER; + + //--------------- + // Magnet Settings + //--------------- + + // const string magfield = "1.5"; // alternatively to specify a constant magnetic field, give a float number, which will be translated to solenoidal field in T, if string use as fieldmap name (including path) + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database +// G4MAGNET::magfield_rescale = 1; // make consistent with expected Babar field strength of 1.4T + + //--------------- + // Pythia Decayer + //--------------- + // list of decay types in + // $OFFLINE_MAIN/include/g4decayer/EDecayType.hh + // default is All: + // G4P6DECAYER::decayType = EDecayType::kAll; + + // Initialize the selected subsystems + G4Init(); + + //--------------------- + // GEANT4 Detector description + //--------------------- + if (!Input::READHITS) + { + G4Setup(); + } + + //------------------ + // Detector Division + //------------------ + + if (Enable::MBD || Enable::MBDFAKE) Mbd_Reco(); + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + if (Enable::MICROMEGAS_CELL) Micromegas_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + //----------------------------- + // CEMC towering and clustering + //----------------------------- + + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); + + //----------------------------- + // HCAL towering and clustering + //----------------------------- + + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); + + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); + + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (Enable::TOPOCLUSTER) TopoClusterReco(); + + if (Enable::DSTOUT_COMPRESS) ShowerCompress(); + + //-------------- + // SVTX tracking + //-------------- + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) TPC_Clustering(); + if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering(); + + if (Enable::TRACKING_TRACK) + { + TrackingInit(); + Tracking_Reco(); + } + //----------------- + // Global Vertexing + //----------------- + + if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM) + { + cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl; + gSystem->Exit(1); + } + if (Enable::GLOBAL_RECO) + { + Global_Reco(); + } + else if (Enable::GLOBAL_FASTSIM) + { + Global_FastSim(); + } + + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + + //--------- + // Jet reco + //--------- + + if (Enable::JETS) Jet_Reco(); + if (Enable::HIJETS) HIJetReco(); + + if (Enable::PARTICLEFLOW) ParticleFlow(); + + //---------------------- + // Simulation evaluation + //---------------------- + string outputroot = outputFile; + string remove_this = ".root"; + size_t pos = outputroot.find(remove_this); + if (pos != string::npos) + { + outputroot.erase(pos, remove_this.length()); + } + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + out->AddNode("Sync"); + out->AddNode("EventHeader"); + out->AddNode("TOWER_SIM_HCALIN"); + out->AddNode("TOWER_RAW_HCALIN"); + out->AddNode("TOWER_CALIB_HCALIN"); + out->AddNode("CLUSTER_HCALIN"); + out->AddNode("TOWER_SIM_HCALOUT"); + out->AddNode("TOWER_RAW_HCALOUT"); + out->AddNode("TOWER_CALIB_HCALOUT"); + out->AddNode("CLUSTER_HCALOUT"); + out->AddNode("TOWER_SIM_CEMC"); + out->AddNode("TOWER_RAW_CEMC"); + out->AddNode("TOWER_CALIB_CEMC"); + out->AddNode("CLUSTER_CEMC"); + out->AddNode("CLUSTER_POS_COR_CEMC"); +// leave the topo cluster here in case we run this during pass3 + out->AddNode("TOPOCLUSTER_ALLCALO"); + out->AddNode("TOPOCLUSTER_EMCAL"); + out->AddNode("TOPOCLUSTER_HCAL"); + out->AddNode("GlobalVertexMap"); + if (Enable::DSTOUT_COMPRESS) DstCompress(out); + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + if (Enable::DISPLAY) + { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout << "-------------------------------------------------" << endl; + cout << "You are in event display mode. Run one event with" << endl; + cout << "se->run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; + gROOT->ProcessLine("displaycmd()"); + + return 0; + } + + string outputfile = outputFile2 + "_g4hcin_eval.root"; + string outputfile2 = outputFile2 + "_hout.root"; + string outputfile3 = outputFile2 + "_hin_eval_mod.root"; + string outputfile4 = outputFile2 + "_hout_mod.root"; + string outputfile5 = outputFile2 + "_cemc_eval.root"; + string outputfile6 = outputFile2 + "_cemceval_mod.root"; + + + LiteCaloEval *eval = new LiteCaloEval("HOUTEVALUATOR0", "HCALOUT", outputfile2.c_str()); + //"CEMCEVALUATOR2", "CEMC", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval); + + + // LiteCaloEval *eval3a = new LiteCaloEval("HOUTEVALUATOR", "HCALOUT", outputfile4.c_str()); + // // eval->Verbosity(verbosity); + // eval3a->CaloType(LiteCaloEval::HCALOUT); // eval->Verbosity(verbosity); + // eval3a->set_mode(1); + // se->registerSubsystem(eval3a); + + + LiteCaloEval *eval2 = new LiteCaloEval("HINEVALUATOR2", "HCALIN", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval2->CaloType(LiteCaloEval::HCALIN); + se->registerSubsystem(eval2); + + + // LiteCaloEval *eval4a = new LiteCaloEval("HINEVALUATOR4", "HCALIN", outputfile3.c_str()); + // // eval->Verbosity(verbosity); + // eval4a->CaloType(LiteCaloEval::HCALIN); // eval->Verbosity(verbosity); + // eval4a->set_mode(1); + // se->registerSubsystem(eval4a); + + + + LiteCaloEval *eval5 = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile5.c_str()); + // eval->Verbosity(verbosity); + eval5->CaloType(LiteCaloEval::CEMC); + se->registerSubsystem(eval5); + + + // LiteCaloEval *eval6 = new LiteCaloEval("CEMCEVALUATOR", "CEMC", outputfile6.c_str()); + // // eval->Verbosity(verbosity); + // eval6->CaloType(LiteCaloEval::CEMC); + // eval6->set_mode(1); + // se->registerSubsystem(eval6); + + + + /* + LiteCaloEval *eval = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval->CaloType(LiteCaloEval::CEMC); + se->registerSubsystem(eval); + + */ + /* + CaloCalibEmc_Pi0 *eval_pi1 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI0", outputfile2); + // eval_pi1->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi1); + */ + + /* + CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI02", outputfile4); + eval_pi2->set_mode(1); + // eval->Verbosity(verbosity); + se->registerSubsystem(eval_pi2); + */ + + /* + LiteCaloEval *eval3 = new LiteCaloEval("HOUTEVALUATOR", "HCALOUT", outputfile3.c_str()); + // eval->Verbosity(verbosity); + eval3->CaloType(LiteCaloEval::HCALOUT); + // se->registerSubsystem(eval3); + */ + + // if we use a negative number of events we go back to the command line here + if (nEvents < 0) + { + return 0; + } + // if we run the particle generator and use 0 it'll run forever + if (nEvents == 0 && !Input::HEPMC && !Input::READHITS) + { + cout << "using 0 for number of events is a bad idea when using particle generators" << endl; + cout << "it will run forever, so I just return without running anything" << endl; + return 0; + } + + se->run(nEvents); + + //----- + // Exit + //----- + + se->End(); + // se->PrintTimer(); + //se->PrintMemoryTracker(); + std::cout << "All done" << std::endl; + gSystem->Exit(0); + delete se; + /* + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + */ + + return 0; +} +#endif diff --git a/calibrations/calo/tower_slope_macro/run_f4a.csh b/calibrations/calo/tower_slope_macro/run_f4a.csh new file mode 100755 index 000000000..46491b90b --- /dev/null +++ b/calibrations/calo/tower_slope_macro/run_f4a.csh @@ -0,0 +1,15 @@ +#!/bin/csh +echo ' ' +echo 'START: '`date` +source ~/setup_sphenix.sh +source ~/setldpath.csh sphenix +source /opt/sphenix/core/bin/setup_local.csh $JFINSTALL +echo $LD_LIBRARY_PATH +root.exe -b <.C +For flattening ("eta slice/rings") mode: rings_do_eta_fit2_.C + is either CEMC, HCALIN, or HCALOUT +Both macros have the same exact steps involved, the rings version just uses a different fitting method. +The fitting step (timeslice1 --> timeslice 2 --see above) should generally be after merging of tower energy + distribution histogram files (the output of the tower slope module over the mdc2/production data files). + The last function called in the macro LiteCaloEval::Fit_RelativeShift outputs the correction which can be + read as input in place of the "Example Simple Database" files above. For CEMC, this is output into the root + file output containing all the other root output (various graphs, etc.) into a tree within that file with + the correct name ("emc_corr_tree"). For the Hcals, for which the correction files should be simple text file + formats, the correction text file is outputted to: [output_root_filename].HCAL[IN|OUT]_CORR_TXTFILE.txt as an + additional output file besides the usual output_root_file. + +**To run** \: Each calorimeter has its own macro (see macro folder – /calibrations/calo/tower_slope_macro). More so, each mode as mentioned above has its own macro with the eta slice flattening mode having a prefix of ‘rings’ added to the name (rings_do_eta_fit2_.C) See further below under ‘Mode Types’ for more details. +The histogram naming is separated by calotype. The most important ones are individual towers, and the phi-integrated (a.k.a eta slice / eta ring) ones. + +The histogram names are: +• EMCal +o Tower – emc_ietaX_phiY, where X is eta bin and Y is the phi bin +o Eta slice – eta_X +• I/OHCal +o Tower – hcal__eta_X_phi_Y +o Eta Slice – hcal_eta_X + +**Mode Types** + + _The gain trace mode_ macro (do_eta_fit2_.C ) takes 3 parameters respectively: +• Reffile – this parameter should be a root file that contains all merged calo histograms (see Init Run) from a specific run in sims, or whatever time period with real data +• Infile – this parameter is the exact same file as refile but with modified tower energies, thus modified tower energy distributions +• Modfile – the output file you want to write to + The very last function used in the macro (FitRelativeShifts) called takes on two parameters. The first is the object, reflce, is the object made in the macro and the second is a parameter that sets several flags. The second variable is an integer and typical value is 10. In the 10’s place (the 1) is for smoothing of histograms [ hist->Smooth( ) ], and the digit in the 1’s place (the 0) is to run over all towers – if it were set to 1, it would only run eta slices. So, typical value for this parameter are 0, 10, or 20. + + _Flattening mode_ ( rings_do_eta_fit2_.C ) takes only 2 parameters: +• Infile – the same parameter as above. +• Modfile – same parameter as above + +The FitRelativeShifts function call in this macro takes on the same parameters, but the second (the integer mentioned above) takes on 3 numbers. The usual incantation is 110, again where each digit controls a flag (see LiteCaloEval.cc, L940). The hundreds place controls whether or not the flattening mode runs, and the tens and ones place are the same flag as above. + +**Exclusion of Towers in flattening mode** + +In the flattening mode, when a tower is being fit, its histogram is removed from the eta slice histogram. For example, in IHCal, one eta slice histogram contains only 63 towers, not 64. Same concept applies to OHCal and EMCal. + +The towers that correspond to the chimney sector of OHCal are skipped over, or not fit at all, and also their respective towers are removed from the eta slice histogram. As of now (6/6/23), the towers corresponding from the TPC support rods are also skipped and their towers removed from the eta slice histogram. + +This code will be generalized soon to use a generic bad tower definition to exclude for the eta slices/rings. + +**Fit Ranges of Spectra** + +For fit Min/Max fit ranges, see any of the "Macros for doing the fitting step listed above", pretty much most macros in this folder, for examples of setting these. Fit ranges were determined by trial and error, close to the values used for some latest performance plots as of start of run23 can be found in the macros. + + + diff --git a/calibrations/calo/tower_slope_run23/do_eta_fit2.C b/calibrations/calo/tower_slope_run23/do_eta_fit2.C new file mode 100644 index 000000000..8675c7317 --- /dev/null +++ b/calibrations/calo/tower_slope_run23/do_eta_fit2.C @@ -0,0 +1,25 @@ + +//double fitf(Double_t * f, Double_t *p); +//TGraph * grff = 0; +#include + +#include "LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +void do_eta_fit2(const char * reffile, const char * infile, const char * modfile) +{ + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval reflce, modlce; + reflce.CaloType(LiteCaloEval::HCALIN); + modlce.CaloType(LiteCaloEval::HCALIN); + reflce.Get_Histos(reffile); + modlce.Get_Histos(infile,modfile); + modlce.fitmin = 0.12; + modlce.fitmax = 0.7; + modlce.FitRelativeShifts(&reflce,0); + + + +} + + diff --git a/calibrations/calo/tower_slope_run23/do_eta_fit2_emc.C b/calibrations/calo/tower_slope_run23/do_eta_fit2_emc.C new file mode 100644 index 000000000..452a4ee2d --- /dev/null +++ b/calibrations/calo/tower_slope_run23/do_eta_fit2_emc.C @@ -0,0 +1,46 @@ +#include + +#include "litecaloeval/LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +// File parameters - not modified histos, modified histos, output +void do_eta_fit2_emc(const char * reffile, const char * infile, const char * modfile) +{ + + TStopwatch t; + t.Start(); + + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + + /// create LCE objects, one for a mod set of histos (modlce) and other for non mod set of histos (reflce) + LiteCaloEval reflce, modlce; + + + ///set the calo type to run over + reflce.CaloType(LiteCaloEval::CEMC); + modlce.CaloType(LiteCaloEval::CEMC); + + + /// get histograms for not mod histos + reflce.Get_Histos(reffile); + + /// get histograms for mod histos + modlce.Get_Histos(infile,modfile); + + ///set the fit range + modlce.setFitMin(0.12); + modlce.setFitMax(0.7); + + + /*Fit histos,obtain fit values. Second parameter determines smoothing/include phi loop (individual towers). + If set to e.g. 10 - do 1 smoothing and run over phi. + If set to 11, do one smoothing and dont do phi loop. Can do just 0 or 1. Which would be no smoothing, and + include phi if 0, and dont include if 1. + */ + modlce.FitRelativeShifts(&reflce,10); + + t.Stop(); + t.Print(); + +} diff --git a/calibrations/calo/tower_slope_run23/do_eta_fit2_ihcal.C b/calibrations/calo/tower_slope_run23/do_eta_fit2_ihcal.C new file mode 100644 index 000000000..5eb4d2dac --- /dev/null +++ b/calibrations/calo/tower_slope_run23/do_eta_fit2_ihcal.C @@ -0,0 +1,36 @@ +#include + +#include "LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +/// typical parameters, despite the naming here, is modified histo, non modified, output file +void do_eta_fit2_ihcal(const char * reffile, const char * infile, const char * modfile) +{ + + TStopwatch t; + t.Start(); + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + + + LiteCaloEval reflce, modlce; + + reflce.CaloType(LiteCaloEval::HCALIN); + modlce.CaloType(LiteCaloEval::HCALIN); + + reflce.Get_Histos(reffile); // get histos for modified files + modlce.Get_Histos(infile,modfile); // get histos for non mod files + + /// we want to fit our nonmod/reference histogram and then + /// adjust the modified histo according to such fit + modlce.setFitMin(0.1); + modlce.setFitMax(0.4); + + /// Modlce holds histos with no energy modifications. What we then want to + /// do is give the modified files, fit them, and compare with the nonmod + modlce.FitRelativeShifts(&reflce,10); + + t.Stop(); + t.Print(); + +} diff --git a/calibrations/calo/tower_slope_run23/do_eta_fit2_ohcal.C b/calibrations/calo/tower_slope_run23/do_eta_fit2_ohcal.C new file mode 100644 index 000000000..440c56b60 --- /dev/null +++ b/calibrations/calo/tower_slope_run23/do_eta_fit2_ohcal.C @@ -0,0 +1,29 @@ +#include + +#include "litecaloeval/LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +// regular file, modified file, output file +void do_eta_fit2_ohcal(const char * reffile, const char * infile, const char * modfile) +{ + TStopwatch t; + t.Start(); + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval reflce, modlce; + + reflce.CaloType(LiteCaloEval::HCALOUT); + modlce.CaloType(LiteCaloEval::HCALOUT); + + reflce.Get_Histos(reffile); + modlce.Get_Histos(infile,modfile); + + modlce.setFitMin(0.12); + modlce.setFitMax(0.7); + + modlce.FitRelativeShifts(&reflce,10); + + t.Stop(); + t.Print(); + +} diff --git a/calibrations/calo/tower_slope_run23/dst_simple_towerslope_runmacro.C b/calibrations/calo/tower_slope_run23/dst_simple_towerslope_runmacro.C new file mode 100644 index 000000000..bf3f0f6e4 --- /dev/null +++ b/calibrations/calo/tower_slope_run23/dst_simple_towerslope_runmacro.C @@ -0,0 +1,68 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +//#include +#include + +#include + + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +//R__LOAD_LIBRARY(libCaloTowerBuilder.so) +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + + +#endif + +// to get files from my local area +void dst_simple_towerslope_runmacro(int nevents = 1e5, const char *fname = "/sphenix/user/sregmi/FINAL_VERSION/tower_slope_old_tower_method/3_RawWaveformTowerBuilder/macro/testoutput_400.root") + +{ + gSystem->Load("libg4dst"); + + Fun4AllServer *se = Fun4AllServer::instance(); + + // CaloWaveFormSim *ca = new CaloWaveFormSim("CALOWAVEFORMSIM",outfile); + // ca->Detector("CEMC"); + // se->registerSubsystem(ca); + + // Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in"); + // in->fileopen(fname); + + Fun4AllInputManager *in = new Fun4AllDstInputManager("in"); + + in->fileopen(fname); + //CaloTowerBuilder *ca = new CaloTowerBuilder(); + + + LiteCaloEval *eval7e = new LiteCaloEval("CEMCEVALUATOR2", "CEMC", "output_towerslope.root"); + // LiteCaloEval *eval = new LiteCaloEval("HOCEMCEVALUATOR2", "HCALOUT", outputfile.c_str()); + // eval->Verbosity(verbosity); + eval7e->CaloType(LiteCaloEval::CEMC); + //eval->CaloType(LiteCaloEval::HCALOUT); + se->registerSubsystem(eval7e); + + + + + // in->AddListFile("g4hits.list"); + +// Fun4All + se->registerInputManager(in); + + //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", "testoutput_400.root"); + + //out->StripNode("WAVEFORMS_CEMC"); + //se->registerOutputManager(out); + + se->run(nevents); + + se->End(); + se->PrintTimer(); + gSystem->Exit(0); +} diff --git a/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_emc.C b/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_emc.C new file mode 100644 index 000000000..7574d2be4 --- /dev/null +++ b/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_emc.C @@ -0,0 +1,31 @@ +#include + +#include "litecaloeval/LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +// regular file, modified file, output file +void rings_do_eta_fit2_emc(const char * infile, const char * modfile) +{ + TStopwatch t; + t.Start(); + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval modlce; + + //reflce.CaloType(LiteCaloEval::CEMC); + modlce.CaloType(LiteCaloEval::CEMC); + + /// we really dont need to retrieve histos here bc we arent using ref object + /// reflce.Get_Histos(reffile); + + modlce.Get_Histos(infile,modfile); + + modlce.setFitMin(0.12); + modlce.setFitMax(0.7); + + modlce.FitRelativeShifts(&modlce,110); + + t.Stop(); + t.Print(); + +} diff --git a/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_ihcal.C b/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_ihcal.C new file mode 100644 index 000000000..24aa0310b --- /dev/null +++ b/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_ihcal.C @@ -0,0 +1,29 @@ +#include + +#include "litecaloeval/LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +// regular file, modified file, output file +void rings_do_eta_fit2_ihcal(const char * infile, const char * modfile) +{ + TStopwatch t; + t.Start(); + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + LiteCaloEval modlce; + + //reflce.CaloType(LiteCaloEval::HCALIN); + modlce.CaloType(LiteCaloEval::HCALIN); + + //reflce.Get_Histos(reffile); + modlce.Get_Histos(infile,modfile); + + modlce.setFitMin(0.1); + modlce.setFitMax(0.4); + + modlce.FitRelativeShifts(&modlce,110); + + t.Stop(); + t.Print(); + +} diff --git a/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_ohcal.C b/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_ohcal.C new file mode 100644 index 000000000..247a21a57 --- /dev/null +++ b/calibrations/calo/tower_slope_run23/rings_do_eta_fit2_ohcal.C @@ -0,0 +1,30 @@ +#include + +#include "litecaloeval/LiteCaloEval.h" +R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so) + +// regular file, modified file, output file +void rings_do_eta_fit2_ohcal(/*const char * reffile,*/ const char * infile, const char * modfile) +{ + TStopwatch t; + t.Start(); + + gSystem->Load("libLiteCaloEvalTowSlope.so"); + //LiteCaloEval reflce; + LiteCaloEval modlce; + + //reflce.CaloType(LiteCaloEval::HCALOUT); + modlce.CaloType(LiteCaloEval::HCALOUT); + + ///reflce.Get_Histos(reffile); + modlce.Get_Histos(infile,modfile); + + modlce.setFitMin(0.12); + modlce.setFitMax(0.7); + + modlce.FitRelativeShifts(&modlce, 110); + + t.Stop(); + t.Print(); + +} diff --git a/common/CDBUtils.C b/common/CDBUtils.C new file mode 100644 index 000000000..45d8a1622 --- /dev/null +++ b/common/CDBUtils.C @@ -0,0 +1,140 @@ +#ifndef CDBUTILS_C +#define CDBUTILS_C + +#include +#include + +#include + +R__LOAD_LIBRARY(libsphenixnpc.so) +R__LOAD_LIBRARY(libphool.so) + +CDBUtils *uti = nullptr; + +CDBUtils *getCDBUtils() +{ + return uti; +} + +void listGlobalTags() +{ + if (!uti) uti = new CDBUtils(); + uti->listGlobalTags(); + return; +} + +void listPayloadTypes() +{ + if (!uti) uti = new CDBUtils(); + uti->listPayloadTypes(); + return; +} + +void listPayloadIOVs(uint64_t iov) +{ + if (!uti) uti = new CDBUtils(); + uti->listPayloadIOVs(iov); + return; +} + +void createGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->createGlobalTag(tagname); + return; +} + +void deleteGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->deleteGlobalTag(tagname); + return; +} + +void lockGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->lockGlobalTag(tagname); + return; +} + +void unlockGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + uti->unlockGlobalTag(tagname); + return; +} + +int setGlobalTag(const std::string &tagname) +{ + if (!uti) uti = new CDBUtils(); + int iret = uti->setGlobalTag(tagname); + return iret; +} + +int cloneGlobalTag(const std::string &source, const std::string &target) +{ + if (!uti) uti = new CDBUtils(); + int iret = uti->cloneGlobalTag(source, target); + return iret; +} + + +int createPayloadType(const std::string &pt) +{ + if (!uti) uti = new CDBUtils(); + int iret = uti->createPayloadType(pt); + return iret; +} + +int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start) +{ + if (!uti) uti = new CDBUtils(); + if (uti->isGlobalTagSet()) + { + uti->insertPayload(pl_type,file_url,iov_start); + } + return 0; +} + +int insertPayload(const std::string &pl_type, const std::string &file_url, uint64_t iov_start, uint64_t iov_end) +{ + if (!uti) uti = new CDBUtils(); + if (uti->isGlobalTagSet()) + { + uti->insertPayload(pl_type,file_url,iov_start,iov_end); + } + return 0; +} + +std::string getCalibration(const std::string &pl_type, uint64_t iov) +{ + if (!uti) uti = new CDBUtils(); + return uti->getUrl(pl_type,iov); +} + +void clearCache() +{ + if (!uti) uti = new CDBUtils(); + return uti->clearCache(); +} + +void Verbosity(int verb) +{ + if (!uti) uti = new CDBUtils(); + return uti->Verbosity(verb); +} + +int deletePayloadIOV(const std::string& pl_type, uint64_t iov_start) +{ + if (!uti) uti = new CDBUtils(); + return uti->deletePayloadIOV(pl_type,iov_start); +} + +int deletePayloadIOV(const std::string& pl_type, uint64_t iov_start, uint64_t iov_end) +{ + if (!uti) uti = new CDBUtils(); + return uti->deletePayloadIOV(pl_type,iov_start, iov_end); +} + +#endif diff --git a/macros/g4simulations/DisplayOn.C b/common/DisplayOn.C similarity index 65% rename from macros/g4simulations/DisplayOn.C rename to common/DisplayOn.C index be968b6ef..61ebef1b1 100644 --- a/macros/g4simulations/DisplayOn.C +++ b/common/DisplayOn.C @@ -1,3 +1,31 @@ +#ifndef MACRO_DISPLAYON_C +#define MACRO_DISPLAYON_C + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + +namespace Enable +{ + bool DISPLAY = false; +} + +// This starts the QT based G4 gui which takes control +// when x'ed out it will return a pointer to PHG4Reco so +// the gui can be startrd again +PHG4Reco *QTGui() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); + g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); + g4->StartGui(); + return g4; +} + // stupid macro to turn on the geant4 display // we ask Fun4All for a pointer to PHG4Reco // using the ApplyCommand will start up the @@ -6,12 +34,13 @@ // start up the visualization, the next event will // be displayed. Do not execute this macro // before PHG4Reco was registered with Fun4All -PHG4Reco * DisplayOn(const char *mac = "vis.mac") +PHG4Reco *DisplayOn(const char *mac = "vis.mac") { char cmd[100]; Fun4AllServer *se = Fun4AllServer::instance(); PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); sprintf(cmd, "/control/execute %s", mac); g4->ApplyCommand(cmd); return g4; @@ -32,3 +61,4 @@ void displaycmd() cout << "set background color:" << endl; cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl; } +#endif diff --git a/common/Fun4All_CaloProduction.C b/common/Fun4All_CaloProduction.C new file mode 100644 index 000000000..d622d7a1b --- /dev/null +++ b/common/Fun4All_CaloProduction.C @@ -0,0 +1,71 @@ +#pragma once +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0) +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libffamodules.so) + +#endif +void Fun4All_CaloProduction(const char *fname = "/gpfs/mnt/gpfs02/sphenix/user/trinn/combined_event_prdfs/calib-00007377-0000.prdf", const char *outfile = "testfile.root", int nskip = 0, int nevents = 0) +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(0); + recoConsts *rc = recoConsts::instance(); + + //=============== + // conditions DB flags + //=============== + // ENABLE::CDB = true; + // global tag + rc->set_StringFlag("CDB_GLOBALTAG","MDC2"); + rc->set_uint64Flag("TIMESTAMP",6); + + CaloTowerBuilder *ca = new CaloTowerBuilder(); + ca->set_detector_type(CaloTowerBuilder::CEMC); + ca->set_nsamples(31); + ca->set_processing_type(CaloWaveformProcessing::TEMPLATE); + se->registerSubsystem(ca); + + CaloTowerBuilder *ca1 = new CaloTowerBuilder(); + ca1->set_detector_type(CaloTowerBuilder::HCALIN); + ca1->set_nsamples(31); + ca1->set_processing_type(CaloWaveformProcessing::TEMPLATE); + se->registerSubsystem(ca1); + + CaloTowerBuilder *ca2 = new CaloTowerBuilder(); + ca2->set_detector_type(CaloTowerBuilder::HCALOUT); + ca2->set_nsamples(31); + ca2->set_processing_type(CaloWaveformProcessing::TEMPLATE); + se->registerSubsystem(ca2); + + Fun4AllInputManager *in = new Fun4AllPrdfInputManager("in"); + in->fileopen(fname); + se->registerInputManager(in); + + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outfile); + se->registerOutputManager(out); + + + se->skip(nskip); + se->run(nevents); + se->End(); + se->PrintTimer(); + gSystem->Exit(0); +} diff --git a/common/G4_ActsGeom.C b/common/G4_ActsGeom.C new file mode 100644 index 000000000..23e88d864 --- /dev/null +++ b/common/G4_ActsGeom.C @@ -0,0 +1,71 @@ +#ifndef MACRO_G4ACTSGEOM_C +#define MACRO_G4ACTSGEOM_C + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libqa_modules.so) + +#include + +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundefined-internal" +#include +#pragma GCC diagnostic pop + +#include + + +namespace ACTSGEOM +{ + + unsigned int mvtxMisalignment = 1; + unsigned int inttMisalignment = 1; + unsigned int tpcMisalignment = 1; + unsigned int tpotMisalignment = 1; + + void ActsGeomInit() + { + static bool wasCalled = false; + if (wasCalled) + { + return; + } + wasCalled = true; + + if (!Enable::MICROMEGAS) + { + G4MICROMEGAS::n_micromegas_layer = 0; + } + + // Build the Acts geometry + auto se = Fun4AllServer::instance(); + int verbosity = Enable::VERBOSITY; + + // Geometry must be built before any Acts modules + MakeActsGeometry* geom = new MakeActsGeometry(); + geom->set_drift_velocity(G4TPC::tpc_drift_velocity_reco); + geom->Verbosity(verbosity); + for(int i = 0; i < 57; i++) + { + if(i<3) { + geom->misalignmentFactor(i, ACTSGEOM::mvtxMisalignment); + } else if (i < 7) { + geom->misalignmentFactor(i, ACTSGEOM::inttMisalignment); + } else if (i < 55) { + geom->misalignmentFactor(i, ACTSGEOM::tpcMisalignment); + } else { + geom->misalignmentFactor(i, ACTSGEOM::tpotMisalignment); + } + } + + geom->loadMagField(G4TRACKING::init_acts_magfield); + geom->setMagField(G4MAGNET::magfield); + geom->setMagFieldRescale(G4MAGNET::magfield_rescale); + se->registerSubsystem(geom); + } +} // namespace ACTSGEOM + +#endif diff --git a/common/G4_BeamLine.C b/common/G4_BeamLine.C new file mode 100644 index 000000000..87b353647 --- /dev/null +++ b/common/G4_BeamLine.C @@ -0,0 +1,346 @@ +#ifndef MACRO_G4BEAMLINE_C +#define MACRO_G4BEAMLINE_C + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +float PosFlip(float pos); +float AngleFlip(float angle); +float MagFieldFlip(float Bfield); + +// This creates the Enable Flag to be used in the main steering macro +namespace Enable +{ + bool BEAMLINE = false; + bool BEAMLINE_ABSORBER = false; + bool BEAMLINE_BLACKHOLE = false; + bool BEAMLINE_OVERLAPCHECK = false; + int BEAMLINE_VERBOSITY = 0; + +} // namespace Enable + +namespace G4BEAMLINE +{ + // the beampipes seem to add 2 no_overlaps - needs to be looked at + // but this z position takes care of our current overlap issues + double starting_z = G4PIPE::max_z + 2*no_overlapp; + double enclosure_z_max = 2050. + (800-starting_z); + double enclosure_r_max = 30.; // 30cm radius to cover magnets + double enclosure_center = 0.5 * (starting_z + enclosure_z_max); + double skin_thickness = 0.; // if center of magnet iron is black hole - thickness of Fe surrounding it + int pipe_id_offset = 100; + int roman_pot_pipe_id_offset = 200; + PHG4CylinderSubsystem *ForwardBeamLineEnclosure(nullptr); + PHG4CylinderSubsystem *BackwardBeamLineEnclosure(nullptr); + +} // namespace BeamLine + +void BeamLineInit() +{ + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4BEAMLINE::enclosure_z_max); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4BEAMLINE::enclosure_z_max); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4BEAMLINE::enclosure_r_max); +} + +void BeamLineDefineMagnets(PHG4Reco *g4Reco) +{ + bool overlapCheck = Enable::OVERLAPCHECK || Enable::BEAMLINE_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::BEAMLINE_ABSORBER; + + int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); + + G4BEAMLINE::ForwardBeamLineEnclosure = new PHG4CylinderSubsystem("ForwardBeamLineEnclosure"); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("place_z", G4BEAMLINE::enclosure_center ); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("radius", 0); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("thickness", G4BEAMLINE::enclosure_r_max); + G4BEAMLINE::ForwardBeamLineEnclosure->set_double_param("length", G4BEAMLINE::enclosure_z_max - G4BEAMLINE::starting_z); + G4BEAMLINE::ForwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + G4BEAMLINE::ForwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + G4BEAMLINE::ForwardBeamLineEnclosure->OverlapCheck(overlapCheck); + if (verbosity) G4BEAMLINE::ForwardBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + + G4BEAMLINE::BackwardBeamLineEnclosure = new PHG4CylinderSubsystem("BackwardBeamLineEnclosure"); + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("place_z", -G4BEAMLINE::enclosure_center); + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("radius", 0); + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("thickness", G4BEAMLINE::enclosure_r_max); // This is intentionally made large 25cm radius + G4BEAMLINE::BackwardBeamLineEnclosure->set_double_param("length", G4BEAMLINE::enclosure_z_max - G4BEAMLINE::starting_z); + G4BEAMLINE::BackwardBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + G4BEAMLINE::BackwardBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + G4BEAMLINE::BackwardBeamLineEnclosure->OverlapCheck(overlapCheck); + if (verbosity) G4BEAMLINE::BackwardBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + + string magFile; + magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; + + // if you insert numbers it only displays those magnets, do not comment out the set declaration + set magnetlist; + //magnetlist.insert(7); + + BeamLineMagnetSubsystem *bl = nullptr; + std::ifstream infile(magFile); + if (infile.is_open()) + { + double biggest_z = 0.; + int imagnet = 0; + std::string line; + while (std::getline(infile, line)) + { + if (!line.compare(0, 1, "B") || + !line.compare(0, 1, "Q") || + !line.compare(0, 1, "S")) + { + std::istringstream iss(line); + string magname; + double x; + double y; + double z; + double inner_radius_zin; + double inner_radius_zout; + double outer_magnet_diameter; + double length; + double angle; + double dipole_field_x; + double fieldgradient; + if (!(iss >> magname >> x >> y >> z >> inner_radius_zin >> inner_radius_zout >> outer_magnet_diameter >> length >> angle >> dipole_field_x >> fieldgradient)) + { + cout << "could not decode " << line << endl; + gSystem->Exit(1); + } + else + { + //------------------------ + + string magtype; + if (inner_radius_zin != inner_radius_zout) + { + cout << "inner radius at front of magnet " << inner_radius_zin + << " not equal radius at back of magnet " << inner_radius_zout + << " needs change in code (replace tube by cone for beamline)" << endl; + gSystem->Exit(1); + } + if (verbosity > 0) + { + cout << endl + << endl + << "\tID number " << imagnet << endl; + cout << "magname: " << magname << endl; + cout << "x: " << x << endl; + cout << "y: " << y << endl; + cout << "z: " << z << endl; + cout << "inner_radius_zin: " << inner_radius_zin << endl; + cout << "inner_radius_zout: " << inner_radius_zout << endl; + cout << "outer_magnet_diameter: " << outer_magnet_diameter << endl; + cout << "length: " << length << endl; + cout << "angle: " << angle << endl; + cout << "dipole_field_x: " << dipole_field_x << endl; + cout << "fieldgradient: " << fieldgradient << endl; + } + if (!magname.compare(0, 1, "B")) + { + magtype = "DIPOLE"; + } + else if (!magname.compare(0, 1, "Q")) + { + magtype = "QUADRUPOLE"; + } + else if (!magname.compare(0, 1, "S")) + { + magtype = "SEXTUPOLE"; + } + else + { + cout << "cannot decode magnet name " << magname << endl; + gSystem->Exit(1); + } + // convert to our units (cm, deg) + x *= 100.; + y *= 100.; + z *= 100.; + length *= 100.; + inner_radius_zin *= 100.; + outer_magnet_diameter *= 100.; + angle = (angle / M_PI * 180.) / 1000.; // given in mrad + + //------------------------ + + if (magnetlist.empty() || magnetlist.find(imagnet) != magnetlist.end()) + { + bl = new BeamLineMagnetSubsystem("BEAMLINEMAGNET", imagnet); + bl->set_double_param("field_y", MagFieldFlip(dipole_field_x)); + bl->set_double_param("fieldgradient", MagFieldFlip(fieldgradient)); + bl->set_string_param("magtype", magtype); + bl->set_double_param("length", length); + bl->set_double_param("place_x", PosFlip(x)); // relative position to mother vol. + bl->set_double_param("place_y", y); // relative position to mother vol. + if (z > 0) + { + bl->set_double_param("place_z", z - G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + else + { + bl->set_double_param("place_z", z + G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + bl->set_double_param("field_global_position_x", PosFlip(x)); // abs. position to world for field manager + bl->set_double_param("field_global_position_y", y); // abs. position to world for field manager + bl->set_double_param("field_global_position_z", z); // abs. position to world for field manager + bl->set_double_param("rot_y", AngleFlip(angle)); + bl->set_double_param("field_global_rot_y", AngleFlip(angle)); // abs. rotation to world for field manager + bl->set_double_param("inner_radius", inner_radius_zin); + bl->set_double_param("outer_radius", outer_magnet_diameter / 2.); + bl->set_double_param("skin_thickness",G4BEAMLINE::skin_thickness); + bl->SetActive(AbsorberActive); + bl->SetAbsorberActive(AbsorberActive); + if (Enable::BEAMLINE_BLACKHOLE) bl->BlackHole(); // turn magnets into black holes + if (z > 0) + { + bl->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + } + else + { + bl->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + } + bl->OverlapCheck(overlapCheck); + bl->SuperDetector("BEAMLINEMAGNET"); + if (verbosity) bl->Verbosity(verbosity); + g4Reco->registerSubsystem(bl); + } + imagnet++; + if (fabs(z) + length > biggest_z) + { + biggest_z = fabs(z) + length; + } + } + } + } + infile.close(); + } +} + +void BeamLineDefineBeamPipe(PHG4Reco *g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::BEAMLINE_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::BEAMLINE_ABSORBER; + int verbosity = std::max(Enable::VERBOSITY, Enable::BEAMLINE_VERBOSITY); + + const int ntube = 10; + const string nm[ntube] = {"B00", "B01", "B10", "B11", "B20", "B21", "B30", "B31", "B32", "B33"}; + const double qlen[ntube] = {233.8, 233.8, 118.7, 118.7, 217.16, 217.16, 182.5, 182.5, 182.5, 182.5}; + const double qir[ntube] = {6.08, 6.08, 14.60, 14.60, 20.0, 20.0, 6.07, 6.07, 6.07, 6.07}; + const double qor[ntube] = {6.35, 6.35, 15.24, 15.24, 20.96, 20.96, 6.35, 6.35, 6.35, 6.35}; + const double qrot[ntube] = {0, 0, 0, 0, 0, 0, 1.074, -1.074, -1.074, 1.074}; //degree + const double qxC[ntube] = {0, 0, 0, 0, 0, 0, 12.820, -12.820, 12.820, -12.820}; + const double qyC[ntube] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + const double qzC[ntube] = {863.1, -863.1, 1474.470, -1474.470, 1642.4, -1642.4, 1843.2, 1843.2, -1843.2, -1843.2}; + for (int i = 0; i < ntube; i++) + { + string name = "beamPipe" + nm[i]; + PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(name, G4BEAMLINE::pipe_id_offset + i); + if (Enable::BEAMLINE_BLACKHOLE) pipe->BlackHole(); + pipe->set_color(1,0,0,1.); + pipe->set_double_param("radius", qir[i]); + pipe->set_double_param("thickness", qor[i] - qir[i]); + pipe->set_double_param("length", qlen[i]); + pipe->set_double_param("rot_y", qrot[i]); + pipe->set_string_param("material", "G4_STAINLESS-STEEL"); + pipe->set_double_param("place_x", PosFlip(qxC[i])); + pipe->set_double_param("place_y", qyC[i]); + if (qzC[i] > 0) + { + pipe->set_double_param("place_z", qzC[i] - G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + else + { + pipe->set_double_param("place_z", qzC[i] + G4BEAMLINE::enclosure_center); // relative position to mother vol. + } + if (AbsorberActive) pipe->SetActive(); + pipe->SuperDetector("PIPE"); + if (qzC[i] > 0) + { + pipe->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + } + else + { + pipe->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + } + + pipe->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(pipe); + } + + //Roman Pot pipe + const int nSec = 2; + const double len[nSec] = {20.87, 20.87}; + const double ir1[nSec] = {7.14, 14.60}; + const double or1[nSec] = {7.77, 15.24}; + const double ir2[nSec] = {14.60, 7.14}; + const double or2[nSec] = {15.24, 7.77}; + const double xC[nSec] = {0, 0}; + const double yC[nSec] = {0, 0}; + const double zC[nSec] = {1394.25, -1394.25}; + for (int i = 0; i < nSec; i++) + { + string name = "beamPipeRP" + to_string(i); + PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(name, G4BEAMLINE::roman_pot_pipe_id_offset + i); + pipe->set_string_param("material", "G4_STAINLESS-STEEL"); + pipe->set_double_param("place_x", PosFlip(xC[i])); + pipe->set_double_param("place_y", yC[i]); + if (zC[i] > 0) + { + pipe->set_double_param("place_z", zC[i] - G4BEAMLINE::enclosure_center); + } + else + { + pipe->set_double_param("place_z", zC[i] + G4BEAMLINE::enclosure_center); + } + pipe->set_double_param("length", len[i]); + pipe->set_double_param("rmin1", ir1[i]); + pipe->set_double_param("rmin2", ir2[i]); + pipe->set_double_param("rmax1", or1[i]); + pipe->set_double_param("rmax2", or2[i]); + if (zC[i] > 0) + { + pipe->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + } + else + { + pipe->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + } + if (AbsorberActive) pipe->SetActive(); + if (Enable::BEAMLINE_BLACKHOLE) pipe->BlackHole(); + pipe->set_color(1,0,0,1.); + pipe->SuperDetector("PIPE"); + pipe->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(pipe); + } +} + +float PosFlip(float pos) +{ + return pos; +}; +float AngleFlip(float angle) +{ + return angle; +}; +float MagFieldFlip(float Bfield) +{ + return Bfield; +}; + +#endif diff --git a/common/G4_BlackHole.C b/common/G4_BlackHole.C new file mode 100644 index 000000000..12bc26c2f --- /dev/null +++ b/common/G4_BlackHole.C @@ -0,0 +1,98 @@ +#ifndef MACRO_G4BLACKHOLE_C +#define MACRO_G4BLACKHOLE_C + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool BLACKHOLE = false; + bool BLACKHOLE_SAVEHITS = true; + bool BLACKHOLE_FORWARD_SAVEHITS = true; +} // namespace Enable + +void BlackHoleInit() {} + +void BlackHole(PHG4Reco *g4Reco, double radius) +{ + // swallow all particles coming out of our detector + if (radius < BlackHoleGeometry::max_radius) + { + radius = BlackHoleGeometry::max_radius; + } + double blackhole_length = (BlackHoleGeometry::max_z - BlackHoleGeometry::min_z) + 2 * BlackHoleGeometry::gap; + double blackhole_zpos = BlackHoleGeometry::min_z - BlackHoleGeometry::gap + blackhole_length / 2.; + double blackhole_radius = radius + BlackHoleGeometry::gap; // make the black hole slightly larger than the radius + PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); + blackhole->set_double_param("radius", blackhole_radius); + blackhole->set_double_param("length", blackhole_length); // make it cover the world in length + blackhole->set_double_param("place_z", blackhole_zpos); + blackhole->set_double_param("thickness", BlackHoleGeometry::gap / 2.); // it needs some thickness + if (BlackHoleGeometry::visible) + { + blackhole->set_color(1, 0, 0, 0.7); + } + blackhole->BlackHole(); + if (Enable::BLACKHOLE_SAVEHITS) + { + blackhole->SetActive(); // see what leaks out + } + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + + //---------------------------------------- + // FORWARD/BACKWARD BLACKHOLEs (thin disks, thickness is radius, length is thickness) + // +Z + // if min/max z is not symmetric, the cylinder is not centered around z=0 + // to find the offset we start with the middle of the barrel at blackhole_zpos, then add its length/2. which + // gets us to the end of the cylinder, then we add another gap so the endcap does not overlap + // the endcap itself is BlackHoleGeometry::gap/2 thick, leaving BlackHoleGeometry::gap/4 on each side of the + // center. Basically we have a gap of BlackHoleGeometry::gap/4 between the barrel and the endplates + // therefore we add BlackHoleGeometry::gap to the radius of the endcap so particles trying to go through + // the tiny gap between barren and endplate will hit the endplate + double blackhole_forward_zpos = blackhole_zpos + blackhole_length / 2. + BlackHoleGeometry::gap / 2.; + blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); + blackhole->SuperDetector("BH_FORWARD_PLUS"); + blackhole->set_double_param("radius", 0.); + blackhole->set_double_param("thickness", blackhole_radius + BlackHoleGeometry::gap); // add a bit so we cover the microscopic gap (BlackHoleGeometry::gap) between barrel and endplate + blackhole->set_double_param("length", BlackHoleGeometry::gap / 2.); // it needs some thickness but not go outside world + blackhole->set_double_param("place_z", blackhole_forward_zpos); // put at the end of the world + if (BlackHoleGeometry::visible) + { + blackhole->set_color(1, 0, 0, 0.7); + } + blackhole->BlackHole(); + if (Enable::BLACKHOLE_SAVEHITS && Enable::BLACKHOLE_FORWARD_SAVEHITS) + { + blackhole->SetActive(); // see what leaks out + } + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + + // -Z + double blackhole_backward_zpos = blackhole_zpos - (blackhole_length / 2. + BlackHoleGeometry::gap / 2.); + + blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); + blackhole->SuperDetector("BH_FORWARD_NEG"); + blackhole->set_double_param("radius", 0); // add 10 cm + blackhole->set_double_param("thickness", blackhole_radius + BlackHoleGeometry::gap); // add a bit so we cover the microscopic gap (BlackHoleGeometry::gap) between barrel and endplate + blackhole->set_double_param("length", BlackHoleGeometry::gap / 2.); // it needs some thickness but not go outside world + blackhole->set_double_param("place_z", blackhole_backward_zpos); + if (BlackHoleGeometry::visible) + { + blackhole->set_color(1, 0, 0, 0.7); + } + blackhole->BlackHole(); + if (Enable::BLACKHOLE_SAVEHITS && Enable::BLACKHOLE_FORWARD_SAVEHITS) + { + blackhole->SetActive(); // always see what leaks out + } + blackhole->OverlapCheck(true); + g4Reco->registerSubsystem(blackhole); + return; +} +#endif diff --git a/common/G4_CEmc_Albedo.C b/common/G4_CEmc_Albedo.C new file mode 100644 index 000000000..0614e4ee3 --- /dev/null +++ b/common/G4_CEmc_Albedo.C @@ -0,0 +1,48 @@ +#ifndef MACRO_G4CEMCALBEDO_C +#define MACRO_G4CEMCALBEDO_C + +#include + +#include + +#include + +namespace Enable +{ + bool CEMCALBEDO = false; + bool CEMCALBEDO_ABSORBER = false; +} // namespace Enable + +namespace G4CEMCALBEDO +{ + double teflon_cylinder_thickness = 1.5; + double inner_radius = 95. - teflon_cylinder_thickness; // inner radius emc, 1.5cm electronics subtracted + double albedo_thickness = 2.; +} // namespace G4CEMCALBEDO + +void CEmcAlbedoInit() +{ + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 149.47); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -149.47); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4CEMCALBEDO::inner_radius + G4CEMCALBEDO::teflon_cylinder_thickness + G4CEMCALBEDO::albedo_thickness); +} + +void CEmcAlbedo(PHG4Reco *g4Reco) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMCALBEDO_ABSORBER; + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->SuperDetector("CEMC_MOCKUP"); + cyl->set_double_param("radius", G4CEMCALBEDO::inner_radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", G4CEMCALBEDO::teflon_cylinder_thickness); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + cyl = new PHG4CylinderSubsystem("CEMC_ALBEDO", 1); + cyl->SuperDetector("CEMC_MOCKUP"); + cyl->set_double_param("radius", G4CEMCALBEDO::inner_radius + G4CEMCALBEDO::teflon_cylinder_thickness); + cyl->set_string_param("material", "Spacal_W_Epoxy"); + cyl->set_double_param("thickness", G4CEMCALBEDO::albedo_thickness); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); +} +#endif diff --git a/common/G4_CEmc_Spacal.C b/common/G4_CEmc_Spacal.C new file mode 100644 index 000000000..28b147dff --- /dev/null +++ b/common/G4_CEmc_Spacal.C @@ -0,0 +1,382 @@ +#ifndef MACRO_G4CEMCSPACAL_C +#define MACRO_G4CEMCSPACAL_C + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings); + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool CEMC = false; + bool CEMC_ABSORBER = false; + bool CEMC_OVERLAPCHECK = false; + bool CEMC_CELL = false; + bool CEMC_TOWER = false; + bool CEMC_CLUSTER = false; + bool CEMC_EVAL = false; + bool CEMC_QA = false; + bool CEMC_G4Hit = true; + int CEMC_VERBOSITY = 0; +} // namespace Enable + +namespace G4CEMC +{ + int Min_cemc_layer = 1; + int Max_cemc_layer = 1; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // directly pass the energy of sim tower to digitized tower + // kNo_digitization + // simple digitization with photon statistics, single amplitude ADC conversion and pedestal + // kSimple_photon_digitization + // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal + // kSiPM_photon_digitization + + // 2D azimuthal projective SPACAL (slow) + int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; + + enum enu_Cemc_clusterizer + { + kCemcGraphClusterizer, + + kCemcTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_Cemc_clusterizer Cemc_clusterizer = kCemcTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + // enu_Cemc_clusterizer Cemc_clusterizer = kCemcGraphClusterizer; + +} // namespace G4CEMC + +// black hole parameters are set in CEmc function +// needs a dummy argument to play with current G4Setup_sPHENIX.C +void CEmcInit(const int i = 0) +{ +} + +//! EMCal main setup macro +double +CEmc(PHG4Reco *g4Reco, double radius, const int crossings) +{ + return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ crossings); +} + +//! 2D full projective SPACAL +double +CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::CEMC_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::CEMC_OVERLAPCHECK; + + double emc_inner_radius = 92; // emc inner radius from engineering drawing + double cemcthickness = 22.50000 - no_overlapp; + + // max radius is 116 cm; + double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius + assert(emc_outer_radius < 116); + + if (radius > emc_inner_radius) + { + cout << "inconsistency: preshower radius+thickness: " << radius + << " larger than emc inner radius: " << emc_inner_radius << endl; + gSystem->Exit(-1); + } + + // the radii are only to determined the thickness of the cemc + radius = emc_inner_radius; + + // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) + PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); + cyl->set_double_param("radius", radius); + cyl->set_string_param("material", "G4_TEFLON"); + cyl->set_double_param("thickness", 1.5 - no_overlapp); + cyl->SuperDetector("CEMC_ELECTRONICS"); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + radius += 1.5; + cemcthickness -= 1.5 + no_overlapp; + + // 0.5cm thick Stainless Steel as an approximation for EMCAl support system + cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); + cyl->SuperDetector("CEMC_SPT"); + cyl->set_double_param("radius", radius + cemcthickness - 0.5); + cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel + cyl->set_double_param("thickness", 0.5 - no_overlapp); + cyl->OverlapCheck(OverlapCheck); + if (AbsorberActive) cyl->SetActive(); + g4Reco->registerSubsystem(cyl); + + // this is the z extend and outer radius of the support structure and therefore the z extend + // and radius of the surrounding black holes + double sptlen = PHG4Utils::GetLengthForRapidityCoverage(radius + cemcthickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, sptlen); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -sptlen); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, radius + cemcthickness); + + cemcthickness -= 0.5 + no_overlapp; + + int ilayer = 0; + PHG4SpacalSubsystem *cemc; + + cemc = new PHG4SpacalSubsystem("CEMC", ilayer); + + cemc->set_int_param("virualize_fiber", 0); + cemc->set_int_param("azimuthal_seg_visible", 1); + cemc->set_int_param("construction_verbose", 0); + cemc->Verbosity(0); + cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); + cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2023ProjTilted/")); + cemc->set_double_param("radius", radius); // overwrite minimal radius + cemc->set_double_param("thickness", cemcthickness); // overwrite thickness + if(G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) cemc->set_int_param("saveg4hit", Enable::CEMC_G4Hit); + + cemc->SetActive(); + cemc->SuperDetector("CEMC"); + if (AbsorberActive) cemc->SetAbsorberActive(); + cemc->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(cemc); + + if (ilayer > G4CEMC::Max_cemc_layer) + { + cout << "layer discrepancy, current layer " << ilayer + << " max cemc layer: " << G4CEMC::Max_cemc_layer << endl; + } + + radius += cemcthickness; + radius += no_overlapp; + + return radius; +} + +void CEMC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) + { + PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + for (int i = G4CEMC::Min_cemc_layer; i <= G4CEMC::Max_cemc_layer; i++) + { + // cemc_cells->etaphisize(i, 0.024, 0.024); + const double radius = 95; + cemc_cells->cellsize(i, 2 * M_PI / 256. * radius, 2 * M_PI / 256. * radius); + } + se->registerSubsystem(cemc_cells); + } + else if (G4CEMC::Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) + { + if (!Enable::CEMC_G4Hit) return; + PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); + cemc_cells->Detector("CEMC"); + cemc_cells->Verbosity(verbosity); + cemc_cells->get_light_collection_model().load_data_file( + string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype3Module.xml"), + "data_grid_light_guide_efficiency", "data_grid_fiber_trans"); + se->registerSubsystem(cemc_cells); + } + else + { + cout << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" + << G4CEMC::Cemc_spacal_configuration << ". Force exiting..." << endl; + gSystem->Exit(-1); + return; + } + + return; +} + +void CEMC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + if (Enable::CEMC_G4Hit) + { + RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); + TowerBuilder->Detector("CEMC"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + } + double sampling_fraction = 1; + // sampling_fraction = 0.02244; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 2.36081e-02; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root + // sampling_fraction = 1.90951e-02; // 2017 Tilt porjective SPACAL, 8 GeV photon, eta = 0.3 - 0.4 + sampling_fraction = 2e-02; // 2017 Tilt porjective SPACAL, tower-by-tower calibration + const double photoelectron_per_GeV = 500; // 500 photon per total GeV deposition + + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); + TowerDigitizer->Detector("CEMC"); + TowerDigitizer->Verbosity(verbosity); + TowerDigitizer->set_digi_algorithm(G4CEMC::TowerDigi); + TowerDigitizer->set_variable_pedestal(true); // read ped central and width from calibrations file comment next 2 lines if true + // TowerDigitizer->set_pedstal_central_ADC(0); + // TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting + TowerDigitizer->set_photonelec_ADC(1); // not simulating ADC discretization error + TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); + TowerDigitizer->set_variable_zero_suppression(true); // read zs values from calibrations file comment next line if true + // TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting + if (!Enable::CEMC_G4Hit) TowerDigitizer->set_towerinfo(RawTowerDigitizer::ProcessTowerType::kTowerInfoOnly); // just use towerinfo + if (Enable::CDB) + { + TowerDigitizer->GetParameters().ReadFromCDB("EMCTOWERCALIB"); + } + else + { + TowerDigitizer->GetParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + } + se->registerSubsystem(TowerDigitizer); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); + TowerCalibration->Detector("CEMC"); + TowerCalibration->Verbosity(verbosity); + if (!Enable::CEMC_G4Hit) TowerCalibration->set_towerinfo(RawTowerCalibration::ProcessTowerType::kTowerInfoOnly); // just use towerinfo + if (G4CEMC::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // just use sampling fraction set previously + TowerCalibration->set_calib_const_GeV_ADC(1.0 / sampling_fraction); + } + else + { + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kTower_by_tower_calibration); + if (Enable::CDB) + { + TowerCalibration->GetCalibrationParameters().ReadFromCDB("EMCTOWERCALIB"); + } + else + { + TowerCalibration->GetCalibrationParameters().ReadFromFile("CEMC", "xml", 0, 0, + string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalibCombinedParams_2020/")); // calibration database + } + TowerCalibration->set_variable_GeV_ADC(true); // read GeV per ADC from calibrations file comment next line if true + // TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715); // overall energy scale based on 4-GeV photon simulations + TowerCalibration->set_variable_pedestal(true); // read pedestals from calibrations file comment next line if true + // TowerCalibration->set_pedstal_ADC(0); + } + se->registerSubsystem(TowerCalibration); + + return; +} + +void CEMC_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("EmcRawClusterBuilderTemplate"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_threshold_energy(0.030); // This threshold should be the same as in CEMCprof_Thresh**.root file below + std::string emc_prof = getenv("CALIBRATIONROOT"); + emc_prof += "/EmcProfile/CEMCprof_Thresh30MeV.root"; + ClusterBuilder->LoadProfile(emc_prof); + if (!Enable::CEMC_G4Hit) ClusterBuilder->set_UseTowerInfo(1); // just use towerinfo + // ClusterBuilder->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + se->registerSubsystem(ClusterBuilder); + } + else if (G4CEMC::Cemc_clusterizer == G4CEMC::kCemcGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("EmcRawClusterBuilderGraph"); + ClusterBuilder->Detector("CEMC"); + ClusterBuilder->Verbosity(verbosity); + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "CEMC_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); + if (!Enable::CEMC_G4Hit) clusterCorrection->set_UseTowerInfo(1); // just use towerinfo + // clusterCorrection->set_UseTowerInfo(1); // to use towerinfo objects rather than old RawTower + +// if (Enable::CDB) +// { +// clusterCorrection->Get_eclus_CalibrationParameters().ReadFromCDB("CEMCRECALIB"); +// clusterCorrection->Get_ecore_CalibrationParameters().ReadFromCDB("CEMC_ECORE_RECALIB"); +// } +// else +// { +// clusterCorrection->Get_eclus_CalibrationParameters().ReadFromFile("CEMC_RECALIB", "xml", 0, 0, +// // raw location +// string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); +// clusterCorrection->Get_ecore_CalibrationParameters().ReadFromFile("CEMC_ECORE_RECALIB", "xml", 0, 0, +// // raw location +// string(getenv("CALIBRATIONROOT")) + string("/CEMC/PositionRecalibration_EMCal_9deg_tilt/")); +// } + + clusterCorrection->Verbosity(verbosity); + se->registerSubsystem(clusterCorrection); + + return; +} +void CEMC_Eval(const std::string &outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void CEMC_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::CEMC_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("CEMC"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/common/G4_CaloTrigger.C b/common/G4_CaloTrigger.C new file mode 100644 index 000000000..0f8d85d4e --- /dev/null +++ b/common/G4_CaloTrigger.C @@ -0,0 +1,34 @@ +#ifndef MACRO_G4CALOTRIGGER_C +#define MACRO_G4CALOTRIGGER_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalotrigger.so) + +namespace Enable +{ + bool CALOTRIGGER = false; + int CALOTRIGGER_VERBOSITY = 0; +} // namespace Enable + +void CaloTrigger_Sim() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::CALOTRIGGER_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + CaloTriggerSim* calotriggersim = new CaloTriggerSim(); + calotriggersim->Verbosity(verbosity); + se->registerSubsystem(calotriggersim); + + return; +} +#endif diff --git a/common/G4_Centrality.C b/common/G4_Centrality.C new file mode 100644 index 000000000..79066466b --- /dev/null +++ b/common/G4_Centrality.C @@ -0,0 +1,43 @@ +#ifndef MACRO_G4CENTRALITY_C +#define MACRO_G4CENTRALITY_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libcentrality_io.so) +R__LOAD_LIBRARY(libg4centrality.so) + +namespace Enable +{ + bool CENTRALITY = false; + int CENTRALITY_VERBOSITY = 0; +} // namespace Enable + +void Centrality() +{ + int verbosity = max(Enable::VERBOSITY, Enable::CENTRALITY_VERBOSITY); + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4CentralityReco *cent = new PHG4CentralityReco(); + cent->Verbosity(verbosity); + if (Enable::CDB) + { + cent->GetCalibrationParameters().ReadFromCDB("CENTRALITY"); + } + else + { + cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/")); + } + se->registerSubsystem( cent ); + + return; +} +#endif diff --git a/common/G4_DSTReader.C b/common/G4_DSTReader.C new file mode 100644 index 000000000..c05bca454 --- /dev/null +++ b/common/G4_DSTReader.C @@ -0,0 +1,165 @@ +#ifndef MACRO_G4DSTREADER_C +#define MACRO_G4DSTREADER_C + +#include + +#include +#include +#include +#include +#include +#include +#include +/* +#include +#include +#include +#include +*/ +#include + +#include + +R__LOAD_LIBRARY(libg4eval.so) + +////////////////////////////////////////////////////////////////// +/*! + \file G4_DSTReader.C + \brief Convert DST to human command readable TTree for quick poke around the outputs + \author Jin Huang + \version $Revision: $ + \date $Date: $ + */ +////////////////////////////////////////////////////////////////// + +namespace Enable +{ + bool DSTREADER = false; + int DSTREADER_VERBOSITY = 0; +} // namespace Enable + +namespace G4DSTREADER +{ + bool save_g4_raw = true; + double tower_zero_supp = 1.e-6; +} // namespace G4DSTREADER + +void G4DSTreaderInit() {} + +void G4DSTreader(const string &outputFile = "G4sPHENIXCells.root") +{ + int verbosity = max(Enable::VERBOSITY, Enable::DSTREADER_VERBOSITY); + + // save a comprehensive evaluation file + PHG4DSTReader *ana = new PHG4DSTReader(outputFile); + ana->set_save_particle(true); + ana->set_load_all_particle(false); + ana->set_load_active_particle(true); + ana->set_save_vertex(true); + + ana->Verbosity(verbosity); + + if (G4DSTREADER::save_g4_raw) + { + if (Enable::MVTX) + { + ana->AddNode("MVTX"); + } + if (Enable::INTT) + { + ana->AddNode("INTT"); + } + if (Enable::TPC) + { + ana->AddNode("TPC"); + } + if (Enable::MBD) + { + ana->AddNode("MBD"); + } + + if (Enable::CEMC) + { + ana->AddNode("CEMC"); + if (Enable::ABSORBER || Enable::CEMC_ABSORBER) + { + ana->AddNode("ABSORBER_CEMC"); + ana->AddNode("CEMC_ELECTRONICS"); + ana->AddNode("CEMC_SPT"); + } + } + + if (Enable::HCALIN) + { + ana->AddNode("HCALIN"); + if (Enable::ABSORBER || Enable::HCALIN_ABSORBER) + { + ana->AddNode("ABSORBER_HCALIN"); + } + } + + if (Enable::MAGNET) + { + if (Enable::ABSORBER || Enable::MAGNET_ABSORBER) + { + ana->AddNode("MAGNET"); + } + } + + if (Enable::HCALOUT) + { + ana->AddNode("HCALOUT"); + if (Enable::ABSORBER || Enable::HCALOUT_ABSORBER) + { + ana->AddNode("ABSORBER_HCALOUT"); + } + } + + if (Enable::EPD) + { + ana->AddNode("EPD"); + } + + if (Enable::BLACKHOLE) + { + ana->AddNode("BH_1"); + ana->AddNode("BH_FORWARD_PLUS"); + ana->AddNode("BH_FORWARD_NEG"); + } + } + + ana->set_tower_zero_sup(G4DSTREADER::tower_zero_supp); + if (Enable::CEMC_TOWER) + { + ana->AddTower("SIM_CEMC"); + ana->AddTower("RAW_CEMC"); + ana->AddTower("CALIB_CEMC"); + } + if (Enable::HCALIN_TOWER) + { + ana->AddTower("SIM_HCALIN"); + ana->AddTower("RAW_HCALIN"); + ana->AddTower("CALIB_HCALIN"); + } + if (Enable::HCALOUT_TOWER) + { + ana->AddTower("SIM_HCALOUT"); + ana->AddTower("RAW_HCALOUT"); + ana->AddTower("CALIB_HCALOUT"); + } + // Jets disabled for now + // if (do_jet_reco) + // { + // + // ana->AddJet("AntiKt06JetsInPerfect"); + // ana->AddJet("G4TowerJets_6"); + // } + // if (embed_input_file && do_jet_reco) + // { + // ana->AddJet("G4TowerJets_combined_6"); + // } + + Fun4AllServer *se = Fun4AllServer::instance(); + se->registerSubsystem(ana); +} +#endif diff --git a/common/G4_EPD.C b/common/G4_EPD.C new file mode 100644 index 000000000..8d61b43f7 --- /dev/null +++ b/common/G4_EPD.C @@ -0,0 +1,58 @@ +#ifndef COMMON_G4EPD_C +#define COMMON_G4EPD_C + +#include + +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4epd.so) + +namespace Enable +{ + bool EPD = false; + bool EPD_TILE = false; + bool EPD_OVERLAPCHECK = false; +} // namespace Enable + +namespace G4EPD +{ + double dz = 6.; + double place_z = 316.; +} + +void EPDInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 91.); + // using default z-position and add 10 cm for tile thickness + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4EPD::place_z - G4EPD::dz/2. - no_overlapp); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4EPD::place_z + G4EPD::dz/2. + no_overlapp); +} + +void EPD(PHG4Reco* g4Reco) +{ + bool overlap_check = Enable::OVERLAPCHECK || Enable::EPD_OVERLAPCHECK; + + PHG4EPDSubsystem* epd = new PHG4EPDSubsystem("EPD"); + + epd->SuperDetector("EPD"); + epd->OverlapCheck(overlap_check); + epd->SetActive(); + + g4Reco->registerSubsystem(epd); +} + +void EPD_Tiles() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + PHG4EPDModuleReco *TileBuilder = new PHG4EPDModuleReco("EPDTileBuilder"); + TileBuilder->Detector("EPD"); + TileBuilder->set_double_param("epdmpv",2.064e-6); + se->registerSubsystem(TileBuilder); +} + +#endif /* COMMON_G4EPD_C */ diff --git a/common/G4_Global.C b/common/G4_Global.C new file mode 100644 index 000000000..15af33ed8 --- /dev/null +++ b/common/G4_Global.C @@ -0,0 +1,60 @@ +#ifndef MACRO_G4GLOBAL_C +#define MACRO_G4GLOBAL_C + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4vertex.so) +R__LOAD_LIBRARY(libglobalvertex.so) +namespace Enable +{ + bool GLOBAL_RECO = false; + bool GLOBAL_FASTSIM = false; + int GLOBAL_VERBOSITY = 0; +} // namespace Enable + +namespace G4GLOBAL +{ + double x_smearing = 0.01; // 100 um + double y_smearing = 0.01; // 100 um + double z_smearing = 0.015; // 150um + double t_smearing = 0.002; // 20ps +} // namespace G4GLOBAL + +void GlobalInit() {} + +void Global_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::GLOBAL_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + + GlobalVertexReco* gblvertex = new GlobalVertexReco(); + gblvertex->Verbosity(verbosity); + se->registerSubsystem(gblvertex); + + return; +} + +void Global_FastSim() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::GLOBAL_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + + GlobalVertexFastSimReco* gblvertex = new GlobalVertexFastSimReco(); + gblvertex->set_x_smearing(G4GLOBAL::x_smearing); + gblvertex->set_y_smearing(G4GLOBAL::y_smearing); + gblvertex->set_z_smearing(G4GLOBAL::z_smearing); + gblvertex->set_t_smearing(G4GLOBAL::t_smearing); + gblvertex->Verbosity(verbosity); + + se->registerSubsystem(gblvertex); + + return; +} +#endif diff --git a/common/G4_HIJetReco.C b/common/G4_HIJetReco.C new file mode 100644 index 000000000..2b46104c3 --- /dev/null +++ b/common/G4_HIJetReco.C @@ -0,0 +1,149 @@ +#ifndef MACRO_G4HIJETRECO_C +#define MACRO_G4HIJETRECO_C + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libjetbase.so) +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libjetbackground.so) + +namespace Enable +{ + bool HIJETS = false; + int HIJETS_VERBOSITY = 0; +} // namespace Enable + +namespace G4HIJETS +{ + bool do_flow = false; + bool do_CS = false; +} // namespace G4HIJETS + +void HIJetReco() +{ + + int verbosity = std::max(Enable::VERBOSITY, Enable::HIJETS_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + JetReco *truthjetreco = new JetReco(); + TruthJetInput *tji = new TruthJetInput(Jet::PARTICLE); + tji->add_embedding_flag(0); // changes depending on signal vs. embedded + truthjetreco->add_input(tji); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Truth_r02"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Truth_r03"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Truth_r04"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Truth_r05"); + truthjetreco->set_algo_node("ANTIKT"); + truthjetreco->set_input_node("TRUTH"); + truthjetreco->Verbosity(verbosity); + se->registerSubsystem(truthjetreco); + + + + RetowerCEMC *rcemc = new RetowerCEMC(); + rcemc->Verbosity(verbosity); + rcemc->set_towerinfo(true); + se->registerSubsystem(rcemc); + + JetReco *towerjetreco = new JetReco(); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWERINFO_RETOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWERINFO)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWERINFO)); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_TowerInfo_HIRecoSeedsRaw_r02"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + DetermineTowerBackground *dtb = new DetermineTowerBackground(); + dtb->SetBackgroundOutputName("TowerInfoBackground_Sub1"); + dtb->SetFlow(G4HIJETS::do_flow); + dtb->SetSeedType(0); + dtb->SetSeedJetD(3); + dtb->set_towerinfo(true); + dtb->Verbosity(verbosity); + se->registerSubsystem(dtb); + + + CopyAndSubtractJets *casj = new CopyAndSubtractJets(); + casj->SetFlowModulation(G4HIJETS::do_flow); + casj->Verbosity(verbosity); + casj->set_towerinfo(true); + se->registerSubsystem(casj); + + + DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); + dtb2->SetBackgroundOutputName("TowerInfoBackground_Sub2"); + dtb2->SetFlow(G4HIJETS::do_flow); + dtb2->SetSeedType(1); + dtb2->SetSeedJetPt(7); + dtb2->Verbosity(verbosity); + dtb2->set_towerinfo(true); + se->registerSubsystem(dtb2); + + + SubtractTowers *st = new SubtractTowers(); + st->SetFlowModulation(G4HIJETS::do_flow); + st->Verbosity(verbosity); + st->set_towerinfo(true); + se->registerSubsystem(st); + + towerjetreco = new JetReco(); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWERINFO_SUB1)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWERINFO_SUB1)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWERINFO_SUB1)); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.2, verbosity), "AntiKt_Tower_r02_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.3, verbosity), "AntiKt_Tower_r03_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.4, verbosity), "AntiKt_Tower_r04_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.5, verbosity), "AntiKt_Tower_r05_Sub1"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + if (G4HIJETS::do_CS) + { + SubtractTowersCS *stCS = new SubtractTowersCS(); + stCS->SetFlowModulation(G4HIJETS::do_flow); + stCS->SetAlpha(1); + stCS->SetDeltaRmax(0.3); + stCS->Verbosity(verbosity); + se->registerSubsystem(stCS); + + JetReco *towerjetrecoCS = new JetReco(); + towerjetrecoCS->add_input(new TowerJetInput(Jet::CEMC_TOWER_SUB1CS)); + towerjetrecoCS->add_input(new TowerJetInput(Jet::HCALIN_TOWER_SUB1CS)); + towerjetrecoCS->add_input(new TowerJetInput(Jet::HCALOUT_TOWER_SUB1CS)); + // note that CS can use the regular FastJetAlgo without extra modifications for negative-E inputs + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2, verbosity), "AntiKt_Tower_r02_Sub1CS"); + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3, verbosity), "AntiKt_Tower_r03_Sub1CS"); + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4, verbosity), "AntiKt_Tower_r04_Sub1CS"); + towerjetrecoCS->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5, verbosity), "AntiKt_Tower_r05_Sub1CS"); + towerjetrecoCS->set_algo_node("ANTIKT"); + towerjetrecoCS->set_input_node("TOWER"); + towerjetrecoCS->Verbosity(verbosity); + se->registerSubsystem(towerjetrecoCS); + } + + return; +} +#endif diff --git a/common/G4_HcalIn_ref.C b/common/G4_HcalIn_ref.C new file mode 100644 index 000000000..5cf5df507 --- /dev/null +++ b/common/G4_HcalIn_ref.C @@ -0,0 +1,379 @@ +// Inner HCal reconstruction macro +#ifndef MACRO_G4HCALINREF_C +#define MACRO_G4HCALINREF_C + +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4ihcal.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool HCALIN = false; + bool HCALIN_ABSORBER = false; + bool HCALIN_OVERLAPCHECK = false; + bool HCALIN_CELL = false; + bool HCALIN_TOWER = false; + bool HCALIN_CLUSTER = false; + bool HCALIN_EVAL = false; + bool HCALIN_QA = false; + bool HCALIN_SUPPORT = false; + bool HCALIN_OLD = false; + bool HCALIN_G4Hit = true; + int HCALIN_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALIN +{ + double inch = 2.54; + double support_ring_outer_radius = 177.323; + double support_ring_z = 175.375 * inch / 2; + double dz = 4. * inch; + + double phistart = NAN; + double tower_emin = NAN; + int light_scint_model = -1; + int tower_energy_source = -1; + + // Inner HCal absorber material selector: + // false - old version, absorber material is SS310 + // true - default Choose if you want Aluminum + bool inner_hcal_material_Al = true; + + int inner_hcal_eic = 0; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // directly pass the energy of sim tower to digitized tower + // kNo_digitization + // simple digitization with photon statistics, single amplitude ADC conversion and pedestal + // kSimple_photon_digitization + // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal + // kSiPM_photon_digitization + + enum enu_HCalIn_clusterizer + { + kHCalInGraphClusterizer, + + kHCalInTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + // enu_HCalIn_clusterizer HCalIn_clusterizer = kHCalInGraphClusterizer; +} // namespace G4HCALIN + +// Init is called by G4Setup.C +void HCalInnerInit(const int iflag = 0) +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALIN::support_ring_outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALIN::support_ring_z + G4HCALIN::dz / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALIN::support_ring_z - G4HCALIN::dz / 2.); + if (iflag == 1) + { + G4HCALIN::inner_hcal_eic = 1; + } +} + +double HCalInner(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALIN_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALIN_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + PHG4DetectorSubsystem *hcal = nullptr; + // Mephi Maps + // Maps are different for old/new but how to set is identical + // here are the ones for the gdml based inner hcal + // use hcal->set_string_param("MapFileName",""); to disable map + // hcal->set_string_param("MapFileName",std::string(getenv("CALIBRATIONROOT")) + "/HCALIN/tilemap/ihcalgdmlmap09212022.root"); + // hcal->set_string_param("MapHistoName","ihcalcombinedgdmlnormtbyt"); + // use hcal->set_string_param("MapFileName",""); to disable map + // hcal->set_string_param("MapFileName",std::string(getenv("CALIBRATIONROOT")) + "/HCALIN/tilemap/ihcalgdmlmap09212022.root"); + // hcal->set_string_param("MapHistoName","ihcalcombinedgdmlnormtbyt"); + + // all sizes are in cm! + if (Enable::HCALIN_OLD) + { + hcal = new PHG4InnerHcalSubsystem("HCALIN"); + // these are the parameters you can change with their default settings + // hcal->set_string_param("material","SS310"); + if (G4HCALIN::inner_hcal_material_Al) + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with G4_Al" << endl; + } + hcal->set_string_param("material", "G4_Al"); + } + else + { + if (verbosity > 0) + { + cout << "HCalInner - construct inner HCal absorber with SS310" << endl; + } + hcal->set_string_param("material", "SS310"); + } + // hcal->set_double_param("inner_radius", 117.27); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", 134.42); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_gap", 0.85); + // hcal->set_double_param("scinti_outer_gap", 1.22 * (5.0 / 4.0)); + // hcal->set_double_param("scinti_outer_radius", 133.3); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", 175.94 * 2); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", 36.15); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 4); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "SS310"); + } + else + { + hcal = new PHG4IHCalSubsystem("HCALIN"); + // hcal->set_string_param("GDMPath", "mytestgdml.gdml"); // try other gdml file + } + if (G4HCALIN::light_scint_model >= 0) + { + hcal->set_int_param("light_scint_model", G4HCALIN::light_scint_model); + } + hcal->SetActive(); + hcal->SuperDetector("HCALIN"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + if (!isfinite(G4HCALIN::phistart)) + { + if (Enable::HCALIN_OLD) + { + G4HCALIN::phistart = 0.0328877688; // offet in phi (from zero) extracted from geantinos + } + else + { + G4HCALIN::phistart = 0.0445549893; // offet in phi (from zero) extracted from geantinos + } + } + hcal->set_int_param("saveg4hit", Enable::HCALIN_G4Hit); + hcal->set_double_param("phistart", G4HCALIN::phistart); + hcal->OverlapCheck(OverlapCheck); + + g4Reco->registerSubsystem(hcal); + + radius = hcal->get_double_param("outer_radius"); + + // HCalInner_SupportRing(g4Reco); + + radius += no_overlapp; + return radius; +} + +void HCALInner_Cells() +{ + if (!Enable::HCALIN_G4Hit) return; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); + hc->Detector("HCALIN"); + hc->Verbosity(verbosity); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALInner_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + if (Enable::HCALIN_G4Hit) + { + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); + TowerBuilder->Detector("HCALIN"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + if (!isfinite(G4HCALIN::phistart)) + { + if (Enable::HCALIN_OLD) + { + G4HCALIN::phistart = 0.0328877688; // offet in phi (from zero) extracted from geantinos + } + else + { + G4HCALIN::phistart = 0.0445549893; // offet in phi (from zero) extracted from geantinos + } + } + TowerBuilder->set_double_param("phistart", G4HCALIN::phistart); + if (isfinite(G4HCALIN::tower_emin)) + { + TowerBuilder->set_double_param("emin", G4HCALIN::tower_emin); + } + if (G4HCALIN::tower_energy_source >= 0) + { + TowerBuilder->set_int_param("tower_energy_source", G4HCALIN::tower_energy_source); + } + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + } + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalInRawTowerDigitizer"); + TowerDigitizer->Detector("HCALIN"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALIN::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(32. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + TowerDigitizer->Verbosity(verbosity); + if (!Enable::HCALIN_G4Hit) TowerDigitizer->set_towerinfo(RawTowerDigitizer::ProcessTowerType::kTowerInfoOnly); // just use towerinfo + se->registerSubsystem(TowerDigitizer); + + // Default sampling fraction for SS310 + double visible_sample_fraction_HCALIN = 0.0631283; //, /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV-0000.root_qa.rootQA_Draw_HCALIN_G4Hit.pdf + + if (G4HCALIN::inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; // for "G4_Al", Abhisek Sen + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalInRawTowerCalibration"); + TowerCalibration->Detector("HCALIN"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + if (G4HCALIN::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.176 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.176); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); + } + TowerCalibration->set_pedstal_ADC(0); + TowerCalibration->Verbosity(verbosity); + if (!Enable::HCALIN_G4Hit) TowerCalibration->set_towerinfo(RawTowerCalibration::ProcessTowerType::kTowerInfoOnly); // just use towerinfo + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALInner_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalInRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + if (!Enable::HCALIN_G4Hit) ClusterBuilder->set_UseTowerInfo(1); // just use towerinfo + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALIN::HCalIn_clusterizer == G4HCALIN::kHCalInGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalInRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALIN"); + ClusterBuilder->Verbosity(verbosity); + //if (!Enable::HCALIN_G4Hit) ClusterBuilder->set_UseTowerInfo(1); // just use towerinfo + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCalIn_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + return; +} + +void HCALInner_Eval(const std::string &outputfile, int start_event = 0) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALIN_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile); + eval->set_event(start_event); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALInner_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALIN_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALIN"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/common/G4_HcalOut_ref.C b/common/G4_HcalOut_ref.C new file mode 100644 index 000000000..ded0e6c6e --- /dev/null +++ b/common/G4_HcalOut_ref.C @@ -0,0 +1,403 @@ +#ifndef MACRO_G4HCALOUTREF_C +#define MACRO_G4HCALOUTREF_C + +#include +#include + +#include +#include + +#include + +#include +#include + +#include + +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libg4ohcal.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool HCALOUT = false; + bool HCALOUT_ABSORBER = false; + bool HCALOUT_OVERLAPCHECK = false; + bool HCALOUT_CELL = false; + bool HCALOUT_TOWER = false; + bool HCALOUT_CLUSTER = false; + bool HCALOUT_EVAL = false; + bool HCALOUT_QA = false; + bool HCALOUT_OLD = false; + bool HCALOUT_RING = true; + bool HCALOUT_G4Hit = true; + int HCALOUT_VERBOSITY = 0; +} // namespace Enable + +namespace G4HCALOUT +{ + double outer_radius = 269.317 + 5; + double size_z = 639.240 + 10; + double phistart = NAN; + double tower_emin = NAN; + int light_scint_model = -1; + int tower_energy_source = -1; + + // Digitization (default photon digi): + RawTowerDigitizer::enu_digi_algorithm TowerDigi = RawTowerDigitizer::kSimple_photon_digitization; + // directly pass the energy of sim tower to digitized tower + // kNo_digitization + // simple digitization with photon statistics, single amplitude ADC conversion and pedestal + // kSimple_photon_digitization + // digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal + // kSiPM_photon_digitization + + enum enu_HCalOut_clusterizer + { + kHCalOutGraphClusterizer, + kHCalOutTemplateClusterizer + }; + + //! template clusterizer, RawClusterBuilderTemplate, as developed by Sasha Bazilevsky + enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutTemplateClusterizer; + //! graph clusterizer, RawClusterBuilderGraph + // enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer; +} // namespace G4HCALOUT + +// Init is called by G4Setup.C +void HCalOuterInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4HCALOUT::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4HCALOUT::size_z / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4HCALOUT::size_z / 2.); +} + +double HCalOuter(PHG4Reco *g4Reco, + double radius, + const int crossings) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::HCALOUT_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::HCALOUT_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + PHG4DetectorSubsystem *hcal = nullptr; + // Mephi Maps + // Maps are different for old/new but how to set is identical + // here are the ones for the old outer hcal since the new maps do not exist yet + // use hcal->set_string_param("MapFileName",""); to disable map + // hcal->set_string_param("MapFileName",std::string(getenv("CALIBRATIONROOT")) + "/HCALOUT/tilemap/oHCALMaps092021.root"); + // hcal->set_string_param("MapHistoName","hCombinedMap"); + + if (Enable::HCALOUT_OLD) + { + hcal = new PHG4OuterHcalSubsystem("HCALOUT"); + // hcal->set_double_param("inner_radius", 183.3); + //----------------------------------------- + // the light correction can be set in a single call + // hcal->set_double_param("light_balance_inner_corr", NAN); + // hcal->set_double_param("light_balance_inner_radius", NAN); + // hcal->set_double_param("light_balance_outer_corr", NAN); + // hcal->set_double_param("light_balance_outer_radius", NAN); + // hcal->set_double_param("magnet_cutout_radius", 195.31); + // hcal->set_double_param("magnet_cutout_scinti_radius", 195.96); + // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); + //----------------------------------------- + // hcal->set_double_param("outer_radius", G4HCALOUT::outer_radius); + // hcal->set_double_param("place_x", 0.); + // hcal->set_double_param("place_y", 0.); + // hcal->set_double_param("place_z", 0.); + // hcal->set_double_param("rot_x", 0.); + // hcal->set_double_param("rot_y", 0.); + // hcal->set_double_param("rot_z", 0.); + // hcal->set_double_param("scinti_eta_coverage", 1.1); + // hcal->set_double_param("scinti_gap", 0.85); + // hcal->set_double_param("scinti_gap_neighbor", 0.1); + // hcal->set_double_param("scinti_inner_radius",183.89); + // hcal->set_double_param("scinti_outer_radius",263.27); + // hcal->set_double_param("scinti_tile_thickness", 0.7); + // hcal->set_double_param("size_z", G4HCALOUT::size_z); + // hcal->set_double_param("steplimits", NAN); + // hcal->set_double_param("tilt_angle", -11.23); + + // hcal->set_int_param("light_scint_model", 1); + // hcal->set_int_param("magnet_cutout_first_scinti", 8); + // hcal->set_int_param("ncross", 0); + // hcal->set_int_param("n_towers", 64); + // hcal->set_int_param("n_scinti_plates_per_tower", 5); + // hcal->set_int_param("n_scinti_tiles", 12); + + // hcal->set_string_param("material", "Steel_1006"); + } + else + { + hcal = new PHG4OHCalSubsystem("HCALOUT"); + // hcal->set_string_param("GDMPath", "mytestgdml.gdml"); // try other gdml file + // common setting with tracking, we likely want to move to the cdb with this + hcal->set_string_param("IronFieldMapPath", G4MAGNET::magfield_OHCAL_steel); + hcal->set_double_param("IronFieldMapScale", G4MAGNET::magfield_rescale); + } + + if (G4HCALOUT::light_scint_model >= 0) + { + hcal->set_int_param("light_scint_model", G4HCALOUT::light_scint_model); + } + // hcal->set_int_param("field_check", 1); // for validating the field in HCal + hcal->SetActive(); + hcal->SuperDetector("HCALOUT"); + if (AbsorberActive) + { + hcal->SetAbsorberActive(); + } + hcal->OverlapCheck(OverlapCheck); + if (!isfinite(G4HCALOUT::phistart)) + { + if (Enable::HCALOUT_OLD) + { + G4HCALOUT::phistart = 0.026598397; // offet in phi (from zero) extracted from geantinos + } + else + { + G4HCALOUT::phistart = 0.0240615415; // offet in phi (from zero) extracted from geantinos + } + } + hcal->set_int_param("saveg4hit", Enable::HCALOUT_G4Hit); + hcal->set_double_param("phistart", G4HCALOUT::phistart); + g4Reco->registerSubsystem(hcal); + + if (Enable::HCALOUT_RING && !Enable::HCALOUT_OLD) + { + // HCal support rings, approximated as solid rings + // note there is only one ring on either side, but to allow part of the ring inside the HCal envelope two rings are used + const double inch = 2.54; + const double support_ring_outer_radius = 74.061 * inch; + const double innerradius = 56.188 * inch; + const double hcal_envelope_radius = 182.423 - 5.; + const double support_ring_z = 175.375 * inch / 2.; + const double support_ring_dz = 4. * inch; + const double z_rings[] = + {-support_ring_z, support_ring_z}; + PHG4CylinderSubsystem *cyl; + PHG4CylinderSubsystem *cylout; + + for (int i = 0; i < 2; i++) + { + // rings outside of HCal envelope + cyl = new PHG4CylinderSubsystem("HCAL_SPT_N1", i); + cyl->set_double_param("place_z", z_rings[i]); + cyl->SuperDetector("HCALIN_SPT"); + cyl->set_double_param("radius", innerradius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", support_ring_dz); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", hcal_envelope_radius - 0.1 - innerradius); + cyl->set_double_param("start_phi_rad", 1.867); + cyl->set_double_param("delta_phi_rad", 5.692); + cyl->OverlapCheck(Enable::OVERLAPCHECK); + if (AbsorberActive) + { + cyl->SetActive(); + } + g4Reco->registerSubsystem(cyl); + + // rings inside outer HCal envelope + cylout = new PHG4CylinderSubsystem("HCAL_SPT_N1", i + 2); + cylout->set_double_param("place_z", z_rings[i]); + cylout->SuperDetector("HCALIN_SPT"); + cylout->set_double_param("radius", hcal_envelope_radius + 0.1); // add a mm to avoid overlaps + cylout->set_int_param("lengthviarapidity", 0); + cylout->set_double_param("length", support_ring_dz); + cylout->set_string_param("material", "G4_Al"); + cylout->set_double_param("thickness", support_ring_outer_radius - (hcal_envelope_radius + 0.1)); + cylout->set_double_param("start_phi_rad", 1.867); + cylout->set_double_param("delta_phi_rad", 5.692); + if (AbsorberActive) + { + cylout->SetActive(); + } + cylout->SetMotherSubsystem(hcal); + cylout->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cylout); + } + } + + radius = hcal->get_double_param("outer_radius"); + + radius += no_overlapp; + + return radius; +} + +void HCALOuter_Cells() +{ + if (!Enable::HCALOUT_G4Hit) return; + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); + hc->Detector("HCALOUT"); + hc->Verbosity(verbosity); + // check for energy conservation - needs modified "infinite" timing cuts + // 0-999999999 + // hc->checkenergy(); + // timing cuts with their default settings + // hc->set_double_param("tmin",0.); + // hc->set_double_param("tmax",60.0); + // or all at once: + // hc->set_timing_window(0.0,60.0); + // this sets all cells to a fixed energy for debugging + // hc->set_fixed_energy(1.); + se->registerSubsystem(hc); + + return; +} + +void HCALOuter_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + if (Enable::HCALOUT_G4Hit) + { + HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); + TowerBuilder->Detector("HCALOUT"); + TowerBuilder->set_sim_tower_node_prefix("SIM"); + if (!isfinite(G4HCALOUT::phistart)) + { + if (Enable::HCALOUT_OLD) + { + G4HCALOUT::phistart = 0.026598397; // offet in phi (from zero) extracted from geantinos + } + else + { + G4HCALOUT::phistart = 0.0240615415; // offet in phi (from zero) extracted from geantinos + } + } + TowerBuilder->set_double_param("phistart", G4HCALOUT::phistart); + if (isfinite(G4HCALOUT::tower_emin)) + { + TowerBuilder->set_double_param("emin", G4HCALOUT::tower_emin); + } + if (G4HCALOUT::tower_energy_source >= 0) + { + TowerBuilder->set_int_param("tower_energy_source", G4HCALOUT::tower_energy_source); + } + // this sets specific decalibration factors + // for a given cell + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // for a whole tower + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + // TowerBuilder->set_cell_decal_factor(1,10,0.1); + // TowerBuilder->set_tower_decal_factor(0,10,0.2); + TowerBuilder->Verbosity(verbosity); + se->registerSubsystem(TowerBuilder); + } + // From 2016 Test beam sim + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer"); + TowerDigitizer->Detector("HCALOUT"); + // TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); + TowerDigitizer->set_digi_algorithm(G4HCALOUT::TowerDigi); + TowerDigitizer->set_pedstal_central_ADC(0); + TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update + TowerDigitizer->set_photonelec_ADC(16. / 5.); + TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); + TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression + TowerDigitizer->Verbosity(verbosity); + if (!Enable::HCALOUT_G4Hit) TowerDigitizer->set_towerinfo(RawTowerDigitizer::ProcessTowerType::kTowerInfoOnly); // just use towerinfo + se->registerSubsystem(TowerDigitizer); + + const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration"); + TowerCalibration->Detector("HCALOUT"); + // TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); + // TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + if (G4HCALOUT::TowerDigi == RawTowerDigitizer::kNo_digitization) + { + // 0.033 extracted from electron sims (edep(scintillator)/edep(total)) + TowerCalibration->set_calib_const_GeV_ADC(1. / 0.033); + } + else + { + TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); + } + TowerCalibration->set_pedstal_ADC(0); + TowerCalibration->Verbosity(verbosity); + if (!Enable::HCALOUT_G4Hit) TowerCalibration->set_towerinfo(RawTowerCalibration::ProcessTowerType::kTowerInfoOnly); // just use towerinfo + se->registerSubsystem(TowerCalibration); + + return; +} + +void HCALOuter_Clusters() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutTemplateClusterizer) + { + RawClusterBuilderTemplate *ClusterBuilder = new RawClusterBuilderTemplate("HcalOutRawClusterBuilderTemplate"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->SetCylindricalGeometry(); // has to be called after Detector() + ClusterBuilder->Verbosity(verbosity); + if (!Enable::HCALOUT_G4Hit) ClusterBuilder->set_UseTowerInfo(1); // just use towerinfo + se->registerSubsystem(ClusterBuilder); + } + else if (G4HCALOUT::HCalOut_clusterizer == G4HCALOUT::kHCalOutGraphClusterizer) + { + RawClusterBuilderGraph *ClusterBuilder = new RawClusterBuilderGraph("HcalOutRawClusterBuilderGraph"); + ClusterBuilder->Detector("HCALOUT"); + ClusterBuilder->Verbosity(verbosity); + //if (!Enable::HCALOUT_G4Hit) ClusterBuilder->set_UseTowerInfo(1); // just use towerinfo + se->registerSubsystem(ClusterBuilder); + } + else + { + cout << "HCALOuter_Clusters - unknown clusterizer setting!" << endl; + exit(1); + } + + return; +} + +void HCALOuter_Eval(const std::string &outputfile, int start_event = 0) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile); + eval->set_event(start_event); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + +void HCALOuter_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::HCALOUT_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + QAG4SimulationCalorimeter *qa = new QAG4SimulationCalorimeter("HCALOUT"); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + return; +} + +#endif diff --git a/common/G4_Input.C b/common/G4_Input.C new file mode 100644 index 000000000..70a136e4b --- /dev/null +++ b/common/G4_Input.C @@ -0,0 +1,651 @@ +#ifndef MACRO_G4INPUT_C +#define MACRO_G4INPUT_C + +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) +R__LOAD_LIBRARY(libPHPythia6.so) +R__LOAD_LIBRARY(libPHPythia8.so) +R__LOAD_LIBRARY(libFermimotionAfterburner.so) +R__LOAD_LIBRARY(libHIJINGFlipAfterburner.so) +R__LOAD_LIBRARY(libReactionPlaneAfterburner.so) + +namespace Input +{ + // Real Event generators + bool PYTHIA6 = false; + int PYTHIA6_EmbedId = 0; + + bool PYTHIA8 = false; + int PYTHIA8_EmbedId = 0; + + // Single/multiple particle generators + bool DZERO = false; + int DZERO_NUMBER = 1; + int DZERO_VERBOSITY = 0; + std::set DZERO_EmbedIds; + + bool GUN = false; + int GUN_NUMBER = 1; + int GUN_VERBOSITY = 0; + std::set GUN_EmbedIds; + + bool IONGUN = false; + int IONGUN_NUMBER = 1; + int IONGUN_VERBOSITY = 0; + std::set IONGUN_EmbedIds; + + bool PGEN = false; + int PGEN_NUMBER = 1; + int PGEN_VERBOSITY = 0; + std::set PGEN_EmbedIds; + + bool SIMPLE = false; + int SIMPLE_NUMBER = 1; + int SIMPLE_VERBOSITY = 0; + + int UPSILON_NUMBER = 1; + int UPSILON_VERBOSITY = 0; + // other UPSILON settings which are also used elsewhere are in GlobalVariables.C + + double PILEUPRATE = 0.; + bool READHITS = false; + int VERBOSITY = 0; + int EmbedId = 1; + + bool COSMIC = false; + double COSMIC_R = 650.; + + //! apply reference sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2022-001 and past RHIC experience + //! \param[in] HepMCGen any HepMC generator, e.g. Fun4AllHepMCInputManager, Fun4AllHepMCPileupInputManager, PHPythia8, PHPythia6, ReadEICFiles + //! \param[in] collision_type select the beam configuration with Input::BeamConfiguration + void ApplysPHENIXBeamParameter(PHHepMCGenHelper *HepMCGen, const Input::BeamConfiguration & beam_config) + { + if (HepMCGen == nullptr) + { + std::cout << "ApplysPHENIXBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl; + exit(1); + } + HepMCGen->set_beam_direction_theta_phi(1e-3, 0, M_PI - 1e-3, 0); //2mrad x-ing of sPHENIX per sPH-TRG-2022-001 + + switch (beam_config) + { + case AA_COLLISION: + // heavy ion mode + + HepMCGen->set_vertex_distribution_width( + 100e-4, // approximation from past STAR/Run16 AuAu data + 100e-4, // approximation from past STAR/Run16 AuAu data + 7, // sPH-TRG-2022-001. Fig B.2 + 20 / 29.9792); // 20cm collision length / speed of light in cm/ns + + break; + case pA_COLLISION: + + // pA mode + + HepMCGen->set_vertex_distribution_width( + 100e-4, // set to be similar to AA + 100e-4, // set to be similar to AA + 8, // sPH-TRG-2022-001. Fig B.4 + 20 / 29.9792); // 20cm collision length / speed of light in cm/ns + + break; + case pp_COLLISION: + + // pp mode + + HepMCGen->set_vertex_distribution_width( + 120e-4, // approximation from past PHENIX data + 120e-4, // approximation from past PHENIX data + 10, // sPH-TRG-2022-001. Fig B.3 + 20 / 29.9792); // 20cm collision length / speed of light in cm/ns + + break; + default: + std::cout <<"ApplysPHENIXBeamParameter: invalid beam_config = "<set_vertex_distribution_function( + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus, + PHHepMCGenHelper::Gaus); + } + + //! apply sPHENIX nominal beam parameter according to the beam collision setting of Input::IS_PP_COLLISION + //! \param[in] HepMCGen any HepMC generator, e.g. Fun4AllHepMCInputManager, Fun4AllHepMCPileupInputManager, PHPythia8, PHPythia6, ReadEICFiles + void ApplysPHENIXBeamParameter(PHHepMCGenHelper *HepMCGen) + { + ApplysPHENIXBeamParameter(HepMCGen, Input::BEAM_CONFIGURATION); + } + + //! apply EIC beam parameter to any HepMC generator following EIC CDR, + //! including in-time collision's space time shift, beam crossing angle and angular divergence + //! \param[in] HepMCGen any HepMC generator, e.g. Fun4AllHepMCInputManager, Fun4AllHepMCPileupInputManager, PHPythia8, PHPythia6, ReadEICFiles + void ApplyEICBeamParameter(PHHepMCGenHelper *HepMCGen) + { + if (HepMCGen == nullptr) + { + std::cout << "ApplyEICBeamParameter(): Fatal Error - null input pointer HepMCGen" << std::endl; + exit(1); + } + + //25mrad x-ing as in EIC CDR + const double EIC_hadron_crossing_angle = 25e-3; + + HepMCGen->set_beam_direction_theta_phi( + EIC_hadron_crossing_angle, // beamA_theta + 0, // beamA_phi + M_PI, // beamB_theta + 0 // beamB_phi + ); + HepMCGen->set_beam_angular_divergence_hv( + 119e-6, 119e-6, // proton beam divergence horizontal & vertical, as in EIC CDR Table 1.1 + 211e-6, 152e-6 // electron beam divergence horizontal & vertical, as in EIC CDR Table 1.1 + ); + + // angular kick within a bunch as result of crab cavity + // using an naive assumption of transfer matrix from the cavity to IP, + // which is NOT yet validated with accelerator optics simulations! + const double z_hadron_cavity = 52e2; // CDR Fig 3.3 + const double z_e_cavity = 38e2; // CDR Fig 3.2 + HepMCGen->set_beam_angular_z_coefficient_hv( + -EIC_hadron_crossing_angle / 2. / z_hadron_cavity, 0, + -EIC_hadron_crossing_angle / 2. / z_e_cavity, 0); + + // calculate beam sigma width at IP as in EIC CDR table 1.1 + const double sigma_p_h = sqrt(80 * 11.3e-7); + const double sigma_p_v = sqrt(7.2 * 1.0e-7); + const double sigma_p_l = 6; + const double sigma_e_h = sqrt(45 * 20.0e-7); + const double sigma_e_v = sqrt(5.6 * 1.3e-7); + const double sigma_e_l = 2; + + // combine two beam gives the collision sigma in z + const double collision_sigma_z = sqrt(sigma_p_l * sigma_p_l + sigma_e_l * sigma_e_l) / 2; + const double collision_sigma_t = collision_sigma_z / 29.9792; // speed of light in cm/ns + + HepMCGen->set_vertex_distribution_width( + sigma_p_h * sigma_e_h / sqrt(sigma_p_h * sigma_p_h + sigma_e_h * sigma_e_h), //x + sigma_p_v * sigma_e_v / sqrt(sigma_p_v * sigma_p_v + sigma_e_v * sigma_e_v), //y + collision_sigma_z, //z + collision_sigma_t); //t + HepMCGen->set_vertex_distribution_function( + PHHepMCGenHelper::Gaus, //x + PHHepMCGenHelper::Gaus, //y + PHHepMCGenHelper::Gaus, //z + PHHepMCGenHelper::Gaus); //t + } +} // namespace Input + +namespace INPUTHEPMC +{ + string filename; + string listfile; + bool FLOW = false; + int FLOW_VERBOSITY = 0; + bool FERMIMOTION = false; + bool HIJINGFLIP = false; + bool REACTIONPLANERAND = false; + +} // namespace INPUTHEPMC + +namespace INPUTREADEIC +{ + string filename; +} // namespace INPUTREADEIC + +namespace INPUTREADHITS +{ + map filename; + map listfile; +} // namespace INPUTREADHITS + +namespace INPUTEMBED +{ + map filename; + map listfile; + bool REPEAT = true; +} // namespace INPUTEMBED + +namespace PYTHIA6 +{ + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6.cfg"; +} + +namespace PYTHIA8 +{ + string config_file = string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia8.cfg"; +} + +namespace PILEUP +{ + string pileupfile = "/sphenix/sim/sim01/sphnxpro/MDC1/sHijing_HepMC/data/sHijing_0_20fm-0000000001-00000.dat"; + double TpcDriftVelocity = G4TPC::tpc_drift_velocity_sim; +} // namespace PILEUP + +// collection of pointers to particle generators we can grab in the Fun4All macro +namespace INPUTGENERATOR +{ + std::vector IonGun; + std::vector ParticleGenerator; + std::vector DZeroMesonGenerator; + std::vector VectorMesonGenerator; + std::vector SimpleEventGenerator; + std::vector Gun; + PHPythia6 *Pythia6 = nullptr; + PHPythia8 *Pythia8 = nullptr; + ReadEICFiles *EICFileReader = nullptr; + CosmicSpray *Cosmic = nullptr; +} // namespace INPUTGENERATOR + +namespace INPUTMANAGER +{ + Fun4AllHepMCInputManager *HepMCInputManager = nullptr; + Fun4AllHepMCPileupInputManager *HepMCPileupInputManager = nullptr; +} // namespace INPUTMANAGER + +void InputInit() +{ + // for pileup sims embed id is 1, to distinguish particles + // which will be embedded (when Input::EMBED = true) into pileup sims + // we need to start at embedid = 2 + if (Input::EMBED) + { + Input::EmbedId = 2; + } + // first consistency checks - not all input generators play nice + // with each other + if (Input::READHITS && Input::EMBED) + { + cout << "Reading Hits and Embedding into background at the same time is not supported" << endl; + gSystem->Exit(1); + } + if (Input::READHITS && (Input::PYTHIA6 || Input::PYTHIA8 || Input::SIMPLE || Input::GUN || Input::UPSILON || Input::HEPMC)) + { + cout << "Reading Hits and running G4 simultanously is not supported" << endl; + gSystem->Exit(1); + } + if (Input::PYTHIA6 && Input::PYTHIA8) + { + cout << "Pythia6 and Pythia8 cannot be run together - might be possible but needs R&D" << endl; + gSystem->Exit(1); + } + + if (INPUTHEPMC::FLOW && Input::PILEUPRATE > 0) + { + cout << "Flow Afterburner and Pileup cannot be run simultanously" << endl; + gSystem->Exit(1); + } + // done with consistency checks, create generators in no specific order + + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::PYTHIA6) + { + INPUTGENERATOR::Pythia6 = new PHPythia6(); + INPUTGENERATOR::Pythia6->set_config_file(PYTHIA6::config_file); + + INPUTGENERATOR::Pythia6->set_embedding_id(Input::EmbedId); + Input::PYTHIA6_EmbedId = Input::EmbedId; + Input::EmbedId++; + } + if (Input::PYTHIA8) + { + INPUTGENERATOR::Pythia8 = new PHPythia8(); + // see coresoftware/generators/PHPythia8 for example config + INPUTGENERATOR::Pythia8->set_config_file(PYTHIA8::config_file); + + INPUTGENERATOR::Pythia8->set_embedding_id(Input::EmbedId); + Input::PYTHIA8_EmbedId = Input::EmbedId; + Input::EmbedId++; + } + // single particle generators + if (Input::DZERO) + { + for (int i = 0; i < Input::DZERO_NUMBER; ++i) + { + std::string name = "DZERO_" + std::to_string(i); + PHG4ParticleGeneratorD0 *dzero = new PHG4ParticleGeneratorD0(name); + dzero->Embed(Input::EmbedId); + Input::DZERO_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::DZeroMesonGenerator.push_back(dzero); + } + } + if (Input::GUN) + { + for (int i = 0; i < Input::GUN_NUMBER; ++i) + { + std::string name = "GUN_" + std::to_string(i); + PHG4ParticleGun *gun = new PHG4ParticleGun(name); + gun->Embed(Input::EmbedId); + Input::GUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::Gun.push_back(gun); + } + } + if (Input::IONGUN) + { + for (int i = 0; i < Input::IONGUN_NUMBER; ++i) + { + std::string name = "IONGUN_" + std::to_string(i); + PHG4IonGun *iongun = new PHG4IonGun(name); + iongun->Embed(Input::EmbedId); + Input::IONGUN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::IonGun.push_back(iongun); + } + } + if (Input::PGEN) + { + for (int i = 0; i < Input::PGEN_NUMBER; ++i) + { + std::string name = "PGEN_" + std::to_string(i); + PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(name); + pgen->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::ParticleGenerator.push_back(pgen); + } + } + if (Input::SIMPLE) + { + for (int i = 0; i < Input::SIMPLE_NUMBER; ++i) + { + std::string name = "EVTGENERATOR_" + std::to_string(i); + PHG4SimpleEventGenerator *simple = new PHG4SimpleEventGenerator(name); + simple->Embed(Input::EmbedId); + Input::PGEN_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::SimpleEventGenerator.push_back(simple); + } + } + if (Input::UPSILON) + { + for (int i = 0; i < Input::UPSILON_NUMBER; ++i) + { + std::string name = "UPSILON_" + std::to_string(i); + PHG4ParticleGeneratorVectorMeson *upsilon = new PHG4ParticleGeneratorVectorMeson(name); + upsilon->Embed(Input::EmbedId); + Input::UPSILON_EmbedIds.insert(Input::EmbedId); + Input::EmbedId++; + INPUTGENERATOR::VectorMesonGenerator.push_back(upsilon); + } + } + + // input managers for which we might need to set options + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager = new Fun4AllHepMCInputManager("HEPMCin"); + } + if (Input::PILEUPRATE > 0) + { + INPUTMANAGER::HepMCPileupInputManager = new Fun4AllHepMCPileupInputManager("HepMCPileupInput"); + } +} + +void InputRegister() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::PYTHIA6) + { + se->registerSubsystem(INPUTGENERATOR::Pythia6); + } + if (Input::PYTHIA8) + { + se->registerSubsystem(INPUTGENERATOR::Pythia8); + } + if (Input::DZERO) + { + int verbosity = max(Input::DZERO_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::DZeroMesonGenerator.size(); ++icnt) + { + INPUTGENERATOR::DZeroMesonGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::DZeroMesonGenerator[icnt]); + } + } + if (Input::GUN) + { + int verbosity = max(Input::GUN_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::Gun.size(); ++icnt) + { + INPUTGENERATOR::Gun[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::Gun[icnt]); + } + } + if (Input::IONGUN) + { + int verbosity = max(Input::IONGUN_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::IonGun.size(); ++icnt) + { + INPUTGENERATOR::IonGun[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::IonGun[icnt]); + } + } + if (Input::PGEN) + { + int verbosity = max(Input::PGEN_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::ParticleGenerator.size(); ++icnt) + { + INPUTGENERATOR::ParticleGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::ParticleGenerator[icnt]); + } + } + if (Input::SIMPLE) + { + int verbosity = max(Input::SIMPLE_VERBOSITY, Input::VERBOSITY); + for (size_t icnt = 0; icnt < INPUTGENERATOR::SimpleEventGenerator.size(); ++icnt) + { + INPUTGENERATOR::SimpleEventGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::SimpleEventGenerator[icnt]); + } + } + if (Input::UPSILON) + { + for (size_t icnt = 0; icnt < INPUTGENERATOR::VectorMesonGenerator.size(); ++icnt) + { + int verbosity = max(Input::UPSILON_VERBOSITY, Input::VERBOSITY); + if (Input::HEPMC || Input::SIMPLE) + { + INPUTGENERATOR::VectorMesonGenerator[icnt]->set_reuse_existing_vertex(true); + } + INPUTGENERATOR::VectorMesonGenerator[icnt]->Verbosity(verbosity); + se->registerSubsystem(INPUTGENERATOR::VectorMesonGenerator[icnt]); + } + } + if (Input::READEIC) + { + INPUTGENERATOR::EICFileReader = new ReadEICFiles(); + INPUTGENERATOR::EICFileReader->OpenInputFile(INPUTREADEIC::filename); + INPUTGENERATOR::EICFileReader->Verbosity(Input::VERBOSITY); + se->registerSubsystem(INPUTGENERATOR::EICFileReader); + } + if (Input::COSMIC) + { + INPUTGENERATOR::Cosmic = new CosmicSpray("COSMIC", Input::COSMIC_R); + se->registerSubsystem(INPUTGENERATOR::Cosmic); + } + // here are the various utility modules which read particles and + // put them onto the G4 particle stack + if (Input::HEPMC || Input::PYTHIA8 || Input::PYTHIA6 || Input::READEIC) + { + if (Input::HEPMC) + { + if (INPUTHEPMC::REACTIONPLANERAND) + { + ReactionPlaneAfterburner *rp = new ReactionPlaneAfterburner(); + se->registerSubsystem(rp); + } + + if (INPUTHEPMC::HIJINGFLIP) + { + HIJINGFlipAfterburner *flip = new HIJINGFlipAfterburner(); + se->registerSubsystem(flip); + } + // these need to be applied before the HepMCNodeReader since they + // work on the hepmc records + if (INPUTHEPMC::FLOW) + { + HepMCFlowAfterBurner *burn = new HepMCFlowAfterBurner(); + burn->Verbosity(INPUTHEPMC::FLOW_VERBOSITY); + se->registerSubsystem(burn); + } + if (INPUTHEPMC::FERMIMOTION) + { + FermimotionAfterburner *fermi = new FermimotionAfterburner(); + se->registerSubsystem(fermi); + } + } + // copy HepMC records into G4 + HepMCNodeReader *hr = new HepMCNodeReader(); + se->registerSubsystem(hr); + } +} + +void InputManagers() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + if (Input::EMBED) + { + gSystem->Load("libg4dst.so"); + if (!INPUTEMBED::filename.empty() && !INPUTEMBED::listfile.empty()) + { + cout << "only filenames or filelists are supported, not mixtures" << endl; + gSystem->Exit(1); + } + if (INPUTEMBED::filename.empty() && INPUTEMBED::listfile.empty()) + { + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); + } + for (auto iter = INPUTEMBED::filename.begin(); iter != INPUTEMBED::filename.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + if (INPUTEMBED::REPEAT) + { + hitsin->Repeat(); + } + se->registerInputManager(hitsin); + } + for (auto iter = INPUTEMBED::listfile.begin(); iter != INPUTEMBED::listfile.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->AddListFile(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + if (INPUTEMBED::REPEAT) + { + hitsin->Repeat(); + } + se->registerInputManager(hitsin); + } + } + if (Input::HEPMC) + { + INPUTMANAGER::HepMCInputManager->Verbosity(Input::VERBOSITY); + se->registerInputManager(INPUTMANAGER::HepMCInputManager); + if (!INPUTHEPMC::filename.empty() && INPUTHEPMC::listfile.empty()) + { + INPUTMANAGER::HepMCInputManager->fileopen(INPUTHEPMC::filename); + } + else if (!INPUTHEPMC::listfile.empty()) + { + INPUTMANAGER::HepMCInputManager->AddListFile(INPUTHEPMC::listfile); + } + else + { + cout << "no filename INPUTHEPMC::filename or listfile INPUTHEPMC::listfile given" << endl; + gSystem->Exit(1); + } + } + else if (Input::READHITS) + { + gSystem->Load("libg4dst.so"); + if (!INPUTREADHITS::filename.empty() && !INPUTREADHITS::listfile.empty()) + { + cout << "only filenames or filelists are supported, not mixtures" << endl; + gSystem->Exit(1); + } + if (INPUTREADHITS::filename.empty() && INPUTREADHITS::listfile.empty()) + { + cout << "you need to give an input filenames or filelist" << endl; + gSystem->Exit(1); + } + for (auto iter = INPUTREADHITS::filename.begin(); iter != INPUTREADHITS::filename.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->fileopen(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); + } + for (auto iter = INPUTREADHITS::listfile.begin(); iter != INPUTREADHITS::listfile.end(); ++iter) + { + string mgrname = "DSTin" + to_string(iter->first); + Fun4AllInputManager *hitsin = new Fun4AllDstInputManager(mgrname); + hitsin->AddListFile(iter->second); + hitsin->Verbosity(Input::VERBOSITY); + se->registerInputManager(hitsin); + } + } + else + { + Fun4AllInputManager *in = new Fun4AllDummyInputManager("JADE"); + in->Verbosity(Input::VERBOSITY); + se->registerInputManager(in); + } + if (Input::PILEUPRATE > 0) + { + INPUTMANAGER::HepMCPileupInputManager->SignalInputManager(INPUTMANAGER::HepMCInputManager); + INPUTMANAGER::HepMCPileupInputManager->Verbosity(Input::VERBOSITY); + INPUTMANAGER::HepMCPileupInputManager->AddFile(PILEUP::pileupfile); + INPUTMANAGER::HepMCPileupInputManager->set_collision_rate(Input::PILEUPRATE); + double time_window = 105.5 / PILEUP::TpcDriftVelocity; + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + INPUTMANAGER::HepMCPileupInputManager->set_time_window(-time_window, time_window + extended_readout_time); + cout << "Pileup window is from " << -time_window << " to " << time_window + extended_readout_time << endl; + se->registerInputManager(INPUTMANAGER::HepMCPileupInputManager); + } +} +#endif diff --git a/common/G4_Jets.C b/common/G4_Jets.C new file mode 100644 index 000000000..779487cd9 --- /dev/null +++ b/common/G4_Jets.C @@ -0,0 +1,158 @@ +#ifndef MACRO_G4JETS_C +#define MACRO_G4JETS_C + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libjetbase.so) +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + bool JETS = false; + bool JETS_EVAL = false; + bool JETS_QA = false; + int JETS_VERBOSITY = 0; +} // namespace Enable + +void JetInit() {} + +void Jet_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + // truth particle level jets + JetReco *truthjetreco = new JetReco("TRUTHJETRECO"); + truthjetreco->add_input(new TruthJetInput(Jet::PARTICLE)); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Truth_r02"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Truth_r03"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Truth_r04"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Truth_r05"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Truth_r06"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Truth_r07"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Truth_r08"); + truthjetreco->set_algo_node("ANTIKT"); + truthjetreco->set_input_node("TRUTH"); + truthjetreco->Verbosity(verbosity); + se->registerSubsystem(truthjetreco); + + // tower jets + JetReco *towerjetreco = new JetReco("TOWERJETRECO"); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Tower_r02"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Tower_r03"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Tower_r04"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Tower_r05"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Tower_r06"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Tower_r07"); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Tower_r08"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + // cluster jets + JetReco *clusterjetreco = new JetReco("CLUSTERJETRECO"); + clusterjetreco->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); + clusterjetreco->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); + clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Cluster_r02"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Cluster_r03"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Cluster_r04"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Cluster_r05"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Cluster_r06"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Cluster_r07"); + clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Cluster_r08"); + clusterjetreco->set_algo_node("ANTIKT"); + clusterjetreco->set_input_node("CLUSTER"); + clusterjetreco->Verbosity(verbosity); + se->registerSubsystem(clusterjetreco); + + // track jets + JetReco *trackjetreco = new JetReco("TRACKJETRECO"); + trackjetreco->add_input(new TrackJetInput(Jet::TRACK, TRACKING::TrackNodeName)); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Track_r02"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Track_r03"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Track_r04"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Track_r05"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.6), "AntiKt_Track_r06"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.7), "AntiKt_Track_r07"); + trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.8), "AntiKt_Track_r08"); + trackjetreco->set_algo_node("ANTIKT"); + trackjetreco->set_input_node("TRACK"); + trackjetreco->Verbosity(verbosity); + se->registerSubsystem(trackjetreco); + + return; +} + +void Jet_Eval(const std::string &outfilename = "g4jets_eval.root") +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::JETS_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + JetEvaluator *eval = new JetEvaluator("JETEVALUATOR", + "AntiKt_Tower_r03", + "AntiKt_Truth_r03", + outfilename); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} + + +void Jet_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::JETS_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + QAG4SimulationJet *calo_jet7 = new QAG4SimulationJet( + "AntiKt_Truth_r07"); + calo_jet7->add_reco_jet("AntiKt_Tower_r07"); + calo_jet7->add_reco_jet("AntiKt_Cluster_r07"); + calo_jet7->add_reco_jet("AntiKt_Track_r07"); + calo_jet7->Verbosity(verbosity); + se->registerSubsystem(calo_jet7); + + QAG4SimulationJet *calo_jet4 = new QAG4SimulationJet( + "AntiKt_Truth_r04"); + calo_jet4->add_reco_jet("AntiKt_Tower_r04"); + calo_jet4->add_reco_jet("AntiKt_Cluster_r04"); + calo_jet4->add_reco_jet("AntiKt_Track_r04"); + calo_jet4->Verbosity(verbosity); + se->registerSubsystem(calo_jet4); + + QAG4SimulationJet *calo_jet2 = new QAG4SimulationJet( + "AntiKt_Truth_r02"); + calo_jet2->add_reco_jet("AntiKt_Tower_r02"); + calo_jet2->add_reco_jet("AntiKt_Cluster_r02"); + calo_jet2->add_reco_jet("AntiKt_Track_r02"); + calo_jet2->Verbosity(verbosity); + se->registerSubsystem(calo_jet2); + + return; +} + + +#endif diff --git a/common/G4_KFParticle.C b/common/G4_KFParticle.C new file mode 100644 index 000000000..8bfd8a49b --- /dev/null +++ b/common/G4_KFParticle.C @@ -0,0 +1,238 @@ +#ifndef MACRO_G4KFPARTICLE_C +#define MACRO_G4KFPARTICLE_C + +#include + +#define HomogeneousField +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libkfparticle_sphenix.so) +R__LOAD_LIBRARY(libqa_kfparticle.so) +R__LOAD_LIBRARY(libdecayfinder.so) + +namespace Enable +{ + bool KFPARTICLE = false; + bool KFPARTICLE_SAVE_NTUPLE = false; + bool KFPARTICLE_APPEND_TO_DST = true; + bool KFPARTICLE_TRUTH_MATCH = false; + bool KFPARTICLE_DETECTOR_INFO = false; + int KFPARTICLE_VERBOSITY = 0; + std::string KFPARTICLE_TRACKMAP = "SvtxTrackMap"; + std::string KFPARTICLE_VERTEXMAP = "SvtxVertexMap"; +} // namespace Enable + +namespace KFPARTICLE +{ + bool QA = false; + + bool runUpsilonReco = false; + std::string UpsilonName = "Upsilon"; + std::string UpsilonDecayDescriptor = UpsilonName + " -> e^+ e^-"; + std::pair UpsilonMassRange(8, 11); + bool UpsilonTrigger = false; + + bool runD0Reco = false; + std::string D0Name = "D0"; + std::string D0DecayDescriptor = "[" + D0Name + " -> K^- pi^+]cc"; + std::pair D0MassRange(1.75, 1.95); + bool D0Trigger = false; + + bool runLambdacReco = false; + std::string LambdacName = "Lambdac"; + std::string LambdacDecayDescriptor = "[" + LambdacName + " -> proton^+ K^- pi^+]cc"; + std::pair LambdacMassRange(2.15, 2.45); + bool LambdacTrigger = false; +} //namesppace KFPARTICLE + +namespace KFParticleBaseCut +{ + float minTrackPT = 0.5; // GeV + float maxTrackchi2nDoF = 2; + float minTrackIPchi2 = 15; // IP = DCA of track with vertex + float maxVertexchi2nDoF = 2; + float maxTrackTrackDCA = 0.05; // cm + float minMotherPT = 0; // GeV +} // namespace KFParticleBaseCut + +void KFParticle_Upsilon_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::UpsilonName + "_Reco"); + kfparticle->Verbosity(verbosity); + kfparticle->setDecayDescriptor(KFPARTICLE::UpsilonDecayDescriptor); + + kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); + kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); + kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); + kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(0); // Upsilon decays are prompt, tracks are more likely to point to vertex + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMinimumMass(KFPARTICLE::UpsilonMassRange.first); + kfparticle->setMaximumMass(KFPARTICLE::UpsilonMassRange.second); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + kfparticle->setContainerName(KFPARTICLE::UpsilonName); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::UpsilonName + "_reconstruction.root"); + + se->registerSubsystem(kfparticle); + + KFPARTICLE::runUpsilonReco = true; + + return; +} + + +void KFParticle_D0_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::D0Name + "_Reco"); + kfparticle->Verbosity(verbosity); + kfparticle->setDecayDescriptor(KFPARTICLE::D0DecayDescriptor); + + kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); + kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); + kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); + kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMinimumMass(KFPARTICLE::D0MassRange.first); + kfparticle->setMaximumMass(KFPARTICLE::D0MassRange.second); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + kfparticle->setContainerName(KFPARTICLE::D0Name); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::D0Name + "_reconstruction.root"); + + se->registerSubsystem(kfparticle); + + KFPARTICLE::runD0Reco = true; + + return; +} + + +void KFParticle_Lambdac_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + KFParticle_sPHENIX *kfparticle = new KFParticle_sPHENIX("KFParticle_" + KFPARTICLE::LambdacName + "_Reco"); + kfparticle->Verbosity(verbosity); + kfparticle->setDecayDescriptor(KFPARTICLE::LambdacDecayDescriptor); + + kfparticle->saveDST(Enable::KFPARTICLE_APPEND_TO_DST); + kfparticle->saveOutput(Enable::KFPARTICLE_SAVE_NTUPLE); + kfparticle->doTruthMatching(Enable::KFPARTICLE_TRUTH_MATCH); + kfparticle->getDetectorInfo(Enable::KFPARTICLE_DETECTOR_INFO); + + kfparticle->setMinimumTrackPT(KFParticleBaseCut::minTrackPT); + kfparticle->setMinimumTrackIPchi2(KFParticleBaseCut::minTrackIPchi2); + kfparticle->setMaximumTrackchi2nDOF(KFParticleBaseCut::maxTrackchi2nDoF); + + kfparticle->setMaximumVertexchi2nDOF(KFParticleBaseCut::maxVertexchi2nDoF); + kfparticle->setMaximumDaughterDCA(KFParticleBaseCut::maxTrackTrackDCA); + + kfparticle->setMinimumMass(KFPARTICLE::LambdacMassRange.first); + kfparticle->setMaximumMass(KFPARTICLE::LambdacMassRange.second); + kfparticle->setMotherPT(KFParticleBaseCut::minMotherPT); + kfparticle->constrainToPrimaryVertex(false); + + kfparticle->setContainerName(KFPARTICLE::LambdacName); + kfparticle->setOutputName("KFParticleOutput_" + KFPARTICLE::LambdacName + "_reconstruction.root"); + + se->registerSubsystem(kfparticle); + + KFPARTICLE::runLambdacReco = true; + + return; +} + +void KFParticle_QA() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::KFPARTICLE_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + + if (KFPARTICLE::runUpsilonReco) + { + DecayFinder *UpsilonFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::UpsilonName); + UpsilonFinder->Verbosity(verbosity); + UpsilonFinder->setDecayDescriptor(KFPARTICLE::UpsilonDecayDescriptor); + UpsilonFinder->triggerOnDecay(KFPARTICLE::UpsilonTrigger); + UpsilonFinder->saveDST(true); + UpsilonFinder->allowPi0(true); + UpsilonFinder->allowPhotons(true); + se->registerSubsystem(UpsilonFinder); + + QAG4SimulationKFParticle *UpsilonQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::UpsilonName, + KFPARTICLE::UpsilonName, + KFPARTICLE::UpsilonMassRange.first, + KFPARTICLE::UpsilonMassRange.second); + se->registerSubsystem(UpsilonQA); + } + + if (KFPARTICLE::runD0Reco) + { + DecayFinder *D0Finder = new DecayFinder("DecayFinder_" + KFPARTICLE::D0Name); + D0Finder->Verbosity(verbosity); + D0Finder->setDecayDescriptor(KFPARTICLE::D0DecayDescriptor); + D0Finder->triggerOnDecay(KFPARTICLE::D0Trigger); + D0Finder->saveDST(true); + D0Finder->allowPi0(true); + D0Finder->allowPhotons(true); + se->registerSubsystem(D0Finder); + + QAG4SimulationKFParticle *D0QA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::D0Name, + KFPARTICLE::D0Name, + KFPARTICLE::D0MassRange.first, + KFPARTICLE::D0MassRange.second); + se->registerSubsystem(D0QA); + } + + if (KFPARTICLE::runLambdacReco) + { + DecayFinder *LambdacFinder = new DecayFinder("DecayFinder_" + KFPARTICLE::LambdacName); + LambdacFinder->Verbosity(verbosity); + LambdacFinder->setDecayDescriptor(KFPARTICLE::LambdacDecayDescriptor); + LambdacFinder->triggerOnDecay(KFPARTICLE::LambdacTrigger); + LambdacFinder->saveDST(true); + LambdacFinder->allowPi0(true); + LambdacFinder->allowPhotons(true); + se->registerSubsystem(LambdacFinder); + + QAG4SimulationKFParticle *LambdacQA = new QAG4SimulationKFParticle("QA_" + KFPARTICLE::LambdacName, + KFPARTICLE::LambdacName, + KFPARTICLE::LambdacMassRange.first, + KFPARTICLE::LambdacMassRange.second); + se->registerSubsystem(LambdacQA); + } + + return; +} + +#endif diff --git a/common/G4_Magnet.C b/common/G4_Magnet.C new file mode 100644 index 000000000..42afee100 --- /dev/null +++ b/common/G4_Magnet.C @@ -0,0 +1,117 @@ +#ifndef MACRO_G4MAGNET_C +#define MACRO_G4MAGNET_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool MAGNET = false; + bool MAGNET_ABSORBER = false; + bool MAGNET_OVERLAPCHECK = false; + int MAGNET_VERBOSITY = 0; +} // namespace Enable + +namespace G4MAGNET +{ + double magnet_outer_cryostat_wall_radius = 174.5; + double magnet_outer_cryostat_wall_thickness = 2.5; + double magnet_length = 379.; +} // namespace G4MAGNET + +void MagnetFieldInit() +{ + if (!isfinite(G4MAGNET::magfield_rescale)) + { + G4MAGNET::magfield_rescale = 1.; + } + if (G4MAGNET::magfield.empty()) + { + G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz_gap_rebuild.root"); + G4MAGNET::magfield_OHCAL_steel = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dbigmapxyz_steel_rebuild.root"); + } +} + +void MagnetInit() +{ + MagnetFieldInit(); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4MAGNET::magnet_length / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4MAGNET::magnet_length / 2.); +} + +double Magnet(PHG4Reco* g4Reco, double radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::MAGNET_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::MAGNET_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MAGNET_VERBOSITY); + + double magnet_inner_cryostat_wall_radius = 142; + double magnet_inner_cryostat_wall_thickness = 1; + double magnet_coil_radius = 150.8; + double magnet_coil_thickness = 9.38; + double magnet_length = 379.; + double coil_length = 361.5; + if (radius > magnet_inner_cryostat_wall_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than Magnet inner radius: " << magnet_inner_cryostat_wall_radius << endl; + gSystem->Exit(-1); + } + + radius = magnet_inner_cryostat_wall_radius; + PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("MAGNET", 0); + cyl->set_double_param("radius", magnet_inner_cryostat_wall_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MAGNET::magnet_length); + cyl->set_double_param("thickness", magnet_inner_cryostat_wall_thickness); + cyl->set_string_param("material", "Al5083"); // use 1 radiation length Al for magnet thickness + cyl->SuperDetector("MAGNET"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("MAGNET", 1); + cyl->set_double_param("radius", magnet_coil_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", coil_length); + cyl->set_double_param("thickness", magnet_coil_thickness); + cyl->set_string_param("material", "Al5083"); // use 1 radiation length Al for magnet thickness + cyl->SuperDetector("MAGNET"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("MAGNET", 2); + cyl->set_double_param("radius", G4MAGNET::magnet_outer_cryostat_wall_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4MAGNET::magnet_length); + cyl->set_double_param("thickness", G4MAGNET::magnet_outer_cryostat_wall_thickness); + cyl->set_string_param("material", "Al5083"); // use 1 radiation length Al for magnet thickness + cyl->SuperDetector("MAGNET"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + radius = G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness; // outside of magnet + + if (verbosity > 0) + { + cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl; + cout << " MAGNET Material Description:" << endl; + cout << " inner radius = " << magnet_inner_cryostat_wall_radius << " cm" << endl; + cout << " outer radius = " << G4MAGNET::magnet_outer_cryostat_wall_radius + G4MAGNET::magnet_outer_cryostat_wall_thickness << " cm" << endl; + cout << " length = " << G4MAGNET::magnet_length << " cm" << endl; + cout << "===========================================================================" << endl; + } + + radius += no_overlapp; + + return radius; +} +#endif diff --git a/common/G4_Mbd.C b/common/G4_Mbd.C new file mode 100644 index 000000000..fc3e88c81 --- /dev/null +++ b/common/G4_Mbd.C @@ -0,0 +1,111 @@ +#ifndef MACRO_G4MBD_C +#define MACRO_G4MBD_C + +#include + +#include + +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4mbd.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libmbd.so) + +namespace Enable +{ + bool MBD = false; // Actual MBD detector + bool MBD_SUPPORT = false; // MBD Supports + bool MBDRECO = false; // run Mbd reconstruction + bool MBDFAKE = false; // Just generate fake mbd vtx, t0 + int MBD_VERBOSITY = 0; +} // namespace Enable + +namespace G4MBD +{ + double z_smearing = 0.; // should be 6 mm, temporarily perfect for TPC initial vertexing + double t_smearing = 0.02; // 20ps timing resolution +} // namespace G4MBD + +void MbdInit() +{ + if (Enable::MBD && Enable::MBDFAKE) + { + cout << "Enable::MBD and Enable::MBDFAKE cannot be true at the same time" << endl; + gSystem->Exit(1); + } + // Set boundary of tracked particles to include MBD (values in cm) + if (Enable::MBD) + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 300.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -300.); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 125.0); + } +} + +void Mbd(PHG4Reco* g4Reco) +{ + bool SupportActive = Enable::SUPPORT || Enable::MBD_SUPPORT; + if (Enable::MBD) + { + PHG4BbcSubsystem* mbd = new PHG4BbcSubsystem("BBC"); + mbd->SuperDetector("BBC"); + mbd->OverlapCheck(Enable::OVERLAPCHECK); + mbd->SetActive(); + if (SupportActive) + { + mbd->SetSupportActive(SupportActive); + } + g4Reco->registerSubsystem(mbd); + } + return; +} + +void Mbd_Reco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MBD_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + if (Enable::MBDFAKE && Enable::MBDRECO) + { + cout << "Enable::MBDFAKE and Enable::MBDRECO cannot be enabled together" << endl; + gSystem->Exit(1); + } + + if (Enable::MBDFAKE) + { + if (verbosity > 0) + { + cout << "MBDFAKE: Using smeared vtx and t0 resolutions of " + << G4MBD::z_smearing << " cm and " << G4MBD::t_smearing * 1000 << " ps" << endl; + } + MbdVertexFastSimReco* mbdvertex = new MbdVertexFastSimReco(); + mbdvertex->set_z_smearing(G4MBD::z_smearing); + mbdvertex->set_t_smearing(G4MBD::t_smearing); + mbdvertex->Verbosity(verbosity); + + se->registerSubsystem(mbdvertex); + } + if (Enable::MBDRECO) + { + auto mbddigi = new MbdDigitization(); + mbddigi->Verbosity(verbosity); + se->registerSubsystem(mbddigi); + + auto mbdreco = new MbdReco(); + mbdreco->Verbosity(verbosity); + se->registerSubsystem(mbdreco); + } + return; +} +#endif diff --git a/common/G4_PSTOF.C b/common/G4_PSTOF.C new file mode 100644 index 000000000..faa3a9ee4 --- /dev/null +++ b/common/G4_PSTOF.C @@ -0,0 +1,37 @@ +#ifndef MACRO_G4PSTOF_C +#define MACRO_G4PSTOF_C + +#include +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +// $Id$ + +/*! + * \file ${file_name} + * \brief Macro setting up the barrel mRPC psTOF + * \author Mickey Chiu + * \version $Revision$ + * \date $Date$ + */ +namespace Enable +{ + bool PSTOF = false; +} + +void PSTOFInit() +{ +} + +double PSTOF(PHG4Reco* g4Reco, double radius) +{ + PHG4PSTOFSubsystem* pstof = new PHG4PSTOFSubsystem("PSTOF"); + pstof->SuperDetector("PSTOF"); + // pstof->SetActive(-1,1); // set all modules active + g4Reco->registerSubsystem(pstof); + + // returns the outer radius to check for overlaps with next detector + return 90.; +} +#endif diff --git a/common/G4_ParticleFlow.C b/common/G4_ParticleFlow.C new file mode 100644 index 000000000..bb7b10f89 --- /dev/null +++ b/common/G4_ParticleFlow.C @@ -0,0 +1,52 @@ +#ifndef MACRO_G4PARTICLEFLOW_C +#define MACRO_G4PARTICLEFLOW_C + +#include + +#include +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libjetbase.so) +R__LOAD_LIBRARY(libparticleflow.so) + +namespace Enable +{ + bool PARTICLEFLOW = false; + int PARTICLEFLOW_VERBOSITY = 0; +} // namespace Enable + +void ParticleFlow() +{ + int verbosity = max(Enable::VERBOSITY, Enable::PARTICLEFLOW_VERBOSITY); + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + // note: assumes topoCluster input already configured + ParticleFlowReco *pfr = new ParticleFlowReco(); + pfr->set_energy_match_Nsigma(1.5); + pfr->Verbosity(verbosity); + se->registerSubsystem(pfr); + + JetReco *particleflowjetreco = new JetReco("PARTICLEFLOWJETRECO"); + particleflowjetreco->add_input(new ParticleFlowJetInput()); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_ParticleFlow_r02"); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_ParticleFlow_r03"); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_ParticleFlow_r04"); + particleflowjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_ParticleFlow_r03"); + particleflowjetreco->set_algo_node("ANTIKT"); + particleflowjetreco->set_input_node("PARTICLEFLOW"); + particleflowjetreco->Verbosity(verbosity); + se->registerSubsystem(particleflowjetreco); + + return; +} +#endif diff --git a/common/G4_Pipe.C b/common/G4_Pipe.C new file mode 100644 index 000000000..351eeb7a3 --- /dev/null +++ b/common/G4_Pipe.C @@ -0,0 +1,493 @@ +#ifndef MACRO_G4PIPE_C +#define MACRO_G4PIPE_C + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +namespace Enable +{ + bool PIPE = false; + bool PIPE_ABSORBER = false; + bool PIPE_OVERLAPCHECK = false; + int PIPE_VERBOSITY = 0; +} // namespace Enable + +namespace G4PIPE +{ + // STAR Beampipe for sPHENIX - based on STAR DWG 30006 + double be_pipe_radius = 2.00025; // 4.0005 cm inner diameter + double be_pipe_thickness = 0.0762; // 0.762 mm + double be_pipe_length = 120.015; // 120 cm or 47.25" + double be_pipe_zshift = -41.1639; // amount Be pipe is shifted south + + double al_pipe_radius = 2.00025; // same as Be pipe + double al_pipe_thickness = 0.1397; // 1.397 mm or 0.055" + double al_pipe_south_length = 101.486; // Al extension south (from Dan's drawing, slight diff from STAR drawing) + double al_pipe_north_length = 61.51; // Al extension north (from Dan's drawing, slight diff from STAR drawing) + double al_pipe_north_ext_length = 123.393; // additional north extension + + double flange_thickness = 6.934/2 - (al_pipe_radius + al_pipe_thickness); // Atlas 2.75" flange, radial thickness + double flange_length = 1.2825; // Atlas 2.75" flange + + double outer_pipe_precone_length = 22.86; + double outer_pipe_precone_radius = 2.00025; // same as Be pipe + double outer_pipe_thickness = 0.1397; // 1.397 mm or 0.055" + double outer_pipe_cone_length = 38.1; + double outer_pipe_ext_radius = 3.81; // past the cone +// double outer_pipe_ext_length = 67.087; // extension beyond conical part + double outer_pipe_ext_length = 100.; // extension beyond conical part through epd + + // maximum extent of the central part of beampipe (the forward regions are implemented in G4_Beamline.C) + double max_z = be_pipe_zshift + be_pipe_length / 2. + al_pipe_north_length + al_pipe_north_ext_length + + outer_pipe_precone_length + outer_pipe_cone_length + outer_pipe_ext_length; + +} // namespace G4PIPE + +void PipeInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::max_z + no_overlapp ); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PIPE::max_z + no_overlapp) ); +} + +double Pipe(PHG4Reco* g4Reco, double radius) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::PIPE_VERBOSITY); + + if (radius > G4PIPE::be_pipe_radius) + { + cout << "inconsistency: radius: " << radius + << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl; + gSystem->Exit(-1); + } + + int ilayer = 0; + + // mid-rapidity beryllium pipe + PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", ilayer++); + cyl->set_double_param("place_z", G4PIPE::be_pipe_zshift); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::be_pipe_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::be_pipe_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("BE_PIPE", ilayer++); + cyl->set_double_param("place_z", G4PIPE::be_pipe_zshift); + cyl->set_double_param("radius", G4PIPE::be_pipe_radius); // inner radius + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::be_pipe_length); + cyl->set_string_param("material", "G4_Be"); + cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north aluminum pipe + double north_pipe_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length); + cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("N_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 1A + double flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length; // center of flange coupling + // Al half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_AL", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // SS half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 1B + // SS half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // Al half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 2A + flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length; + // Al half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // SS half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // north flange 2B + // SS half, towards IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // Al half, away from IP + cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // south aluminum pipe + double south_pipe_place_z = G4PIPE::be_pipe_zshift - 0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_south_length; + cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", 0.0); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_south_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + cyl = new PHG4CylinderSubsystem("S_AL_PIPE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::al_pipe_south_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // south flange 1A + flange_place_z = G4PIPE::be_pipe_zshift - 0.5 * G4PIPE::be_pipe_length - G4PIPE::al_pipe_south_length; + // Al half, towards IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_Al", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // SS half, away from IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // south flange 1B + // SS half, towards IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_SS", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_STAINLESS-STEEL"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + // Al half, away from IP + cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_AL", ilayer++); + cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length); + cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::flange_length/2); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::flange_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* north outermost pipe (extension) [vacuum] */ + north_pipe_place_z += 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length) + 0.5 * G4PIPE::outer_pipe_precone_length; + cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* north outermost pipe (pre-conical part) */ + cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + PHG4ConeSubsystem* cone = nullptr; + + /* north outermost pipe (conical part) [vacuum] */ + north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length; + cone = new PHG4ConeSubsystem("VAC_N_OUTER_PIPE_CONE", ilayer++); + cone->SetR1(0., G4PIPE::outer_pipe_precone_radius); + cone->SetR2(0., G4PIPE::outer_pipe_ext_radius); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(north_pipe_place_z + no_overlapp); + cone->SetMaterial("G4_Galactic"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* north outermost pipe (conical part) */ + cone = new PHG4ConeSubsystem("N_OUTER_PIPE_CONE", ilayer++); + cone->SetR1(G4PIPE::outer_pipe_precone_radius, G4PIPE::outer_pipe_precone_radius + G4PIPE::outer_pipe_thickness); + cone->SetR2(G4PIPE::outer_pipe_ext_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(north_pipe_place_z + no_overlapp); + cone->SetMaterial("G4_Al"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* north outermost pipe (extension) [vacuum] */ + north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length; + cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* north outermost pipe (extension) */ + cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (pre-conical part) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::al_pipe_south_length + 0.5 * G4PIPE::outer_pipe_precone_length); + cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (pre-conical part) */ + cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_PRECONE", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (conical part) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length); + cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", ilayer++); + cone->SetR1(0., G4PIPE::outer_pipe_ext_radius); + cone->SetR2(0., G4PIPE::outer_pipe_precone_radius); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(south_pipe_place_z - no_overlapp); + cone->SetMaterial("G4_Galactic"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* south outermost pipe (conical part) */ + cone = new PHG4ConeSubsystem("S_OUTER_PIPE_CONE", ilayer++); + cone->SetR1(G4PIPE::outer_pipe_ext_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness); + cone->SetR2(G4PIPE::outer_pipe_precone_radius, G4PIPE::outer_pipe_precone_radius + G4PIPE::outer_pipe_thickness); + cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2); + cone->SetPlaceZ(south_pipe_place_z - no_overlapp); + cone->SetMaterial("G4_Al"); + cone->SuperDetector("PIPE"); + if (AbsorberActive) cone->SetActive(); + cone->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cone); + + /* south outermost pipe (extension) [vacuum] */ + south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length); + cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", 0.); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Galactic"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + /* south outermost pipe (extension) */ + cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_EXT", ilayer++); + cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp); + cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius); + cyl->set_int_param("lengthviarapidity", 0); + cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length); + cyl->set_string_param("material", "G4_Al"); + cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness); + cyl->SuperDetector("PIPE"); + if (AbsorberActive) cyl->SetActive(); + cyl->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(cyl); + + radius = G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness; + + if (verbosity > 0) + { + cout << "=========================== G4_Pipe.C::Pipe() =============================" << endl; + cout << " PIPE Material Description:" << endl; + cout << " inner radius = " << G4PIPE::be_pipe_radius << " cm" << endl; + cout << " thickness = " << G4PIPE::be_pipe_thickness << " cm" << endl; + cout << " outer radius = " << G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness << " cm" << endl; + cout << " length = " << G4PIPE::be_pipe_length << " cm" << endl; + cout << "===========================================================================" << endl; + } + + radius += no_overlapp; + + return radius; +} +#endif diff --git a/common/G4_PlugDoor.C b/common/G4_PlugDoor.C new file mode 100644 index 000000000..c0f9170c3 --- /dev/null +++ b/common/G4_PlugDoor.C @@ -0,0 +1,175 @@ +#ifndef MACRO_G4PLUGDOOR_C +#define MACRO_G4PLUGDOOR_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +void common_color(PHG4CylinderSubsystem *subsys); + +namespace Enable +{ + bool PLUGDOOR = false; + bool PLUGDOOR_ABSORBER = false; + bool PLUGDOOR_OVERLAPCHECK = false; + bool PLUGDOOR_BLACKHOLE = false; +} // namespace Enable + +namespace G4PLUGDOOR +{ + // sPHENIX forward flux return(s) + // define via four corners in the engineering drawing + double z_1 = 330.81; + double z_2 = 360.81; + double r_1 = 30; + double r_2 = 263.5; + + double length = z_2 - z_1; + double place_z = (z_1 + z_2) / 2.; + double thickness = 2.; // 2 cm thick +} // namespace G4PLUGDOOR + +void PlugDoorInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PLUGDOOR::r_2); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PLUGDOOR::place_z + G4PLUGDOOR::length / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -(G4PLUGDOOR::place_z + G4PLUGDOOR::length / 2.)); + if (Enable::PLUGDOOR_BLACKHOLE) + { + if (G4PLUGDOOR::thickness >= G4PLUGDOOR::z_2 - G4PLUGDOOR::z_1) + { + cout << "G4_PlugDoor::PlugDoorInit(): thickness " << G4PLUGDOOR::thickness + << " exceeds door thickness " << G4PLUGDOOR::z_2 - G4PLUGDOOR::z_1 + << endl; + gSystem->Exit(1); + } + } +} +void PlugDoor(PHG4Reco *g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PLUGDOOR_OVERLAPCHECK; + bool flux_door_active = Enable::ABSORBER || Enable::PLUGDOOR_ABSORBER; + + const string material("Steel_1006"); + + if (Enable::PLUGDOOR_BLACKHOLE) + { + double place_z_plate = G4PLUGDOOR::z_1 + G4PLUGDOOR::thickness / 2.; + double place_z_cyl = (G4PLUGDOOR::z_1 + G4PLUGDOOR::z_2 + G4PLUGDOOR::thickness) / 2.; + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 0); + flux_return_plus->set_double_param("length", G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_plus->set_double_param("place_z", place_z_plate); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 1); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_plus->set_double_param("place_z", place_z_cyl); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::thickness); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + // Black hole behind door with thickness G4PLUGDOOR::thickness + // same color as door - you will not distinguish it in the display + flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 2); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1 + G4PLUGDOOR::thickness); + flux_return_plus->set_double_param("place_z", place_z_cyl); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1 - G4PLUGDOOR::thickness); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + flux_return_plus->BlackHole(); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 0); + flux_return_minus->set_double_param("length", G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_minus->set_double_param("place_z", -place_z_plate); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + + flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 1); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_minus->set_double_param("place_z", -place_z_cyl); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::thickness); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + + // Black hole behind door with thickness G4PLUGDOOR::thickness + // same color as door - you will not distinguish it in the display + flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 2); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length - G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1 + G4PLUGDOOR::thickness); + flux_return_minus->set_double_param("place_z", -place_z_cyl); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1 - G4PLUGDOOR::thickness); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + flux_return_minus->BlackHole(); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + } + else + { + PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FLUXRET_ETA_PLUS", 3); + flux_return_plus->set_double_param("length", G4PLUGDOOR::length); + flux_return_plus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_plus->set_double_param("place_z", G4PLUGDOOR::place_z); + flux_return_plus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_plus->set_string_param("material", material); + flux_return_plus->SetActive(flux_door_active); + flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); + flux_return_plus->OverlapCheck(OverlapCheck); + common_color(flux_return_plus); + g4Reco->registerSubsystem(flux_return_plus); + + PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FLUXRET_ETA_MINUS", 3); + flux_return_minus->set_double_param("length", G4PLUGDOOR::length); + flux_return_minus->set_double_param("radius", G4PLUGDOOR::r_1); + flux_return_minus->set_double_param("place_z", -G4PLUGDOOR::place_z); + flux_return_minus->set_double_param("thickness", G4PLUGDOOR::r_2 - G4PLUGDOOR::r_1); + flux_return_minus->set_string_param("material", material); + flux_return_minus->SetActive(flux_door_active); + flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); + flux_return_minus->OverlapCheck(OverlapCheck); + common_color(flux_return_minus); + g4Reco->registerSubsystem(flux_return_minus); + } + + return; +} + +void common_color(PHG4CylinderSubsystem *subsys) +{ + subsys->set_color(0.29, 0.44, 0.54); +} +#endif diff --git a/common/G4_Production.C b/common/G4_Production.C new file mode 100644 index 000000000..85e7801a7 --- /dev/null +++ b/common/G4_Production.C @@ -0,0 +1,33 @@ +#ifndef MACRO_G4PRODUCTION_C +#define MACRO_G4PRODUCTION_C + +#include + +namespace Enable +{ + bool PRODUCTION = false; +} + +namespace PRODUCTION +{ + string SaveOutputDir = "./"; +} + +void Production_CreateOutputDir() +{ + PRODUCTION::SaveOutputDir = DstOut::OutputDir; + DstOut::OutputDir = PRODUCTION::SaveOutputDir + "/ongoing"; + string mkdircmd = "mkdir -p " + DstOut::OutputDir; + gSystem->Exec(mkdircmd.c_str()); +} + +void Production_MoveOutput() +{ + if (Enable::DSTOUT) + { + string fulloutfile = DstOut::OutputDir + "/" + DstOut::OutputFile; + string mvcmd = "mv " + fulloutfile + " " + PRODUCTION::SaveOutputDir; + gSystem->Exec(mvcmd.c_str()); + } +} +#endif diff --git a/common/G4_TopoClusterReco.C b/common/G4_TopoClusterReco.C new file mode 100644 index 000000000..293911e9a --- /dev/null +++ b/common/G4_TopoClusterReco.C @@ -0,0 +1,72 @@ +#ifndef MACRO_G4TOPOCLUSTERRECO_C +#define MACRO_G4TOPOCLUSTERRECO_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) + +namespace Enable +{ + bool TOPOCLUSTER = false; + int TOPOCLUSTER_VERBOSITY = 0; +} // namespace Enable + +void TopoClusterReco() +{ + int verbosity = max(Enable::VERBOSITY, Enable::TOPOCLUSTER_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + // topoClustering in all three layers + RawClusterBuilderTopo* ClusterBuilder = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo"); + ClusterBuilder->Verbosity(verbosity); + ClusterBuilder->set_nodename("TOPOCLUSTER_ALLCALO"); + ClusterBuilder->set_enable_HCal(true); + ClusterBuilder->set_enable_EMCal(true); + ClusterBuilder->set_noise(0.0025, 0.006, 0.03); + ClusterBuilder->set_significance(4.0, 2.0, 0.0); + ClusterBuilder->allow_corner_neighbor(true); + ClusterBuilder->set_do_split(true); + ClusterBuilder->set_minE_local_max(1.0, 2.0, 0.5); + ClusterBuilder->set_R_shower(0.025); + se->registerSubsystem(ClusterBuilder); + + // topoClustering only in EMCal (needed for particle flow) + RawClusterBuilderTopo* ClusterBuilder1 = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo1"); + ClusterBuilder1->Verbosity(verbosity); + ClusterBuilder1->set_nodename("TOPOCLUSTER_EMCAL"); + ClusterBuilder1->set_enable_HCal(false); + ClusterBuilder1->set_enable_EMCal(true); + ClusterBuilder1->set_noise(0.0025, 0.006, 0.03); + ClusterBuilder1->set_significance(4.0, 2.0, 0.0); + ClusterBuilder1->allow_corner_neighbor(true); + ClusterBuilder1->set_do_split(true); + ClusterBuilder1->set_minE_local_max(1.0, 2.0, 0.5); + ClusterBuilder1->set_R_shower(0.025); + se->registerSubsystem(ClusterBuilder1); + + // topoClustering only in I+OHCal (needed for particle flow) + RawClusterBuilderTopo* ClusterBuilder2 = new RawClusterBuilderTopo("HcalRawClusterBuilderTopo2"); + ClusterBuilder2->Verbosity(verbosity); + ClusterBuilder2->set_nodename("TOPOCLUSTER_HCAL"); + ClusterBuilder2->set_enable_HCal(true); + ClusterBuilder2->set_enable_EMCal(false); + ClusterBuilder2->set_noise(0.0025, 0.006, 0.03); + ClusterBuilder2->set_significance(4.0, 2.0, 0.0); + ClusterBuilder2->allow_corner_neighbor(true); + ClusterBuilder2->set_do_split(true); + ClusterBuilder2->set_minE_local_max(1.0, 2.0, 0.5); + ClusterBuilder2->set_R_shower(0.025); + se->registerSubsystem(ClusterBuilder2); + + return; +} +#endif diff --git a/common/G4_Tracking.C b/common/G4_Tracking.C new file mode 100644 index 000000000..122ad4881 --- /dev/null +++ b/common/G4_Tracking.C @@ -0,0 +1,643 @@ +#ifndef MACRO_G4TRACKING_C +#define MACRO_G4TRACKING_C + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libqa_modules.so) +R__LOAD_LIBRARY(libtrackeralign.so) + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include + +void TrackingInit() +{ + + std::cout << "G4_Tracking is now obsolete as of macros PR612. " + << std::endl << "Please switch to the new scheme for tracking, which is demosntrated in the PR at the following link: www.github.com/sPHENIX-Collaboration/macros/pull/612" + << std::endl + << "The switch is not difficult and just requires updating your macros repo and adding the new relevant tracking includes into your main Fun4All macro instead of G4_Tracking." + << std::endl; + gSystem->Exit(1); + + ACTSGEOM::ActsGeomInit(); + // space charge correction + /* corrections are applied in the track finding, and via TpcClusterMover before the final track fit */ + if( G4TPC::ENABLE_CORRECTIONS ) + { + auto se = Fun4AllServer::instance(); + auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; + tpcLoadDistortionCorrection->set_read_phi_as_radians( G4TPC::DISTORTIONS_USE_PHI_AS_RADIANS ); + tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); + se->registerSubsystem(tpcLoadDistortionCorrection); + } + +} + +void convert_seeds() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + TrackSeedTrackMapConverter *converter = new TrackSeedTrackMapConverter(); + // Default set to full SvtxTrackSeeds. Can be set to + // SiliconTrackSeedContainer or TpcTrackSeedContainer + converter->setTrackSeedName("SvtxTrackSeedContainer"); + converter->Verbosity(verbosity); + se->registerSubsystem(converter); +} + +void Tracking_Reco_TrackSeed() +{ + + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + if (!G4TRACKING::use_full_truth_track_seeding) + { + // Assemble silicon clusters into track stubs + if (G4TRACKING::use_truth_silicon_seeding) + { + // For the silicon, for each truth particle, create a track and associate clusters with it using truth information, write to silicon track map + // track stubs are given the location of the truth vertex in this module + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingSilicon"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SiliconTrackSeedContainer"); + pat_rec->set_min_layer(0); + pat_rec->set_max_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + se->registerSubsystem(pat_rec); + } else { + auto silicon_Seeding = new PHActsSiliconSeeding; + silicon_Seeding->Verbosity(verbosity); + std::cout << "SETTING SI SEED CV" << std::endl; + silicon_Seeding->set_cluster_version(G4TRACKING::cluster_version); + se->registerSubsystem(silicon_Seeding); + + auto merger = new PHSiliconSeedMerger; + merger->Verbosity(verbosity); + se->registerSubsystem(merger); + } + + // Assemble TPC clusters into track stubs + if (G4TRACKING::use_truth_tpc_seeding) + { + // For the TPC, for each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position odf the truth vertex in this module + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingTpc"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("TpcTrackSeedContainer"); + pat_rec->set_min_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + pat_rec->set_max_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer + G4TPC::n_gas_layer); + se->registerSubsystem(pat_rec); + + } else { + + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(1.5, 0.05); // (z width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->set_cluster_version(G4TRACKING::cluster_version); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + } + + // match silicon track seeds to TPC track seeds + if (G4TRACKING::use_truth_si_matching) + { + std::cout << "Tracking_Reco_TrackSeed - Using truth Si matching " << std::endl; + // use truth particle matching in TPC to assign clusters in silicon to TPC tracks from CA seeder + auto silicon_assoc = new PHTruthSiliconAssociation; + silicon_assoc->Verbosity(verbosity); + se->registerSubsystem(silicon_assoc); + } else { + std::cout << "Tracking_Reco_TrackSeed - Using stub matching for Si matching " << std::endl; + // The normal silicon association methods + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + auto silicon_match = new PHSiliconTpcTrackMatching; + silicon_match->Verbosity(verbosity); + silicon_match->set_pp_mode(TRACKING::pp_mode); + std::cout << "PHSiliconTpcTrackMatching pp_mode set to " << TRACKING::pp_mode << std::endl; + if (G4TRACKING::SC_CALIBMODE) + { + // search windows for initial matching with distortions + // tuned values are 0.04 and 0.008 in distorted events + silicon_match->set_phi_search_window(0.04); + silicon_match->set_eta_search_window(0.008); + } else { + // after distortion corrections and rerunning clustering, default tuned values are 0.02 and 0.004 in low occupancy events + silicon_match->set_phi_search_window(0.03); + silicon_match->set_eta_search_window(0.005); + } + silicon_match->set_test_windows_printout(false); // used for tuning search windows + se->registerSubsystem(silicon_match); + } + + // Associate Micromegas clusters with the tracks + if( Enable::MICROMEGAS ) + { + std::cout << "Tracking_Reco_TrackSeed - Using Micromegas matching " << std::endl; + + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + if (G4TRACKING::SC_CALIBMODE) + { + // configuration is potentially with different search windows + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } else { + // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + } + + } else { + + // full truth track finding + std::cout << "Tracking_Reco_TrackSeed - Using full truth track seeding" << std::endl; + + // For each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position of the truth vertex in this module, but Genfit does not care + // Includes clusters for TPC, silicon and MM's + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxTrackSeedContainer"); + se->registerSubsystem(pat_rec); + + } + + /* + * all done + * at this stage tracks are fully assembled. They contain clusters spaning Silicon detectors, TPC and Micromegas + * they are ready to be fit. + */ + if(G4TRACKING::convert_seeds_to_svtxtracks) + { + convert_seeds(); + } +} + + +void vertexing() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + if (G4TRACKING::use_truth_vertexing) + { + auto vtxing = new PHTruthVertexing; + vtxing->associate_tracks(true); + std::string trackmapnamef = "SvtxTrackMap"; + vtxing->set_track_map_name(trackmapnamef); + se->registerSubsystem(vtxing); + } else { + auto vtxfinder = new PHSimpleVertexFinder; + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); + } +} + +void Tracking_Reco_TrackFit() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + auto se = Fun4AllServer::instance(); + + // correct clusters for particle propagation in TPC + auto deltazcorr = new PHTpcDeltaZCorrection; + deltazcorr->Verbosity(verbosity); + se->registerSubsystem(deltazcorr); + + + // perform final track fit with ACTS + auto actsFit = new PHActsTrkFitter; + actsFit->Verbosity(verbosity); + //actsFit->commissioning(G4TRACKING::use_alignment); + actsFit->set_cluster_version(G4TRACKING::cluster_version); + // in calibration mode, fit only Silicons and Micromegas hits + actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + actsFit->set_pp_mode(TRACKING::pp_mode); + se->registerSubsystem(actsFit); + + + if (G4TRACKING::SC_CALIBMODE) + { + /* + * in calibration mode, calculate residuals between TPC and fitted tracks, + * store in dedicated structure for distortion correction + */ + auto residuals = new PHTpcResiduals; + residuals->setClusterVersion(G4TRACKING::cluster_version); + residuals->setOutputfile(G4TRACKING::SC_ROOTOUTPUT_FILENAME); + residuals->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } else { + + /* + * in full tracking mode, run track cleaner, vertex finder, + * propagete tracks to vertex + * propagate tracks to EMCAL + */ + + if( !G4TRACKING::use_full_truth_track_seeding ) + { + // Choose the best silicon matched track for each TPC track seed + /* this breaks in truth_track seeding mode because there is no TpcSeed */ + auto cleaner = new PHTrackCleaner; + cleaner->Verbosity(verbosity); + se->registerSubsystem(cleaner); + } + + vertexing(); + + // Propagate track positions to the vertex position + auto vtxProp = new PHActsVertexPropagator; + vtxProp->Verbosity(verbosity); + se->registerSubsystem(vtxProp); + + // project tracks to EMCAL + auto projection = new PHActsTrackProjection; + projection->Verbosity(verbosity); + se->registerSubsystem(projection); + + + } + +} + +void Tracking_Reco_CommissioningTrackSeed() +{ + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + auto silicon_Seeding = new PHActsSiliconSeeding; + silicon_Seeding->Verbosity(verbosity); + silicon_Seeding->set_cluster_version(G4TRACKING::cluster_version); + silicon_Seeding->sigmaScattering(50.); + silicon_Seeding->setRPhiSearchWindow(0.4); + se->registerSubsystem(silicon_Seeding); + + auto merger = new PHSiliconSeedMerger; + merger->Verbosity(verbosity); + se->registerSubsystem(merger); + + // Assemble TPC clusters into track stubs + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(1.5, 0.05); // (z width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->set_cluster_version(G4TRACKING::cluster_version); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + + + // match silicon track seeds to TPC track seeds + + // The normal silicon association methods + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + auto silicon_match = new PHSiliconTpcTrackMatching; + silicon_match->Verbosity(verbosity); + silicon_match->set_pp_mode(TRACKING::pp_mode); + + silicon_match->set_phi_search_window(0.2); + silicon_match->set_eta_search_window(0.015); + silicon_match->set_x_search_window(std::numeric_limits::max()); + silicon_match->set_y_search_window(std::numeric_limits::max()); + silicon_match->set_z_search_window(std::numeric_limits::max()); + + silicon_match->set_test_windows_printout(false); // used for tuning search windows + se->registerSubsystem(silicon_match); + + + // Associate Micromegas clusters with the tracks + if( Enable::MICROMEGAS ) + { + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + + mm_match->set_rphi_search_window_lyr1(0.4); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + + + } + if(G4TRACKING::convert_seeds_to_svtxtracks) + { + convert_seeds(); + } +} + +void alignment(std::string datafilename = "mille_output_data_file", + std::string steeringfilename = "mille_steer") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + auto mille = new MakeMilleFiles; + mille->Verbosity(verbosity); + mille->set_datafile_name(datafilename + ".bin"); + mille->set_steeringfile_name(steeringfilename + ".txt"); + mille->set_cluster_version(G4TRACKING::cluster_version); + se->registerSubsystem(mille); + + auto helical = new HelicalFitter; + helical->Verbosity(0); + helical->set_datafile_name(datafilename + "_helical.bin"); + helical->set_steeringfile_name(steeringfilename + "_helical.txt"); + helical->set_cluster_version(G4TRACKING::cluster_version); + se->registerSubsystem(helical); + +} + +void Tracking_Reco() +{ + + std::cout << "G4_Tracking is now obsolete as of macros PR612. " + << std::endl << "Please switch to the new scheme for tracking, which is demosntrated in the PR at the following link: www.github.com/sPHENIX-Collaboration/macros/pull/612" + << std::endl + << "The switch is not difficult and just requires updating your macros repo and adding the new relevant tracking includes into your main Fun4All macro instead of G4_Tracking." + << std::endl; + gSystem->Exit(1); + + /* + * just a wrapper around track seeding and track fitting methods, + * to minimize disruption to existing steering macros + */ + if(G4TRACKING::use_alignment) + { + Tracking_Reco_CommissioningTrackSeed(); + } + else + { + Tracking_Reco_TrackSeed(); + } + + if(G4TRACKING::convert_seeds_to_svtxtracks) + { + vertexing(); + } + else + { + Tracking_Reco_TrackFit(); + } + + + if(G4TRACKING::use_alignment) + { + alignment(); + } + +} + +void Filter_Conversion_Electrons(std::string ntuple_outfile) +{ + std::cout << "G4_Tracking is now obsolete as of macros PR612. " + << std::endl << "Please switch to the new scheme for tracking, which is demosntrated in the PR at the following link: www.github.com/sPHENIX-Collaboration/macros/pull/612" + << std::endl + << "The switch is not difficult and just requires updating your macros repo and adding the new relevant tracking includes into your main Fun4All macro instead of G4_Tracking." + << std::endl; + gSystem->Exit(1); + Fun4AllServer* se = Fun4AllServer::instance(); + SecondaryVertexFinder* secvert = new SecondaryVertexFinder; + secvert->Verbosity(0); + secvert->set_write_electrons_node(true); // writes copy of filtered electron tracks to node tree + secvert->set_write_ntuple(false); // writes ntuple for tuning cuts + secvert->setDecayParticleMass( 0.000511); // for electrons + secvert->setOutfileName(ntuple_outfile); + se->registerSubsystem(secvert); +} + + +void build_truthreco_tables() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + // this module builds high level truth track association table. + // If this module is used, this table should be called before any evaluator calls. + // Removing this module, evaluation will still work but trace truth association through the layers of G4-hit-cluster + SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); + tables->Verbosity(verbosity); + se->registerSubsystem(tables); + + return; +} + +void Tracking_Eval(const std::string& outputfile) +{ + + std::cout << "G4_Tracking is now obsolete as of macros PR612. " + << std::endl << "Please switch to the new scheme for tracking, which is demosntrated in the PR at the following link: www.github.com/sPHENIX-Collaboration/macros/pull/612" + << std::endl + << "The switch is not difficult and just requires updating your macros repo and adding the new relevant tracking includes into your main Fun4All macro instead of G4_Tracking." + << std::endl; + gSystem->Exit(1); + + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + build_truthreco_tables(); + + //---------------- + // Tracking evaluation + //---------------- + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", + G4MVTX::n_maps_layer, + G4INTT::n_intt_layer, + G4TPC::n_gas_layer, + G4MICROMEGAS::n_micromegas_layer); + eval->do_cluster_eval(true); + eval->do_g4hit_eval(false); + eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... + eval->do_gpoint_eval(true); + eval->do_vtx_eval_light(true); + eval->do_eval_light(true); + eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); + bool embed_scan = true; + if(TRACKING::pp_mode) embed_scan = false; + eval->scan_for_embedded(embed_scan); // take all tracks if false - take only embedded tracks if true + eval->scan_for_primaries(embed_scan); // defaults to only thrown particles for ntp_gtrack + std::cout << "SvtxEvaluator: pp_mode set to " << TRACKING::pp_mode << " and scan_for_embedded set to " << embed_scan << std::endl; + eval->Verbosity(verbosity); + eval->set_cluster_version(G4TRACKING::cluster_version); + + se->registerSubsystem(eval); + + return; +} + +void Tracking_QA() +{ + + std::cout << "G4_Tracking is now obsolete as of macros PR612. " + << std::endl << "Please switch to the new scheme for tracking, which is demosntrated in the PR at the following link: www.github.com/sPHENIX-Collaboration/macros/pull/612" + << std::endl + << "The switch is not difficult and just requires updating your macros repo and adding the new relevant tracking includes into your main Fun4All macro instead of G4_Tracking." + << std::endl; + gSystem->Exit(1); + + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + build_truthreco_tables(); + + QAG4SimulationTracking* qa = new QAG4SimulationTracking(); + // qa->addEmbeddingID(2); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + QAG4SimulationVertex* qa2 = new QAG4SimulationVertex(); + // qa2->addEmbeddingID(2); + qa2->Verbosity(verbosity); + se->registerSubsystem(qa2); + + // Acts Kalman Filter vertex finder + //================================= + QAG4SimulationVertex* qav = new QAG4SimulationVertex(); + // qav->addEmbeddingID(2); + qav->Verbosity(verbosity); + qav->setVertexMapName("SvtxVertexMapActs"); + se->registerSubsystem(qav); + + if (Input::UPSILON) + { + QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); + + for (int id : Input::UPSILON_EmbedIds) + { + qa->addEmbeddingID(id); + } + se->registerSubsystem(qa); + } +} + +void Distortions_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + auto qa = new QAG4SimulationDistortions(); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + +} +#endif diff --git a/common/G4_Tracking_Cosmics.C b/common/G4_Tracking_Cosmics.C new file mode 100644 index 000000000..152379fe6 --- /dev/null +++ b/common/G4_Tracking_Cosmics.C @@ -0,0 +1,333 @@ +#ifndef MACRO_G4TRACKING_C +#define MACRO_G4TRACKING_C + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NOTICE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// To use, this must be included in BOTH your Fun4All macro AND common/G4_Micromegas.C! + +R__LOAD_LIBRARY(libg4eval.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libqa_modules.so) + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include + +namespace Enable +{ + bool TRACKING_TRACK = false; + bool TRACKING_EVAL = false; + int TRACKING_VERBOSITY = 0; + bool TRACKING_QA = false; +} // namespace Enable + +namespace G4TRACKING +{ + bool use_alignment = false; + bool use_full_truth_track_seeding = false; + bool use_truth_tpc_seeding = false; + bool g4eval_use_initial_vertex = true; + bool SC_CALIBMODE = false; +} + +void TrackingInit() +{ + ACTSGEOM::ActsGeomInit(); + // space charge correction + /* corrections are applied in the track finding, and via TpcClusterMover before the final track fit */ + if( G4TPC::ENABLE_CORRECTIONS ) + { + auto se = Fun4AllServer::instance(); + auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; + tpcLoadDistortionCorrection->set_read_phi_as_radians( G4TPC::DISTORTIONS_USE_PHI_AS_RADIANS ); + tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); + se->registerSubsystem(tpcLoadDistortionCorrection); + } +} + +void convert_seeds() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + TrackSeedTrackMapConverter *converter = new TrackSeedTrackMapConverter(); + // Default set to full SvtxTrackSeeds. Can be set to + // SiliconTrackSeedContainer or TpcTrackSeedContainer + converter->setTrackSeedName("SvtxTrackSeedContainer"); + converter->Verbosity(verbosity); + se->registerSubsystem(converter); +} + +void Tracking_Reco_TrackSeed() +{ + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + if (!G4TRACKING::use_full_truth_track_seeding) + { + // Assemble TPC clusters into track stubs + if (G4TRACKING::use_truth_tpc_seeding) + { + // For the TPC, for each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position odf the truth vertex in this module + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingTpc"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("TpcTrackSeedContainer"); + pat_rec->set_min_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + pat_rec->set_max_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer + G4TPC::n_gas_layer); + se->registerSubsystem(pat_rec); + + } else { + + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(50., 1.); // (z width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->set_cluster_version(G4TRACKING::cluster_version); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + } + + PHSiliconHelicalPropagator* hprop = new PHSiliconHelicalPropagator("HelicalPropagator"); + hprop->Verbosity(verbosity); + se->registerSubsystem(hprop); + + // Associate Micromegas clusters with the tracks + if( Enable::MICROMEGAS ) + { + std::cout << "Tracking_Reco_TrackSeed - Using Micromegas matching " << std::endl; + + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + if (G4TRACKING::SC_CALIBMODE) + { + // configuration is potentially with different search windows + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } else { + // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + } + + } else { + + // full truth track finding + std::cout << "Tracking_Reco_TrackSeed - Using full truth track seeding" << std::endl; + + // For each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position of the truth vertex in this module, but Genfit does not care + // Includes clusters for TPC, silicon and MM's + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxTrackSeedContainer"); + se->registerSubsystem(pat_rec); + + } + + /* + * all done + * at this stage tracks are fully assembled. They contain clusters spaning Silicon detectors, TPC and Micromegas + * they are ready to be fit. + */ + convert_seeds(); +} + +void vertexing() +{ + // SvtxEvaluator will not run without vertexing, even though it produces nothing useful in this case + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + auto vtxfinder = new PHSimpleVertexFinder; + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); +} + +void alignment(std::string datafilename = "mille_output_data_file", + std::string steeringfilename = "mille_steer") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + auto mille = new MakeMilleFiles; + mille->Verbosity(verbosity); + mille->set_datafile_name(datafilename + ".bin"); + mille->set_steeringfile_name(steeringfilename + ".txt"); + se->registerSubsystem(mille); + + auto helical = new HelicalFitter; + helical->Verbosity(verbosity); + helical->set_datafile_name(datafilename + "_helical.bin"); + helical->set_steeringfile_name(steeringfilename + "_helical.txt"); + se->registerSubsystem(helical); + +} + +void Tracking_Reco() +{ + Tracking_Reco_TrackSeed(); + vertexing(); + if(G4TRACKING::use_alignment) alignment(); +} + +void build_truthreco_tables() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + // this module builds high level truth track association table. + // If this module is used, this table should be called before any evaluator calls. + // Removing this module, evaluation will still work but trace truth association through the layers of G4-hit-cluster + SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); + tables->Verbosity(verbosity); + se->registerSubsystem(tables); + + return; +} + +void Tracking_Eval(const std::string& outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + build_truthreco_tables(); + + //---------------- + // Tracking evaluation + //---------------- + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", + G4MVTX::n_maps_layer, + G4INTT::n_intt_layer, + G4TPC::n_gas_layer, + G4MICROMEGAS::n_micromegas_layer); + eval->do_cluster_eval(true); + eval->do_g4hit_eval(true); + eval->do_hit_eval(true); // enable to see the hits that includes the chamber physics... + eval->do_gpoint_eval(true); + eval->do_vtx_eval_light(true); + eval->do_eval_light(true); + eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); + bool embed_scan = true; + if(TRACKING::pp_mode) embed_scan = false; + eval->scan_for_embedded(embed_scan); // take all tracks if false - take only embedded tracks if true + eval->scan_for_primaries(embed_scan); // defaults to only thrown particles for ntp_gtrack + std::cout << "SvtxEvaluator: pp_mode set to " << TRACKING::pp_mode << " and scan_for_embedded set to " << embed_scan << std::endl; + eval->Verbosity(verbosity); + eval->set_cluster_version(G4TRACKING::cluster_version); + + se->registerSubsystem(eval); + + return; +} + +void Tracking_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + build_truthreco_tables(); + + QAG4SimulationTracking* qa = new QAG4SimulationTracking(); + // qa->addEmbeddingID(2); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + QAG4SimulationVertex* qa2 = new QAG4SimulationVertex(); + // qa2->addEmbeddingID(2); + qa2->Verbosity(verbosity); + se->registerSubsystem(qa2); + + // Acts Kalman Filter vertex finder + //================================= + QAG4SimulationVertex* qav = new QAG4SimulationVertex(); + // qav->addEmbeddingID(2); + qav->Verbosity(verbosity); + qav->setVertexMapName("SvtxVertexMapActs"); + se->registerSubsystem(qav); + + if (Input::UPSILON) + { + QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); + + for (int id : Input::UPSILON_EmbedIds) + { + qa->addEmbeddingID(id); + } + se->registerSubsystem(qa); + } +} + + +#endif // MACRO_G4TRACKING_C diff --git a/common/G4_TrkrSimulation.C b/common/G4_TrkrSimulation.C new file mode 100644 index 000000000..07283c384 --- /dev/null +++ b/common/G4_TrkrSimulation.C @@ -0,0 +1,526 @@ +#ifndef MACRO_G4TRKRSIM_C +#define MACRO_G4TRKRSIM_C + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundefined-internal" +#include +#pragma GCC diagnostic pop + +#include +#include +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4tpc.so) +R__LOAD_LIBRARY(libg4mvtx.so) +R__LOAD_LIBRARY(libg4intt.so) +R__LOAD_LIBRARY(libg4micromegas.so) + +void MvtxInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 12.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -165.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 24.); +} + +double Mvtx(PHG4Reco* g4Reco, double radius, + const int supportactive = 0) +{ + bool maps_overlapcheck = Enable::OVERLAPCHECK || Enable::MVTX_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + bool SupportActive = Enable::SUPPORT || Enable::MVTX_SUPPORT; + + PHG4MvtxSubsystem* mvtx = new PHG4MvtxSubsystem("MVTX"); + mvtx->Verbosity(verbosity); + + for (int ilayer = 0; ilayer < G4MVTX::n_maps_layer; ilayer++) + { + double radius_lyr = PHG4MvtxDefs::mvtxdat[ilayer][PHG4MvtxDefs::kRmd]; +// mvtx->set_double_param(ilayer, "layer_z_offset", G4MVTXAlignment::z_offset[ilayer]); + if (verbosity) + { + cout << "Create Maps layer " << ilayer << " with radius " << radius_lyr << " mm." << endl; + } + radius = radius_lyr / 10.; + } +// mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "alignment_path", G4MVTXAlignment::alignment_path); + mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave.gdml")); + + mvtx->SetActive(); + if (SupportActive) + { + mvtx->SetSupportActive(); + } + mvtx->OverlapCheck(maps_overlapcheck); + g4Reco->registerSubsystem(mvtx); + radius += G4MVTX::radius_offset; + return radius; +} + +void Mvtx_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + // new storage containers + PHG4MvtxHitReco* maps_hits = new PHG4MvtxHitReco("MVTX"); + maps_hits->Verbosity(verbosity); + + double maps_readout_window = 5000.0; // ns + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + // override the default timing window - default is +/- 5000 ns + maps_hits->set_double_param("mvtx_tmin", -maps_readout_window); + maps_hits->set_double_param("mvtx_tmax", maps_readout_window + extended_readout_time); + + std::cout << "PHG4MvtxHitReco: readout window is from " << -maps_readout_window << " to " << maps_readout_window + extended_readout_time << std::endl; + se->registerSubsystem(maps_hits); + + PHG4MvtxDigitizer* digimvtx = new PHG4MvtxDigitizer(); + digimvtx->Verbosity(verbosity); + // energy deposit in 25 microns = 9.6 KeV = 1000 electrons collected after recombination + //digimvtx->set_adc_scale(0.95e-6); // default set in code is 0.95e-06, which is 99 electrons + se->registerSubsystem(digimvtx); + + return; +} + + +void InttInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 20.); // estimated from display, can be made smaller but good enough + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 410. / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -410. / 2.); + // the mvtx is not called if disabled but the default number of layers is set to 3, so we need to set it + // to zero + if (!Enable::MVTX) + { + G4MVTX::n_maps_layer = 0; + } +} + +double Intt(PHG4Reco* g4Reco, double radius, + const int absorberactive = 0) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + bool intt_overlapcheck = Enable::OVERLAPCHECK || Enable::INTT_OVERLAPCHECK; + + // instantiate the INTT subsystem and register it + // We make one instance of PHG4INTTSubsystem for all four layers of tracker + // dimensions are in mm, angles are in radians + + // PHG4InttSubsystem creates the detetor layer using PHG4InttDetector + // and instantiates the appropriate PHG4SteppingAction + + // The length of vpair is used to determine the number of layers + std::vector> vpair; // (sphxlayer, inttlayer) + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + // We want the sPHENIX layer numbers for the Intt to be from n_maps_layer to n_maps_layer+n_intt_layer - 1 + vpair.push_back(std::make_pair(G4MVTX::n_maps_layer + i, i)); // sphxlayer=n_maps_layer+i corresponding to inttlayer=i + if (verbosity) cout << "Create strip tracker layer " << vpair[i].second << " as sphenix layer " << vpair[i].first << endl; + } + + PHG4InttSubsystem* sitrack = new PHG4InttSubsystem("INTT", vpair); + sitrack->Verbosity(verbosity); + sitrack->SetActive(1); + sitrack->OverlapCheck(intt_overlapcheck); + if (Enable::INTT_ABSORBER || Enable::ABSORBER) + { + sitrack->SetAbsorberActive(); + } + if (Enable::INTT_SUPPORT || Enable::SUPPORT) + { + sitrack->set_int_param(PHG4InttDefs::SUPPORTPARAMS, "supportactive", 1); + } + g4Reco->registerSubsystem(sitrack); + + // Set the laddertype and ladder spacing configuration + + cout << "Intt has " << G4INTT::n_intt_layer << " layers with layer setup:" << endl; + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + cout << " Intt layer " << i << " laddertype " << G4INTT::laddertype[i] << " nladders " << G4INTT::nladder[i] + << " sensor radius " << G4INTT::sensor_radius[i] << endl; + sitrack->set_int_param(i, "laddertype", G4INTT::laddertype[i]); + sitrack->set_int_param(i, "nladder", G4INTT::nladder[i]); + sitrack->set_double_param(i, "sensor_radius", G4INTT::sensor_radius[i]); // expecting cm + } + + // outer radius marker (translation back to cm) + radius = G4INTT::intt_radius_max * 0.1; + return radius; +} + +// Central detector cell reco is disabled as EIC setup use the fast tracking sim for now +void Intt_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + if (G4INTT::InttDeadMapOption != G4INTT::kInttNoDeadMap) + { + // Load pre-defined deadmaps + PHG4InttDeadMapLoader* deadMapINTT = new PHG4InttDeadMapLoader("INTT"); + + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + string DeadMapConfigName = Form("intt_layer%d/", i); + + if (G4INTT::InttDeadMapOption == G4INTT::kInttDeadMap) + { + string DeadMapPath = string(getenv("CALIBRATIONROOT")) + string("/Tracking/INTT/DeadMap/"); + //string DeadMapPath = "/sphenix/u/wxie/sphnx_software/INTT" + string("/DeadMap/"); + + DeadMapPath += DeadMapConfigName; + + deadMapINTT->deadMapPath(G4MVTX::n_maps_layer + i, DeadMapPath); + } + else + { + cout << "G4_Intt.C - fatal error - invalid InttDeadMapOption = " << G4INTT::InttDeadMapOption << endl; + exit(1); + } + } + + deadMapINTT->Verbosity(verbosity); + //deadMapINTT -> Verbosity(1); + se->registerSubsystem(deadMapINTT); + } + // new storage containers + PHG4InttHitReco* reco = new PHG4InttHitReco(); + + // The timing window defaults are set in the INTT ladder model, they can be overridden here + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + reco->set_double_param("tmax", 80.0 + extended_readout_time); + reco->set_double_param("tmin", -20.0); + std::cout << "INTT readout window is set to -20 to " << 80.0 + extended_readout_time << std::endl; + reco->Verbosity(verbosity); + se->registerSubsystem(reco); + + // Intt digitization + //=========== + // these should be used for the Intt + /* + How threshold are calculated based on default FPHX settings + Four part information goes to the threshold calculation: + 1. In 320 um thick silicon, the MIP e-h pair for a nominally indenting tracking is 3.87 MeV/cm * 320 um / 3.62 eV/e-h = 3.4e4 e-h pairs + 2. From DOI: 10.1016/j.nima.2014.04.017, FPHX integrator amplifier gain is 100mV / fC. That translate MIP voltage to 550 mV. + 3. From [FPHX Final Design Document](https://www.phenix.bnl.gov/WWW/fvtx/DetectorHardware/FPHX/FPHX2_June2009Revision.doc), the DAC0-7 setting for 8-ADC thresholds above the V_ref, as in Table 2 - Register Addresses and Defaults + 4, From [FPHX Final Design Document](https://www.phenix.bnl.gov/WWW/fvtx/DetectorHardware/FPHX/FPHX2_June2009Revision.doc) section Front-end Program Bits, the formula to translate DAC setting to comparitor voltages. + The result threshold table based on FPHX default value is as following + | FPHX Register Address | Name | Default value | Voltage - Vref (mV) | To electrons based on calibration | Electrons | Fraction to MIP | + |-----------------------|-----------------|---------------|---------------------|-----------------------------------|-----------|-----------------| + | 4 | Threshold DAC 0 | 8 | 32 | 2500 | 2000 | 5.85E-02 | + | 5 | Threshold DAC 1 | 16 | 64 | 5000 | 4000 | 1.17E-01 | + | 6 | Threshold DAC 2 | 32 | 128 | 10000 | 8000 | 2.34E-01 | + | 7 | Threshold DAC 3 | 48 | 192 | 15000 | 12000 | 3.51E-01 | + | 8 | Threshold DAC 4 | 80 | 320 | 25000 | 20000 | 5.85E-01 | + | 9 | Threshold DAC 5 | 112 | 448 | 35000 | 28000 | 8.18E-01 | + | 10 | Threshold DAC 6 | 144 | 576 | 45000 | 36000 | 1.05E+00 | + | 11 | Threshold DAC 7 | 176 | 704 | 55000 | 44000 | 1.29E+00 | + DAC0-7 threshold as fraction to MIP voltage are set to PHG4InttDigitizer::set_adc_scale as 3-bit ADC threshold as fractions to MIP energy deposition. + */ + std::vector userrange; // 3-bit ADC threshold relative to the mip_e at each layer. + userrange.push_back(0.0584625322997416); + userrange.push_back(0.116925064599483); + userrange.push_back(0.233850129198966); + userrange.push_back(0.35077519379845); + userrange.push_back(0.584625322997416); + userrange.push_back(0.818475452196383); + userrange.push_back(1.05232558139535); + userrange.push_back(1.28617571059432); + + // new containers + PHG4InttDigitizer* digiintt = new PHG4InttDigitizer(); + digiintt->Verbosity(verbosity); + //digiintt->Verbosity(3); + for (int i = 0; i < G4INTT::n_intt_layer; i++) + { + digiintt->set_adc_scale(G4MVTX::n_maps_layer + i, userrange); + } + se->registerSubsystem(digiintt); + + return; +} + +void TPCInit() +{ + std::cout << "G4_TrkrSimulation::TpcInit" << std::endl; + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4TPC::tpc_outer_radius); + + if (Enable::TPC_ENDCAP) + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 130.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -130.); + } + else + { + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 211. / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -211. / 2.); + } + + // the mvtx is not called if disabled but the default number of layers is set to 3, + // so we need to set it to zero + if (!Enable::MVTX) + { + G4MVTX::n_maps_layer = 0; + } + // same for the INTT + if (!Enable::INTT) + { + G4INTT::n_intt_layer = 0; + } + + // Set the (static) drift velocity in the cluster Z crossing correction module + TpcClusterZCrossingCorrection::_vdrift = G4TPC::tpc_drift_velocity_reco; +} + +//! TPC end cap, wagon wheel, electronics +void TPC_Endcaps(PHG4Reco* g4Reco) +{ + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER; + + PHG4TpcEndCapSubsystem* tpc_endcap = new PHG4TpcEndCapSubsystem("TPC_ENDCAP"); + tpc_endcap->SuperDetector("TPC_ENDCAP"); + + if (AbsorberActive) tpc_endcap->SetActive(); + tpc_endcap->OverlapCheck(OverlapCheck); + + // tpc_endcap->set_int_param("construction_verbosity", 2); + + g4Reco->registerSubsystem(tpc_endcap); + + return; +} + +double TPC(PHG4Reco* g4Reco, + double radius) +{ + std::cout << "G4_TrkrSimulation::TPC" << std::endl; + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK; + bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER; + + PHG4TpcSubsystem* tpc = new PHG4TpcSubsystem("TPC"); + tpc->SetActive(); + tpc->SuperDetector("TPC"); + tpc->set_double_param("steplimits", 1); // 1cm steps + + tpc->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_sim); + tpc->set_int_param("tpc_minlayer_inner", G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + tpc->set_int_param("ntpc_layers_inner", G4TPC::n_tpc_layer_inner); + tpc->set_int_param("ntpc_phibins_inner", G4TPC::tpc_layer_rphi_count_inner); + + if (AbsorberActive) + { + tpc->SetAbsorberActive(); + } + + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) + { + extended_readout_time = TRACKING::pp_extended_readout_time; + } + + tpc->set_double_param("extended_readout_time", extended_readout_time); + + tpc->OverlapCheck(OverlapCheck); + g4Reco->registerSubsystem(tpc); + + if (Enable::TPC_ENDCAP) + { + TPC_Endcaps(g4Reco); + } + + radius = G4TPC::tpc_outer_radius; + + radius += no_overlapp; + + return radius; +} + +void TPC_Cells() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + auto se = Fun4AllServer::instance(); + + // central membrane G4Hit generation + if( G4TPC::ENABLE_CENTRAL_MEMBRANE_HITS ) + { + auto centralMembrane = new PHG4TpcCentralMembrane; + centralMembrane->setCentralMembraneDelay(0); + centralMembrane->setCentralMembraneEventModulo(1); + se->registerSubsystem(centralMembrane); + } + + // direct laser G4Hit generation + if( G4TPC::ENABLE_DIRECT_LASER_HITS ) + { + auto directLaser = new PHG4TpcDirectLaser; + + // setup phi and theta steps + /* use 5deg steps */ + static constexpr double deg_to_rad = M_PI/180.; + directLaser->SetPhiStepping( 144, 0*deg_to_rad, 360*deg_to_rad ); + directLaser->SetThetaStepping( 36, 0*deg_to_rad, 90*deg_to_rad ); + //directLaser->SetArbitraryThetaPhi(50*deg_to_rad, 145*deg_to_rad); + directLaser->SetDirectLaserAuto( true ); + //__Variable stepping: hitting all of the central membrane____________ + //directLaser->SetDirectLaserPatternfromFile( true ); + //directLaser->SetFileStepping(13802); + //___________________________________________________________________ + + directLaser->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_sim); + se->registerSubsystem(directLaser); + } + + //========================= + // setup Tpc readout for filling cells + // g4tpc/PHG4TpcElectronDrift uses + // g4tpc/PHG4TpcPadPlaneReadout + //========================= + + auto padplane = new PHG4TpcPadPlaneReadout; + padplane->Verbosity(verbosity); + double extended_readout_time = 0.0; + if(TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + padplane->SetReadoutTime(extended_readout_time); + + auto edrift = new PHG4TpcElectronDrift; + edrift->Detector("TPC"); + edrift->Verbosity(verbosity); + if( G4TPC::ENABLE_STATIC_DISTORTIONS || G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ) + { + auto distortionMap = new PHG4TpcDistortion; + + distortionMap->set_read_phi_as_radians( G4TPC::DISTORTIONS_USE_PHI_AS_RADIANS ); + + distortionMap->set_do_static_distortions( G4TPC::ENABLE_STATIC_DISTORTIONS ); + distortionMap->set_static_distortion_filename( G4TPC::static_distortion_filename ); + + distortionMap->set_do_time_ordered_distortions( G4TPC::ENABLE_TIME_ORDERED_DISTORTIONS ); + distortionMap->set_time_ordered_distortion_filename( G4TPC::time_ordered_distortion_filename ); + + distortionMap->Init(); + edrift->setTpcDistortion( distortionMap ); + } + + double tpc_readout_time = 105.5/ G4TPC::tpc_drift_velocity_sim; // ns + edrift->set_double_param("max_time", tpc_readout_time); + edrift->set_double_param("extended_readout_time", extended_readout_time); + std::cout << "PHG4TpcElectronDrift readout window is from 0 to " << tpc_readout_time + extended_readout_time << std::endl; + + // override the default drift velocity parameter specification + edrift->set_double_param("drift_velocity", G4TPC::tpc_drift_velocity_sim); + padplane->SetDriftVelocity(G4TPC::tpc_drift_velocity_sim); + + // fudge factors to get drphi 150 microns (in mid and outer Tpc) and dz 500 microns cluster resolution + // They represent effects not due to ideal gas properties and ideal readout plane behavior + // defaults are 0.085 and 0.105, they can be changed here to get a different resolution + + edrift->registerPadPlane(padplane); + se->registerSubsystem(edrift); + + // Tpc digitizer + //========= + PHG4TpcDigitizer* digitpc = new PHG4TpcDigitizer(); + digitpc->SetTpcMinLayer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + double ENC = 670.0; // standard + digitpc->SetENC(ENC); + double ADC_threshold = 4.0 * ENC; + digitpc->SetADCThreshold(ADC_threshold); // 4 * ENC seems OK + digitpc->Verbosity(verbosity); + cout << " Tpc digitizer: Setting ENC to " << ENC << " ADC threshold to " << ADC_threshold + << " maps+Intt layers set to " << G4MVTX::n_maps_layer + G4INTT::n_intt_layer << endl; + digitpc ->set_skip_noise_flag(false); + se->registerSubsystem(digitpc); + +} + +void MicromegasInit() +{ + if (!Enable::MVTX) + { + G4MVTX::n_maps_layer = 0; + } + // same for the INTT + if (!Enable::INTT) + { + G4INTT::n_intt_layer = 0; + } + if (!Enable::TPC) + { + G4TPC::n_gas_layer = 0; + } + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, 88.); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, 220. / 2.); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -220. / 2.); +} + +void Micromegas(PHG4Reco* g4Reco) +{ + bool overlapcheck = Enable::OVERLAPCHECK || Enable::MICROMEGAS_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::MICROMEGAS_VERBOSITY); + bool SupportActive = Enable::SUPPORT || Enable::MICROMEGAS_SUPPORT; + const int mm_layer = G4MVTX::n_maps_layer + G4INTT::n_intt_layer + G4TPC::n_gas_layer; + auto mm = new PHG4MicromegasSubsystem("MICROMEGAS", mm_layer); + mm->Verbosity(verbosity); + if (SupportActive) + { + mm->SetSupportActive(); + } + mm->OverlapCheck(overlapcheck ); + mm->SetActive(); + g4Reco->registerSubsystem(mm); +} + +void Micromegas_Cells() +{ +// the acts geometry needs to go here since it will be used by the PHG4MicromegasHitReco + ACTSGEOM::ActsGeomInit(); + auto se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::MICROMEGAS_VERBOSITY); + // micromegas + auto reco = new PHG4MicromegasHitReco; + reco->Verbosity(verbosity); + double extended_readout_time = 0.0; + if (TRACKING::pp_mode) extended_readout_time = TRACKING::pp_extended_readout_time; + + reco->set_double_param("micromegas_tmax", 800.0+extended_readout_time); + se->registerSubsystem(reco); + + se->registerSubsystem(new PHG4MicromegasDigitizer); +} + +#endif diff --git a/common/G4_TrkrVariables.C b/common/G4_TrkrVariables.C new file mode 100644 index 000000000..144792548 --- /dev/null +++ b/common/G4_TrkrVariables.C @@ -0,0 +1,176 @@ +#ifndef MACRO_G4TRKRVARIABLES_C +#define MACRO_G4TRKRVARIABLES_C + +#include + +#include +#include + +namespace Enable +{ + bool MVTX = false; + bool MVTX_OVERLAPCHECK = false; + + bool MVTX_CELL = false; + bool MVTX_CLUSTER = false; + bool MVTX_QA = false; + bool MVTX_SUPPORT = false; + + int MVTX_VERBOSITY = 0; + + bool INTT = false; + bool INTT_ABSORBER = false; + bool INTT_OVERLAPCHECK = false; + bool INTT_CELL = false; + bool INTT_CLUSTER = false; + bool INTT_QA = false; + bool INTT_SUPPORT = false; + int INTT_VERBOSITY = 0; + + bool TPC = false; + bool TPC_ABSORBER = false; + bool TPC_OVERLAPCHECK = false; + bool TPC_CELL = false; + bool TPC_CLUSTER = false; + bool TPC_QA = false; + + bool TPC_ENDCAP = true; + + int TPC_VERBOSITY = 0; + + bool MICROMEGAS_OVERLAPCHECK = false; + bool MICROMEGAS_CELL = false; + bool MICROMEGAS_CLUSTER = false; + bool MICROMEGAS_QA = false; + bool MICROMEGAS_SUPPORT = false; + int MICROMEGAS_VERBOSITY = 0; + + bool TRACKING_TRACK = false; + bool TRACKING_EVAL = false; + bool TRACK_MATCHING = false; + bool TRACK_MATCHING_TREE = false; + bool TRACK_MATCHING_TREE_CLUSTERS = false; + // 0=no output TTree file, 1=output for tracks only, 2=tracks+clusters + int TRACKING_VERBOSITY = 0; + bool TRACKING_QA = false; + bool TRACKING_DIAGNOSTICS = false; +} // namespace Enable + + +namespace G4MVTX +{ + int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers + double radius_offset = 0.7; // clearance around radius +} // namespace G4MVTX + +namespace G4MVTXAlignment +{ + std::string alignment_path = string(getenv("CALIBRATIONROOT")) + "/Tracking/MVTX/alignment"; + double z_offset[] = {0.0, 0.0, 200.0}; +} + +namespace G4INTT +{ + int n_intt_layer = 4; // must be 4 or 0, setting to zero removes INTT completely + double intt_radius_max = 140.; // including stagger radius (mm) + int laddertype[4] = {PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI, + PHG4InttDefs::SEGMENTATION_PHI}; + int nladder[4] = {12, 12, 16, 16}; + double sensor_radius[4] = {7.188 - 36e-4, 7.732 - 36e-4, 9.680 - 36e-4, 10.262 - 36e-4}; + + enum enu_InttDeadMapType // Dead map options for INTT + { + kInttNoDeadMap = 0, // All channel in Intt is alive + kInttDeadMap = 1, // with dead channel + }; + //enu_InttDeadMapType InttDeadMapOption = kInttNoDeadMap; // Choose Intt deadmap here + enu_InttDeadMapType InttDeadMapOption = kInttDeadMap; // Choose Intt deadmap here + +} // namespace G4INTT + + +namespace G4TPC +{ + int n_tpc_layer_inner = 16; + int tpc_layer_rphi_count_inner = 1152; + int n_tpc_layer_mid = 16; + int n_tpc_layer_outer = 16; + int n_gas_layer = n_tpc_layer_inner + n_tpc_layer_mid + n_tpc_layer_outer; + double tpc_outer_radius = 77. + 2.; + + // drift velocity is set here for all relevant modules + double tpc_drift_velocity_sim= 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas, it is very close to our Ar-CF4 mixture +// double tpc_drift_velocity_reco now set in GlobalVariables.C +// double tpc_drift_velocity_reco= 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas + + // use simple clusterizer + bool USE_SIMPLE_CLUSTERIZER = false; + + // distortions + bool DISTORTIONS_USE_PHI_AS_RADIANS = true; + + bool ENABLE_STATIC_DISTORTIONS = false; + auto static_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/distortion_maps/static_only.distortion_map.hist.root"; + + bool ENABLE_TIME_ORDERED_DISTORTIONS = false; + std::string time_ordered_distortion_filename = std::string(getenv("CALIBRATIONROOT")) + "/distortion_maps/TimeOrderedDistortions.root"; + + // distortion corrections + bool ENABLE_CORRECTIONS = false; + auto correction_filename = std::string(getenv("CALIBRATIONROOT")) + "/distortion_maps/static_only_inverted_10-new.root"; + + // enable central membrane g4hits generation + bool ENABLE_CENTRAL_MEMBRANE_HITS = false; + + // enable direct laser g4hits generation + bool ENABLE_DIRECT_LASER_HITS = false; + + // save histograms + bool DIRECT_LASER_SAVEHISTOGRAMS = false; + + // do cluster <-> hit association + bool DO_HIT_ASSOCIATION = true; + + // space charge calibration output file + std::string DIRECT_LASER_ROOTOUTPUT_FILENAME = "TpcSpaceChargeMatrices.root"; + std::string DIRECT_LASER_HISTOGRAMOUTPUT_FILENAME = "TpcDirectLaserReconstruction.root"; + +} // namespace G4TPC + + +namespace G4TRACKING +{ + // Space Charge calibration flag + bool SC_CALIBMODE = false; // this is anded with G4TPC::ENABLE_DISTORTIONS in TrackingInit() + bool SC_USE_MICROMEGAS = true; + double SC_COLLISIONRATE = 50e3; // leave at 50 KHz for now, scaling of distortion map not implemented yet + std::string SC_ROOTOUTPUT_FILENAME = "TpcSpaceChargeMatrices.root"; // space charge calibration output file + + // Vertexing + bool g4eval_use_initial_vertex = true; // if true, g4eval uses initial vertices in SvtxVertexMap, not final vertices in SvtxVertexMapRefit + + // Truth seeding options for diagnostics (can use any or all) + bool use_truth_silicon_seeding = false; // if true runs truth silicon seeding instead of acts silicon seeding + bool use_truth_tpc_seeding = false; // if true runs truth silicon seeding instead of reco TPC seeding + bool use_truth_si_matching = false; // if true, associates silicon clusters using best truth track match to TPC seed tracks - for diagnostics only + // Full truth track seeding + bool use_full_truth_track_seeding = false; // makes track seeds using truth info, used for both Acts and Genfit + bool use_truth_vertexing = false; // if true runs truth vertexing, if false runs PHSimpleVertexFinder + + // Runs a converter from TrackSeed object to SvtxTrack object to enable + // use of the various evaluation tools already available + bool convert_seeds_to_svtxtracks = false; + + // Runs a second pass of seeding to pick up missed seeds in the first pass + bool iterative_seeding = false; + + // Flag to run commissioning seeding workflow with tuned parameters for + // misaligned + distorted tracks + bool use_alignment = false; + bool filter_conversion_electrons = false; + +} // namespace G4TRACKING + +#endif diff --git a/common/G4_User.C b/common/G4_User.C new file mode 100644 index 000000000..2bf718d04 --- /dev/null +++ b/common/G4_User.C @@ -0,0 +1,53 @@ +#ifndef MACRO_G4USER_C +#define MACRO_G4USER_C + +#include + +R__LOAD_LIBRARY(libfun4all.so) + +class PHG4Reco; + +namespace Enable +{ +// if you want this to run by default, initialize this to true +// Otherwise you have to use Enable::USER = true; in your macro + bool USER = false; + int USER_VERBOSITY = 0; +} + +namespace G4USER +{ +// here you can set parameters in your macro via +// G4USER::myparam = 1; +// add as many as you need + int myparam = 0; +} + +// This initializes the G4 part if you have a detector implemented +// You need to tell its dimensions to the surrounding black hole +void UserInit() +{ + // set the black hole dimensions surrounding the detector + // XXX: maximum radius of your detector + // YYY: maximum extension in z + // ZZZ: maximum extension in -z (use -ZZZ) + //BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, XXX); + //BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, YYY); + //BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, ZZZ); +} + +// If you have a detector - here goes the setup +void UserDetector(PHG4Reco *g4Reco) +{ + return; +} + +// Any analysis goes here (registering your module with Fun4All) +void UserAnalysisInit() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + + return; +} + +#endif diff --git a/common/G4_World.C b/common/G4_World.C new file mode 100644 index 000000000..eacb53a83 --- /dev/null +++ b/common/G4_World.C @@ -0,0 +1,34 @@ +#ifndef MACRO_G4WORLD_C +#define MACRO_G4WORLD_C + +#include + +#include + +R__LOAD_LIBRARY(libg4testbench.so) + +namespace G4WORLD +{ + double AddSpace = 100.; // add this much space in cm around edge of detector + string WorldMaterial = "G4_AIR"; // default world material, use G4_Galactic for material scan + string PhysicsList = "FTFP_BERT"; // for calorimeters use HP lists +} // namespace G4WORLD + +void WorldInit(PHG4Reco *g4Reco) +{ + g4Reco->SetWorldMaterial(G4WORLD::WorldMaterial); + g4Reco->SetPhysicsList(G4WORLD::PhysicsList); +} + +void WorldSize(PHG4Reco *g4Reco, double radius) +{ + double world_radius = std::max((BlackHoleGeometry::max_radius + BlackHoleGeometry::gap), radius); + g4Reco->SetWorldSizeY(std::max(g4Reco->GetWorldSizeY(), world_radius + G4WORLD::AddSpace)); + // our world is a symmetric cylinder so the center is at 0/0/0, pick the largest of abs(min_z) || abs(max_z) + double min_zval = std::min((BlackHoleGeometry::min_z - BlackHoleGeometry::gap), -((g4Reco->GetWorldSizeZ() - 100) / 2.)); + double max_zval = std::max((BlackHoleGeometry::max_z + BlackHoleGeometry::gap), (g4Reco->GetWorldSizeZ() - 100) / 2.); + double final_zval = std::max(fabs(min_zval), fabs(max_zval) + G4WORLD::AddSpace); + g4Reco->SetWorldSizeZ(std::max(g4Reco->GetWorldSizeZ(), 2 * (final_zval))); + return; +} +#endif diff --git a/common/G4_ZDC.C b/common/G4_ZDC.C new file mode 100644 index 000000000..e39a27be8 --- /dev/null +++ b/common/G4_ZDC.C @@ -0,0 +1,148 @@ +#ifndef MACRO_G4ZDC_C +#define MACRO_G4ZDC_C + +#include + +#include + +#include +#include + +#include +#include +#include + +#include + +#include + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libcalo_reco.so) +R__LOAD_LIBRARY(libg4calo.so) +R__LOAD_LIBRARY(libg4detectors.so) +R__LOAD_LIBRARY(libg4eval.so) + +namespace Enable +{ + bool ZDC = false; + bool ZDC_ABSORBER = false; + bool ZDC_SUPPORT = false; + bool ZDC_TOWER = false; + bool ZDC_EVAL = false; + bool ZDC_OVERLAPCHECK = false; + int ZDC_VERBOSITY = 0; +} // namespace Enable + +namespace G4ZDC +{ + double Gz0 = 1900.; + double outer_radius = 180.; + string calibfile = "ZDC/mapping/towerMap_ZDC.txt"; + double ZDCPlaceZ = 1843.0; + +} // namespace G4ZDC + +void ZDCInit() +{ + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4ZDC::outer_radius); + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4ZDC::Gz0); + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -G4ZDC::Gz0); +} + +void ZDCSetup(PHG4Reco *g4Reco, const int absorberactive = 0) +{ + bool AbsorberActive = Enable::ABSORBER || Enable::ZDC_ABSORBER || (absorberactive > 0); + bool OverlapCheck = Enable::OVERLAPCHECK || Enable::ZDC_OVERLAPCHECK; + + bool SupportActive = Enable::SUPPORT || Enable::ZDC_SUPPORT; + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4ZDCSubsystem *zdc = new PHG4ZDCSubsystem("ZDC",PHG4ZDCDefs::NORTH); +// place zdc in beam enclosure + zdc->set_double_param("place_z", G4ZDC::ZDCPlaceZ - G4BEAMLINE::enclosure_center); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + if (SupportActive) zdc->SetSupportActive(SupportActive); + zdc->SetMotherSubsystem(G4BEAMLINE::ForwardBeamLineEnclosure); + g4Reco->registerSubsystem(zdc); + + zdc = new PHG4ZDCSubsystem("ZDC", PHG4ZDCDefs::SOUTH); +// place zdc in beam enclosure + zdc->set_double_param("place_z", G4ZDC::ZDCPlaceZ - G4BEAMLINE::enclosure_center); + zdc->OverlapCheck(OverlapCheck); + zdc->SetActive(); + zdc->SuperDetector("ZDC"); + if (AbsorberActive) zdc->SetAbsorberActive(AbsorberActive); + if (SupportActive) zdc->SetSupportActive(SupportActive); + zdc->SetMotherSubsystem(G4BEAMLINE::BackwardBeamLineEnclosure); + g4Reco->registerSubsystem(zdc); +} + +void ZDC_Towers() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::ZDC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + string mapping_zdc = string(getenv("CALIBRATIONROOT")) + "/" + G4ZDC::calibfile; + + RawTowerBuilderByHitIndex *tower_ZDC = new RawTowerBuilderByHitIndex("TowerBuilder_ZDC"); + tower_ZDC->Detector("ZDC"); + tower_ZDC->set_sim_tower_node_prefix("SIM"); + tower_ZDC->GeometryTableFile(mapping_zdc); + se->registerSubsystem(tower_ZDC); + + RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("ZDCRawTowerDigitizer"); + TowerDigitizer->Detector("ZDC"); + TowerDigitizer->TowerType(0); + TowerDigitizer->Verbosity(verbosity); + TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer); + //SMD + RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("ZDCRawTowerDigitizer1"); + TowerDigitizer1->Detector("ZDC"); + TowerDigitizer1->TowerType(1); + TowerDigitizer1->Verbosity(verbosity); + TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); + se->registerSubsystem(TowerDigitizer1); + + RawTowerCalibration *TowerCalibration = new RawTowerCalibration("ZDCRawTowerCalibration"); + TowerCalibration->Detector("ZDC"); + TowerCalibration->TowerType(0); + TowerCalibration->Verbosity(verbosity); + TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration->set_calib_const_GeV_ADC(1.0); // sampling fraction = 0.010 + TowerCalibration->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration); + + RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("ZDCRawTowerCalibration1"); + TowerCalibration1->Detector("ZDC"); + TowerCalibration1->TowerType(1); + TowerCalibration1->Verbosity(verbosity); + TowerCalibration1->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); + TowerCalibration1->set_calib_const_GeV_ADC(1.0); + TowerCalibration1->set_pedstal_ADC(0); + se->registerSubsystem(TowerCalibration1); +} + +void ZDC_Eval(std::string outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::ZDC_VERBOSITY); + Fun4AllServer *se = Fun4AllServer::instance(); + + CaloEvaluator *eval = new CaloEvaluator("ZDCEVALUATOR", "ZDC", outputfile); + eval->set_do_cluster_eval(false); + eval->Verbosity(verbosity); + se->registerSubsystem(eval); + + return; +} +#endif diff --git a/common/G4_hFarFwdBeamLine_sPHENIX.C b/common/G4_hFarFwdBeamLine_sPHENIX.C new file mode 100644 index 000000000..b0aec080d --- /dev/null +++ b/common/G4_hFarFwdBeamLine_sPHENIX.C @@ -0,0 +1,285 @@ +#ifndef MACRO_G4HFARFWDBEAMLINE_SPHENIX_C +#define MACRO_G4HFARFWDBEAMLINE_SPHENIX_C + +#include + +#include +#include +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4detectors.so) + +float PosFlip(float pos); +float AngleFlip(float angle); +float MagFieldFlip(float Bfield); + +// This creates the Enable Flag to be used in the main steering macro +namespace Enable +{ + bool HFARFWD_MAGNETS = false; + + bool HFARFWD_OVERLAPCHECK = false; + int HFARFWD_VERBOSITY = 0; + +} // namespace Enable + +namespace hFarFwdBeamLine +{ + double starting_z = -3000.; //cm as center-forward interface + double enclosure_z_max = NAN; + double enclosure_r_max = NAN; + double enclosure_center = NAN; + + PHG4CylinderSubsystem *hFarFwdBeamLineEnclosure(nullptr); + + BeamLineMagnetSubsystem *B0Magnet = (nullptr); +} // namespace hFarFwdBeamLine + +void hFarFwdBeamLineInit() +{ + + hFarFwdBeamLine::enclosure_z_max = 3000.; + BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, hFarFwdBeamLine::starting_z); + hFarFwdBeamLine::enclosure_r_max = 200.; + + hFarFwdBeamLine::enclosure_center = 0.5 * (hFarFwdBeamLine::starting_z + hFarFwdBeamLine::enclosure_z_max); + + BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, hFarFwdBeamLine::enclosure_z_max); + BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, hFarFwdBeamLine::enclosure_r_max); +} + +void hFarFwdDefineMagnets(PHG4Reco *g4Reco) +{ + bool overlapCheck = Enable::OVERLAPCHECK || Enable::HFARFWD_OVERLAPCHECK; + int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + + hFarFwdBeamLine::hFarFwdBeamLineEnclosure = new PHG4CylinderSubsystem("hFarFwdBeamLineEnclosure"); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("place_z", hFarFwdBeamLine::enclosure_center); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("radius", 0); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("thickness", hFarFwdBeamLine::enclosure_r_max); // This is intentionally made large 25cm radius + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_double_param("length", hFarFwdBeamLine::enclosure_z_max - hFarFwdBeamLine::starting_z); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_string_param("material", "G4_Galactic"); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->set_color(.5, .5, .5, 0.2); + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->OverlapCheck(overlapCheck); + if (verbosity) + hFarFwdBeamLine::hFarFwdBeamLineEnclosure->Verbosity(verbosity); + g4Reco->registerSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + + string magFile; + // magFile = string(getenv("CALIBRATIONROOT")) + "/Beam/D0DXMagnets.dat"; + magFile = "/sphenix/u/shuhang98/macros/detectors/sPHENIX/D0DXMagnets.dat"; + // make magnet active volume if you want to study the hits + bool magnet_active = false; + int absorberactive = 0; + + // if you insert numbers it only displays those magnets, do not comment out the set declaration + set magnetlist; + //magnetlist.insert(7); + + BeamLineMagnetSubsystem *bl = nullptr; + std::ifstream infile(magFile); + if (infile.is_open()) + { + double biggest_z = 0.; + int imagnet = 0; + std::string line; + while (std::getline(infile, line)) + { + if (!line.compare(0, 1, "B") || + !line.compare(0, 1, "Q") || + !line.compare(0, 1, "S")) + { + std::istringstream iss(line); + string magname; + double x; + double y; + double z; + double inner_radius_zin; + double inner_radius_zout; + double outer_magnet_diameter; + double length; + double angle; + double dipole_field_x; + double fieldgradient; + if (!(iss >> magname >> x >> y >> z >> inner_radius_zin >> inner_radius_zout >> outer_magnet_diameter >> length >> angle >> dipole_field_x >> fieldgradient)) + { + cout << "coud not decode " << line << endl; + gSystem->Exit(1); + } + else + { + //------------------------ + + string magtype; + if (inner_radius_zin != inner_radius_zout) + { + cout << "inner radius at front of magnet " << inner_radius_zin + << " not equal radius at back of magnet " << inner_radius_zout + << " needs change in code (replace tube by cone for beamline)" << endl; + gSystem->Exit(1); + } + if (verbosity > 0) + { + cout << endl + << endl + << "\tID number " << imagnet << endl; + cout << "magname: " << magname << endl; + cout << "x: " << x << endl; + cout << "y: " << y << endl; + cout << "z: " << z << endl; + cout << "inner_radius_zin: " << inner_radius_zin << endl; + cout << "inner_radius_zout: " << inner_radius_zout << endl; + cout << "outer_magnet_diameter: " << outer_magnet_diameter << endl; + cout << "length: " << length << endl; + cout << "angle: " << angle << endl; + cout << "dipole_field_x: " << dipole_field_x << endl; + cout << "fieldgradient: " << fieldgradient << endl; + } + if (!magname.compare(0, 1, "B")) + { + magtype = "DIPOLE"; + } + else if (!magname.compare(0, 1, "Q")) + { + magtype = "QUADRUPOLE"; + } + else if (!magname.compare(0, 1, "S")) + { + magtype = "SEXTUPOLE"; + } + else + { + cout << "cannot decode magnet name " << magname << endl; + gSystem->Exit(1); + } + // convert to our units (cm, deg) + x *= 100.; + y *= 100.; + z *= 100.; + length *= 100.; + inner_radius_zin *= 100.; + outer_magnet_diameter *= 100.; + angle = (angle / TMath::Pi() * 180.) / 1000.; // given in mrad + + //------------------------ + + if (magnetlist.empty() || magnetlist.find(imagnet) != magnetlist.end()) + { + bl = new BeamLineMagnetSubsystem("BEAMLINEMAGNET", imagnet); + bl->set_double_param("field_y", MagFieldFlip(dipole_field_x)); + bl->set_double_param("fieldgradient", MagFieldFlip(fieldgradient)); + bl->set_string_param("magtype", magtype); + bl->set_double_param("length", length); + bl->set_double_param("place_x", PosFlip(x));// relative position to mother vol. + bl->set_double_param("place_y", y);// relative position to mother vol. + bl->set_double_param("place_z", z - hFarFwdBeamLine::enclosure_center);// relative position to mother vol. + bl->set_double_param("field_global_position_x", PosFlip(x));// abs. position to world for field manager + bl->set_double_param("field_global_position_y", y);// abs. position to world for field manager + bl->set_double_param("field_global_position_z", z);// abs. position to world for field manager + bl->set_double_param("rot_y", AngleFlip(angle)); + bl->set_double_param("field_global_rot_y", AngleFlip(angle));// abs. rotation to world for field manager + bl->set_double_param("inner_radius", inner_radius_zin); + bl->set_double_param("outer_radius", outer_magnet_diameter / 2.); + bl->SetActive(magnet_active); + bl->BlackHole(); + bl->SetMotherSubsystem(hFarFwdBeamLine::hFarFwdBeamLineEnclosure); + if (absorberactive) + { + bl->SetAbsorberActive(); + } + bl->OverlapCheck(overlapCheck); + bl->SuperDetector("BEAMLINEMAGNET"); + if (verbosity) + bl->Verbosity(verbosity); + g4Reco->registerSubsystem(bl); + + // rag the B0 magnet + if (imagnet == 0) + hFarFwdBeamLine::B0Magnet = bl; + } + imagnet++; + if (fabs(z) + length > biggest_z) + { + biggest_z = fabs(z) + length; + } + } + } + } + infile.close(); + } +} + +void hFarFwdDefineBeamPipe(PHG4Reco *g4Reco) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HFARFWD_VERBOSITY); + + + const int ntube = 10; + const string nm[ntube] = {"B00", "B01", "B10", "B11", "B20", "B21", "B30", "B31", "B32", "B33"}; + const double qlen[ntube] = {207.88, 207.88, 115.79, 115.79, 217.16,217.16, 183, 183, 183, 183}; + const double qir[ntube] = {6.08, 6.08, 14.60, 14.60, 20.0, 20.0, 6.07, 6.07, 6.07, 6.07}; + const double qor[ntube] = {6.35, 6.35, 15.24, 15.24, 20.96, 20.96, 6.35, 6.35, 6.35, 6.35}; + const double qrot[ntube] = {0, 0, 0, 0, 0, 0, 1.074, -1.074, -1.074, 1.074}; //degree + const double qxC[ntube] = {0, 0, 0, 0, 0, 0, 12.82, -12.82, 12.82, -12.82}; + const double qyC[ntube] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + const double qzC[ntube] = {850.14, -850.14, 1475.935, -1475.935, 1642.4, -1642.4, 1843.2, 1843.2, -1843.2, -1843.2}; + for (int i = 0; i < ntube; i++) + { + PHG4CylinderSubsystem *pipe = new PHG4CylinderSubsystem(Form("beamPipe%s", nm[i].c_str()), 0); + pipe->set_double_param("radius", qir[i]); + pipe->set_double_param("thickness", qor[i] - qir[i]); + pipe->set_double_param("length", qlen[i]); + pipe->set_double_param("rot_y", qrot[i]); + pipe->set_string_param("material", "G4_STAINLESS-STEEL"); + pipe->set_double_param("place_x", PosFlip(qxC[i])); + pipe->set_double_param("place_y", qyC[i]); + pipe->set_double_param("place_z", qzC[i]); + pipe->SetActive(false); + // pipe->SetActive(true); + g4Reco->registerSubsystem(pipe); + } + + //Roman Pot pipe + const int nSec = 2; + const double len[nSec] = {20.87, 20.87}; + const double ir1[nSec] = {7.14, 14.60}; + const double or1[nSec] = {7.77, 15.24}; + const double ir2[nSec] = {14.60, 7.14}; + const double or2[nSec] = {15.24, 7.77}; + const double xC[nSec] = {0, 0}; + const double yC[nSec] = {0, 0}; + const double zC[nSec] = {1384.25, -1384.25}; + for (int i = 0; i < nSec; i++) + { + PHG4ConeSubsystem *pipe = new PHG4ConeSubsystem(Form("beamPipeRP%d", i), 0); + pipe->set_string_param("material", "G4_STAINLESS-STEEL"); + pipe->set_double_param("place_x", PosFlip(xC[i])); + pipe->set_double_param("place_y", yC[i]); + pipe->set_double_param("place_z", zC[i]); + pipe->set_double_param("length", len[i]); + pipe->set_double_param("rmin1", ir1[i]); + pipe->set_double_param("rmin2", ir2[i]); + pipe->set_double_param("rmax1", or1[i]); + pipe->set_double_param("rmax2", or2[i]); + pipe->set_double_param("rot_y", AngleFlip(-0.047 * TMath::RadToDeg())); + g4Reco->registerSubsystem(pipe); + } +} + + +float PosFlip(float pos){ + return pos; +}; +float AngleFlip(float angle){ + return angle; +}; +float MagFieldFlip(float Bfield){ + return Bfield; +}; + +#endif diff --git a/common/GlobalVariables.C b/common/GlobalVariables.C new file mode 100644 index 000000000..c957e4162 --- /dev/null +++ b/common/GlobalVariables.C @@ -0,0 +1,118 @@ +#ifndef MACRO_GLOBALVARIABLES_C +#define MACRO_GLOBALVARIABLES_C + +#include +#include +#include + +double no_overlapp = 0.0001; + +// These Input settings are needed in multiple Input selections +// Putting those here avoids include file ordering problems +namespace Input +{ + bool HEPMC = false; + bool EMBED = false; + bool READEIC = false; + + bool UPSILON = false; + std::set UPSILON_EmbedIds; + + //! nominal beam parameter configuration choices for BEAM_CONFIGURATION + enum BeamConfiguration + { + AA_COLLISION = 0, + pA_COLLISION, + pp_COLLISION + }; + + BeamConfiguration BEAM_CONFIGURATION = AA_COLLISION; +} // namespace Input + +namespace DstOut +{ + std::string OutputDir = "."; + std::string OutputFile = "test.root"; +} // namespace DstOut + +// Global settings affecting multiple subsystems +namespace Enable +{ + bool ABSORBER = false; + bool CDB = false; + bool DSTOUT = false; + bool DSTOUT_COMPRESS = false; + bool OVERLAPCHECK = false; + bool SUPPORT = false; + int VERBOSITY = 0; +} // namespace Enable + +// every G4 subsystem needs to implement this +// rather than forcing another include file, +// let's put this into the GlobalVariables.C +namespace BlackHoleGeometry +{ + double max_radius = 0.; // this is needed for the overall dimension of the black hole + double min_z = 0.; + double max_z = 0.; + double gap = no_overlapp; + bool visible = false; +}; // namespace BlackHoleGeometry + +namespace G4P6DECAYER +{ + EDecayType decayType = EDecayType::kAll; +} + +// our various tracking macro +namespace TRACKING +{ + std::string TrackNodeName = "SvtxTrackMap"; + bool pp_mode = false; + double pp_extended_readout_time = 7000.0; // ns +} + +namespace G4MAGNET +{ + // initialize to garbage values - the override is done in the respective + // MagnetInit() functions. If used standalone (without the G4_Magnet include) + // like in the tracking - those need to be set in the Fun4All macro + double magfield_rescale = NAN; + std::string magfield; + std::string magfield_OHCAL_steel; +} // namespace G4MAGNET + +namespace Enable +{ + bool MICROMEGAS = false; +} + +namespace G4MICROMEGAS +{ + // number of micromegas layers + int n_micromegas_layer = 2; +} // namespace G4MICROMEGAS + +namespace G4TPC +{ + double tpc_drift_velocity_reco= 8.0 / 1000.0; // cm/ns // this is the Ne version of the gas, it is very close to our Ar-CF4 mixture +} + +namespace G4TRACKING +{ + bool init_acts_magfield = true; +} + +namespace EVTGENDECAYER +{ + std::string DecayFile = ""; //The default is no need to force decay anything and use the default file DECAY.DEC from the official EvtGen software + //DECAY.DEC is located at: https://gitlab.cern.ch/evtgen/evtgen/-/blob/master/DECAY.DEC +} + +namespace CDB +{ + std::string global_tag = "MDC2"; + uint64_t timestamp = 6; +} + +#endif diff --git a/common/HIJetReco.C b/common/HIJetReco.C new file mode 100644 index 000000000..353402c5f --- /dev/null +++ b/common/HIJetReco.C @@ -0,0 +1,131 @@ +#ifndef MACRO_HIJETRECO_C +#define MACRO_HIJETRECO_C + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +R__LOAD_LIBRARY(libjetbase.so) +R__LOAD_LIBRARY(libg4jets.so) +R__LOAD_LIBRARY(libjetbackground.so) + +namespace Enable +{ + bool HIJETS = false; + int HIJETS_VERBOSITY = 0; + bool HIJETS_MC = true; + bool HIJETS_TRUTH = false; +} // namespace Enable + +namespace HIJETS +{ + bool do_flow = false; // should be set to true once the EPD event plane correction is implemented + bool do_CS = false; +} // namespace HIJETS + + +void HIJetReco() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::HIJETS_VERBOSITY); + + + //--------------- + // Fun4All server + //--------------- + Fun4AllServer *se = Fun4AllServer::instance(); + + if (Enable::HIJETS_MC && Enable::HIJETS_TRUTH) + { + JetReco *truthjetreco = new JetReco(); + TruthJetInput *tji = new TruthJetInput(Jet::PARTICLE); + tji->add_embedding_flag(0); // changes depending on signal vs. embedded + truthjetreco->add_input(tji); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_Truth_r02"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.3), "AntiKt_Truth_r03"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.4), "AntiKt_Truth_r04"); + truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.5), "AntiKt_Truth_r05"); + truthjetreco->set_algo_node("ANTIKT"); + truthjetreco->set_input_node("TRUTH"); + truthjetreco->Verbosity(verbosity); + se->registerSubsystem(truthjetreco); + } + + RetowerCEMC *rcemc = new RetowerCEMC(); + rcemc->Verbosity(verbosity); + rcemc->set_towerinfo(true); + se->registerSubsystem(rcemc); + + + JetReco *towerjetreco = new JetReco(); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWERINFO_RETOWER)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWERINFO)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWERINFO)); + towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT, 0.2), "AntiKt_TowerInfo_HIRecoSeedsRaw_r02"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + DetermineTowerBackground *dtb = new DetermineTowerBackground(); + dtb->SetBackgroundOutputName("TowerInfoBackground_Sub1"); + dtb->SetFlow(HIJETS::do_flow); + dtb->SetSeedType(0); + dtb->SetSeedJetD(3); + dtb->set_towerinfo(true); + dtb->Verbosity(verbosity); + se->registerSubsystem(dtb); + + + + CopyAndSubtractJets *casj = new CopyAndSubtractJets(); + casj->SetFlowModulation(HIJETS::do_flow); + casj->Verbosity(verbosity); + casj->set_towerinfo(true); + se->registerSubsystem(casj); + + + DetermineTowerBackground *dtb2 = new DetermineTowerBackground(); + dtb2->SetBackgroundOutputName("TowerInfoBackground_Sub2"); + dtb2->SetFlow(HIJETS::do_flow); + dtb2->SetSeedType(1); + dtb2->SetSeedJetPt(7); + dtb2->Verbosity(verbosity); + dtb2->set_towerinfo(true); + se->registerSubsystem(dtb2); + + + SubtractTowers *st = new SubtractTowers(); + st->SetFlowModulation(HIJETS::do_flow); + st->Verbosity(verbosity); + st->set_towerinfo(true); + se->registerSubsystem(st); + + towerjetreco = new JetReco(); + towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWERINFO_SUB1)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWERINFO_SUB1)); + towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWERINFO_SUB1)); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.2, 1), "AntiKt_Tower_r02_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.3, 1), "AntiKt_Tower_r03_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.4, 1), "AntiKt_Tower_r04_Sub1"); + towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT, 0.5, 1), "AntiKt_Tower_r05_Sub1"); + towerjetreco->set_algo_node("ANTIKT"); + towerjetreco->set_input_node("TOWER"); + towerjetreco->Verbosity(verbosity); + se->registerSubsystem(towerjetreco); + + return; + +} +#endif diff --git a/common/QA.C b/common/QA.C new file mode 100644 index 000000000..4d2615f20 --- /dev/null +++ b/common/QA.C @@ -0,0 +1,42 @@ +#ifndef MACRO_QA_C +#define MACRO_QA_C + +#include +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libqa_modules.so) + +namespace Enable +{ + // if you want this to run by default, initialize this to true + // Otherwise you have to use Enable::USER = true; in your macro + bool QA = false; + int QA_VERBOSITY = 0; +} // namespace Enable + +namespace QA +{ + // int myparam = 0; +} // namespace QA + +// QA moduel combining tracking and calorimeters +void QA_G4CaloTracking() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationCalorimeterSum* calo_qa = new QAG4SimulationCalorimeterSum(); + calo_qa->Verbosity(Enable::QA_VERBOSITY); + se->registerSubsystem(calo_qa); + return; +} + +// run this after se->run() to output QA histogram file for all QA modules +void QA_Output(const std::string& qaOutputFileName) +{ + Fun4AllServer* se = Fun4AllServer::instance(); + QAHistManagerDef::saveQARootFile(qaOutputFileName); + return; +} + +#endif diff --git a/common/Trkr_Clustering.C b/common/Trkr_Clustering.C new file mode 100644 index 000000000..35b0796a9 --- /dev/null +++ b/common/Trkr_Clustering.C @@ -0,0 +1,146 @@ +#ifndef MACRO_TRKRCLUS_C +#define MACRO_TRKRCLUS_C + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundefined-internal" +#include +#pragma GCC diagnostic pop + +#include + +#include + +#include + +R__LOAD_LIBRARY(libmvtx.so) +R__LOAD_LIBRARY(libintt.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libmicromegas.so) +R__LOAD_LIBRARY(libtrack_reco.so) + +void ClusteringInit() +{ + ACTSGEOM::ActsGeomInit(); +} + +void Mvtx_HitUnpacking() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + auto mvtxunpacker = new MvtxCombinedRawDataDecoder; + mvtxunpacker->Verbosity(verbosity); + se->registerSubsystem(mvtxunpacker); +} +void Mvtx_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MVTX_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + // prune the extra MVTX hits due to multiple strobes per hit + MvtxHitPruner* mvtxhitpruner = new MvtxHitPruner(); + mvtxhitpruner->Verbosity(verbosity); + se->registerSubsystem(mvtxhitpruner); + + // For the Mvtx layers + //================ + MvtxClusterizer* mvtxclusterizer = new MvtxClusterizer("MvtxClusterizer"); + mvtxclusterizer->Verbosity(verbosity); + se->registerSubsystem(mvtxclusterizer); +} +void Intt_HitUnpacking() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + auto inttunpacker = new InttCombinedRawDataDecoder; + inttunpacker->Verbosity(verbosity); + inttunpacker->LoadHotChannelMapRemote("INTT_HotMap"); + se->registerSubsystem(inttunpacker); +} +void Intt_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::INTT_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + InttClusterizer* inttclusterizer = new InttClusterizer("InttClusterizer", G4MVTX::n_maps_layer, G4MVTX::n_maps_layer + G4INTT::n_intt_layer - 1); + inttclusterizer->Verbosity(verbosity); + // no Z clustering for Intt type 1 layers (we DO want Z clustering for type 0 layers) + // turning off phi clustering for type 0 layers is not necessary, there is only one strip + // per sensor in phi + for (int i = G4MVTX::n_maps_layer; i < G4MVTX::n_maps_layer + G4INTT::n_intt_layer; i++) + { + if (G4INTT::laddertype[i - G4MVTX::n_maps_layer] == PHG4InttDefs::SEGMENTATION_PHI) + { + inttclusterizer->set_z_clustering(i, false); + } + } + se->registerSubsystem(inttclusterizer); +} + +void Tpc_HitUnpacking() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + auto tpcunpacker = new TpcCombinedRawDataUnpacker; + tpcunpacker->Verbosity(verbosity); + se->registerSubsystem(tpcunpacker); +} + +void TPC_Clustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + ACTSGEOM::ActsGeomInit(); + Fun4AllServer* se = Fun4AllServer::instance(); + + //------------- + // Cluster Hits + //------------- + + // For the Tpc + //========== + + auto tpcclusterizer = new TpcClusterizer; + tpcclusterizer->Verbosity(verbosity); + tpcclusterizer->set_do_hit_association(G4TPC::DO_HIT_ASSOCIATION); + se->registerSubsystem(tpcclusterizer); + + auto tpcclustercleaner = new TpcClusterCleaner; + tpcclustercleaner->Verbosity(verbosity); + se->registerSubsystem(tpcclustercleaner); +} + +void Micromegas_HitUnpacking() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::MICROMEGAS_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + auto tpotunpacker = new MicromegasCombinedDataDecoder; + std::string calibrationFile = CDBInterface::instance()->getUrl("TPOT_Pedestal"); + tpotunpacker->set_calibration_file(calibrationFile); + se->registerSubsystem(tpotunpacker); +} + +void Micromegas_Clustering() +{ + auto se = Fun4AllServer::instance(); + auto mm_clus = new MicromegasClusterizer; + se->registerSubsystem(mm_clus); +} + +#endif diff --git a/common/Trkr_CommissioningReco.C b/common/Trkr_CommissioningReco.C new file mode 100644 index 000000000..e69de29bb diff --git a/common/Trkr_Diagnostics.C b/common/Trkr_Diagnostics.C new file mode 100644 index 000000000..f3a97ba2b --- /dev/null +++ b/common/Trkr_Diagnostics.C @@ -0,0 +1,46 @@ +#ifndef MACRO_TRKRDIAGNOSTICS_C +#define MACRO_TRKRDIAGNOSTICS_C + +R__LOAD_LIBRARY(libTrackingDiagnostics.so) + +#include + +#include +#include + +#include + + + +void G4KshortReconstruction(const std::string outputfile) +{ + Fun4AllServer* se = Fun4AllServer::instance(); + KshortReconstruction *ksr = new KshortReconstruction(); + ksr->set_output_file(outputfile); + se->registerSubsystem(ksr); +} + +void seedResiduals(const std::string outputfile) +{ + Fun4AllServer* se = Fun4AllServer::instance(); + + if(!Enable::MICROMEGAS) + { + std::cout<< "Micromegas not enabled"<set_output_file(outputfile); + se->registerSubsystem(eval); + +} + +void Tracking_Diagnostics(const std::string outputfile) +{ + G4KshortReconstruction(outputfile); + seedResiduals(outputfile); +} +#endif diff --git a/common/Trkr_Eval.C b/common/Trkr_Eval.C new file mode 100644 index 000000000..d7f7bbe00 --- /dev/null +++ b/common/Trkr_Eval.C @@ -0,0 +1,103 @@ +#ifndef MACRO_TRKREVAL_C +#define MACRO_TRKREVAL_C + +#include +#include +#include +#include +#include +#include +#include + +R__LOAD_LIBRARY(libg4eval.so) + +void Tracking_Eval(const std::string& outputfile) +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + build_truthreco_tables(); + + //---------------- + // Tracking evaluation + //---------------- + SvtxEvaluator* eval; + eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile, "SvtxTrackMap", + G4MVTX::n_maps_layer, + G4INTT::n_intt_layer, + G4TPC::n_gas_layer, + G4MICROMEGAS::n_micromegas_layer); + eval->do_cluster_eval(true); + eval->do_g4hit_eval(false); + eval->do_hit_eval(false); // enable to see the hits that includes the chamber physics... + eval->do_gpoint_eval(true); + eval->do_vtx_eval_light(true); + eval->do_eval_light(true); + eval->do_track_eval(true); + eval->do_gtrack_eval(true); + eval->do_track_match(true); + eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex); + bool embed_scan = true; + if(TRACKING::pp_mode) embed_scan = false; + eval->scan_for_embedded(embed_scan); // take all tracks if false - take only embedded tracks if true + eval->scan_for_primaries(embed_scan); // defaults to only thrown particles for ntp_gtrack + std::cout << "SvtxEvaluator: pp_mode set to " << TRACKING::pp_mode << " and scan_for_embedded set to " << embed_scan << std::endl; + eval->Verbosity(verbosity); + + se->registerSubsystem(eval); + + return; +} + +void Track_Matching(const std::string& ttreefilename) { + TrkrClusterIsMatcher* ismatcher = new TrkrClusterIsMatcher(); + // These are the default values -- uncomment and change as desired + // ismatcher->single_pixel_phi_MVTX = false ; // default to pitch*max(N_pixels_M,N_pixels_T)*tol_MVTX + // ismatcher->single_pixel_phi_INTT = false ; // ... same as for MVTX + // ismatcher->single_bin_phi_TPC = true ; // default to pitch*tol_phi_TPC + // + // ismatcher->single_pixel_z_MVTX = false ; // default to pitch*max(N_pixels_M,N_pixels_T)*tol_z_MVTX + // ismatcher->single_pixel_z_INTT = false ; // ... same as for MVTX + // ismatcher->single_bin_t_TPC = true ; // default to pitch*tol_t_TPC + // + // ismatcher-> tol_phi_MVTX = 0.5; + // ismatcher-> tol_phi_INTT = 0.5; + // ismatcher-> tol_phi_TPC = 1.0; + + // ismatcher-> tol_z_MVTX = 0.5; + // ismatcher-> tol_t_TPC = 1.0; + auto trackmatcher = new TruthRecoTrackMatching(ismatcher); + trackmatcher->set_min_cl_match (5); // minimum number of matched clusters to make a matched track + trackmatcher->set_min_cl_ratio (0.1); // at least 10% of truth clusters must be matched + trackmatcher->set_cutoff_deta (0.3); // won't compare tracks with |Δeta|>0.3 away + trackmatcher->set_cutoff_dphi (0.3); // won't compare tracks with |Δphi|>0.3 away + trackmatcher->set_smallsearch_deta (0.05); // will first compare tracks within this |Δphi| + trackmatcher->set_smallsearch_dphi (0.05); // will first compare tracks within this |Δeta| + trackmatcher->set_max_nreco_per_truth (4); // maximum reco tracks matched for any truth track + trackmatcher->set_max_ntruth_per_reco (4); // maximum truth tracks matched for any reco track + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + Fun4AllServer *se = Fun4AllServer::instance(); + trackmatcher->Verbosity(verbosity); + se->registerSubsystem(trackmatcher); + + if (Enable::TRACK_MATCHING_TREE) { + auto treefiller = new FillClusMatchTree(ismatcher, ttreefilename);//, true, true, true, outputFile); + treefiller->Verbosity(verbosity); + if (Enable::TRACK_MATCHING_TREE_CLUSTERS) { + treefiller->m_fill_clusters = true; + treefiller->m_fill_SvUnmatched = true; + } else { + treefiller->m_fill_clusters = false; + treefiller->m_fill_SvUnmatched = false; + } + treefiller->m_fill_clusverbose = false; + se->registerSubsystem(treefiller); + } +} + +#endif diff --git a/common/Trkr_LaserClustering.C b/common/Trkr_LaserClustering.C new file mode 100644 index 000000000..562ed23f3 --- /dev/null +++ b/common/Trkr_LaserClustering.C @@ -0,0 +1,98 @@ +#ifndef MACRO_TRKRLASERCLUS_C +#define MACRO_TRKRLASERCLUS_C + +#include + +#include +//#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundefined-internal" +#include +#include +#pragma GCC diagnostic pop + +#include + +#include +#include +#include +#include + +#include + + +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libtpccalib.so) + + + + +void TPC_LaserClustering() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TPC_VERBOSITY); + ACTSGEOM::ActsGeomInit(); + Fun4AllServer* se = Fun4AllServer::instance(); + + //------------- + // Cluster Hits + //------------- + + // For the Tpc + //========== + if( G4TPC::USE_SIMPLE_CLUSTERIZER ) + { + + auto tpcclusterizer = new TpcSimpleClusterizer; + tpcclusterizer->Verbosity(verbosity); + se->registerSubsystem(tpcclusterizer); + + } else { + + auto tpcclusterizer = new TpcClusterizer; + tpcclusterizer->Verbosity(verbosity); + tpcclusterizer->set_do_hit_association( G4TPC::DO_HIT_ASSOCIATION ); + se->registerSubsystem(tpcclusterizer); + + } + + if( !G4TPC::ENABLE_DIRECT_LASER_HITS ) + { + auto tpcclustercleaner = new TpcClusterCleaner; + tpcclustercleaner->Verbosity(verbosity); + se->registerSubsystem(tpcclustercleaner); + } + + // direct laser reconstruction + if( G4TPC::ENABLE_DIRECT_LASER_HITS ) + { + auto directLaserReconstruction = new TpcDirectLaserReconstruction; + directLaserReconstruction->set_outputfile( G4TPC::DIRECT_LASER_ROOTOUTPUT_FILENAME ); + directLaserReconstruction->set_savehistograms( G4TPC::DIRECT_LASER_SAVEHISTOGRAMS ); + directLaserReconstruction->set_histogram_outputfile( G4TPC::DIRECT_LASER_HISTOGRAMOUTPUT_FILENAME ); + se->registerSubsystem(directLaserReconstruction); + } + + // central membrane reconstruction + if( G4TPC::ENABLE_CENTRAL_MEMBRANE_HITS ) + { + // central membrane clusterizer + auto centralMembraneClusterizer = new PHTpcCentralMembraneClusterizer; + centralMembraneClusterizer->Verbosity(verbosity); + centralMembraneClusterizer->set_histos_on( false ); + centralMembraneClusterizer->set_modulo_threshold(5); + centralMembraneClusterizer->set_metaCluster_threshold(18); + se->registerSubsystem(centralMembraneClusterizer); + + + // match central membrane clusters to pads and generate distortion correction + auto centralMembraneMatcher = new PHTpcCentralMembraneMatcher; + centralMembraneMatcher->setSavehistograms( false ); + centralMembraneMatcher->Verbosity( verbosity ); + centralMembraneMatcher->setNMatchIter(2); + se->registerSubsystem(centralMembraneMatcher); + } +} + + +#endif diff --git a/common/Trkr_QA.C b/common/Trkr_QA.C new file mode 100644 index 000000000..4c762c6ea --- /dev/null +++ b/common/Trkr_QA.C @@ -0,0 +1,116 @@ +#ifndef MACRO_TRKRQA_C +#define MACRO_TRKRQA_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +R__LOAD_LIBRARY(libqa_modules.so) + +void Mvtx_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::MVTX_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationMvtx* qa = new QAG4SimulationMvtx; + qa->Verbosity(verbosity); + se->registerSubsystem(qa); +} + +void Intt_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::INTT_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationIntt* qa = new QAG4SimulationIntt; + qa->Verbosity(verbosity); + se->registerSubsystem(qa); +} + +void TPC_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TPC_VERBOSITY); + + Fun4AllServer* se = Fun4AllServer::instance(); + QAG4SimulationTpc * qa = new QAG4SimulationTpc; + qa->Verbosity(verbosity); + se->registerSubsystem(qa); +} + +void Micromegas_QA() +{ + auto se = Fun4AllServer::instance(); + auto qa_mm = new QAG4SimulationMicromegas; + qa_mm->Verbosity(Enable::QA_VERBOSITY); + se->registerSubsystem(qa_mm); +} + + +void Tracking_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + build_truthreco_tables(); + + QAG4SimulationTracking* qa = new QAG4SimulationTracking(); + // qa->addEmbeddingID(2); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); + + QAG4SimulationVertex* qa2 = new QAG4SimulationVertex(); + // qa2->addEmbeddingID(2); + qa2->Verbosity(verbosity); + se->registerSubsystem(qa2); + + // Acts Kalman Filter vertex finder + //================================= + QAG4SimulationVertex* qav = new QAG4SimulationVertex(); + // qav->addEmbeddingID(2); + qav->Verbosity(verbosity); + qav->setVertexMapName("SvtxVertexMapActs"); + se->registerSubsystem(qav); + + if (Input::UPSILON) + { + QAG4SimulationUpsilon* qa = new QAG4SimulationUpsilon(); + + for (int id : Input::UPSILON_EmbedIds) + { + qa->addEmbeddingID(id); + } + se->registerSubsystem(qa); + } +} + +void Distortions_QA() +{ + int verbosity = std::max(Enable::QA_VERBOSITY, Enable::TRACKING_VERBOSITY); + + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer* se = Fun4AllServer::instance(); + + auto qa = new QAG4SimulationDistortions(); + qa->Verbosity(verbosity); + se->registerSubsystem(qa); +} + +#endif diff --git a/common/Trkr_Reco.C b/common/Trkr_Reco.C new file mode 100644 index 000000000..7cc2ed1c3 --- /dev/null +++ b/common/Trkr_Reco.C @@ -0,0 +1,465 @@ +#ifndef MACRO_TRKRRECO_C +#define MACRO_TRKRRECO_C + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + +#include + +R__LOAD_LIBRARY(libTrackingDiagnostics.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libtrackeralign.so) + +void convert_seeds() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + TrackSeedTrackMapConverter* converter = new TrackSeedTrackMapConverter(); + // Default set to full SvtxTrackSeeds. Can be set to + // SiliconTrackSeedContainer or TpcTrackSeedContainer + converter->setTrackSeedName("SvtxTrackSeedContainer"); + converter->setFieldMap(G4MAGNET::magfield); + converter->Verbosity(verbosity); + se->registerSubsystem(converter); +} + +void Tracking_Reco_TrackSeed() +{ + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + // Assemble silicon clusters into track stubs + + auto silicon_Seeding = new PHActsSiliconSeeding; + silicon_Seeding->Verbosity(verbosity); + se->registerSubsystem(silicon_Seeding); + + auto merger = new PHSiliconSeedMerger; + merger->Verbosity(verbosity); + se->registerSubsystem(merger); + + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + seeder->useConstBField(false); + } + if (G4MAGNET::magfield.find(".root") == std::string::npos) + { + //! constant field + seeder->useConstBField(true); + seeder->constBField(std::stod(G4MAGNET::magfield)); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(1.5, 0.05); // (z width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useFixedClusterError(true); + seeder->set_pp_mode(TRACKING::pp_mode); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + if (G4MAGNET::magfield.find(".root") == std::string::npos) + { + cprop->useConstBField(false); + cprop->setConstBField(std::stod(G4MAGNET::magfield)); + } + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + cprop->set_pp_mode(TRACKING::pp_mode); + se->registerSubsystem(cprop); + + if(TRACKING::pp_mode) + { + // for pp mode, apply preliminary distortion corrections to TPC clusters before crossing is known + // and refit the trackseeds. Replace KFProp fits with the new fit parameters in the TPC seeds. + auto prelim_distcorr = new PrelimDistortionCorrection; + prelim_distcorr->set_pp_mode(TRACKING::pp_mode); + prelim_distcorr->Verbosity(verbosity); + se->registerSubsystem(prelim_distcorr); + } + + std::cout << "Tracking_Reco_TrackSeed - Using stub matching for Si matching " << std::endl; + // The normal silicon association methods + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + auto silicon_match = new PHSiliconTpcTrackMatching; + silicon_match->Verbosity(verbosity); + silicon_match->set_pp_mode(TRACKING::pp_mode); + std::cout << "PHSiliconTpcTrackMatching pp_mode set to " << TRACKING::pp_mode << std::endl; + if (G4TRACKING::SC_CALIBMODE) + { + // search windows for initial matching with distortions + // tuned values are 0.04 and 0.008 in distorted events + silicon_match->set_phi_search_window(0.04); + silicon_match->set_eta_search_window(0.008); + } + else + { + // after distortion corrections and rerunning clustering, default tuned values are 0.02 and 0.004 in low occupancy events + silicon_match->set_phi_search_window(0.03); + silicon_match->set_eta_search_window(0.005); + } + silicon_match->set_test_windows_printout(false); // used for tuning search windows + se->registerSubsystem(silicon_match); + + // Associate Micromegas clusters with the tracks + if (Enable::MICROMEGAS) + { + std::cout << "Tracking_Reco_TrackSeed - Using Micromegas matching " << std::endl; + + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + if (G4TRACKING::SC_CALIBMODE) + { + // configuration is potentially with different search windows + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + else + { + // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + } +} + +void Tracking_Reco_TrackSeed_pass1() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + TrackingIterationCounter* counter = new TrackingIterationCounter("TrkrIter1"); + /// Clusters already used are in the 0th iteration + counter->iteration(0); + se->registerSubsystem(counter); + + PHActsSiliconSeeding* silseed = new PHActsSiliconSeeding("PHActsSiliconSeedingIt1"); + silseed->Verbosity(verbosity); + silseed->searchInIntt(); + silseed->iteration(1); + silseed->set_track_map_name("SiliconTrackSeedContainerIt1"); + se->registerSubsystem(silseed); + + PHSiliconSeedMerger* merger = new PHSiliconSeedMerger("SiliconSeedMargerIt1"); + merger->Verbosity(verbosity); + merger->clusterOverlap(2); + merger->searchIntt(); + merger->trackMapName("SiliconTrackSeedContainerIt1"); + se->registerSubsystem(merger); + + TrackContainerCombiner* combiner = new TrackContainerCombiner; + combiner->newContainerName("SiliconTrackSeedContainer"); + combiner->oldContainerName("SiliconTrackSeedContainerIt1"); + combiner->Verbosity(verbosity); + se->registerSubsystem(combiner); +} + +void vertexing() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + auto vtxfinder = new PHSimpleVertexFinder; + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); +} + +void Tracking_Reco_TrackFit() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + auto se = Fun4AllServer::instance(); + + // correct clusters for particle propagation in TPC + auto deltazcorr = new PHTpcDeltaZCorrection; + deltazcorr->Verbosity(verbosity); + se->registerSubsystem(deltazcorr); + + // perform final track fit with ACTS + auto actsFit = new PHActsTrkFitter; + actsFit->Verbosity(verbosity); + actsFit->commissioning(G4TRACKING::use_alignment); + // in calibration mode, fit only Silicons and Micromegas hits + actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + actsFit->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); + actsFit->set_pp_mode(TRACKING::pp_mode); + actsFit->set_use_clustermover(true); // default is true for now + actsFit->useActsEvaluator(false); + actsFit->useOutlierFinder(false); + actsFit->setFieldMap(G4MAGNET::magfield); + se->registerSubsystem(actsFit); + + if (G4TRACKING::SC_CALIBMODE) + { + /* + * in calibration mode, calculate residuals between TPC and fitted tracks, + * store in dedicated structure for distortion correction + */ + auto residuals = new PHTpcResiduals; + residuals->setOutputfile(G4TRACKING::SC_ROOTOUTPUT_FILENAME); + residuals->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } + else + { + /* + * in full tracking mode, run track cleaner, vertex finder, + * propagete tracks to vertex + * propagate tracks to EMCAL + */ + + if (!G4TRACKING::use_full_truth_track_seeding) + { + // Choose the best silicon matched track for each TPC track seed + /* this breaks in truth_track seeding mode because there is no TpcSeed */ + auto cleaner = new PHTrackCleaner; + cleaner->Verbosity(verbosity); + //cleaner->set_quality_cut(30.0); + se->registerSubsystem(cleaner); + } + + vertexing(); + + // Propagate track positions to the vertex position + auto vtxProp = new PHActsVertexPropagator; + vtxProp->Verbosity(verbosity); + vtxProp->fieldMap(G4MAGNET::magfield); + se->registerSubsystem(vtxProp); + + // project tracks to EMCAL + auto projection = new PHActsTrackProjection; + projection->Verbosity(verbosity); + if (G4MAGNET::magfield.find(".root") == std::string::npos) + { + projection->setConstFieldVal(std::stod(G4MAGNET::magfield)); + } + se->registerSubsystem(projection); + } +} + +void Tracking_Reco_CommissioningTrackSeed() +{ + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + auto silicon_Seeding = new PHActsSiliconSeeding; + silicon_Seeding->Verbosity(verbosity); + silicon_Seeding->sigmaScattering(50.); + silicon_Seeding->setRPhiSearchWindow(2.); + silicon_Seeding->helixcut(0.01); + se->registerSubsystem(silicon_Seeding); + + auto merger = new PHSiliconSeedMerger; + merger->Verbosity(verbosity); + se->registerSubsystem(merger); + + // Assemble TPC clusters into track stubs + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(1.5, 0.05); // (z width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + seeder->set_pp_mode(TRACKING::pp_mode); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + cprop->set_pp_mode(TRACKING::pp_mode); + se->registerSubsystem(cprop); + + if(TRACKING::pp_mode) + { + // for pp mode, apply preliminary distortion corrections to TPC clusters before crossing is known + // and refit the trackseeds. Replace KFProp fits with the new fit parameters in the TPC seeds. + auto prelim_distcorr = new PrelimDistortionCorrection; + prelim_distcorr->set_pp_mode(TRACKING::pp_mode); + prelim_distcorr->Verbosity(verbosity); + se->registerSubsystem(prelim_distcorr); + } + + // match silicon track seeds to TPC track seeds + + // The normal silicon association methods + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + auto silicon_match = new PHSiliconTpcTrackMatching; + silicon_match->Verbosity(verbosity); + silicon_match->set_pp_mode(TRACKING::pp_mode); + + silicon_match->set_phi_search_window(0.2); + silicon_match->set_eta_search_window(0.015); + silicon_match->set_x_search_window(std::numeric_limits::max()); + silicon_match->set_y_search_window(std::numeric_limits::max()); + silicon_match->set_z_search_window(std::numeric_limits::max()); + + silicon_match->set_test_windows_printout(false); // used for tuning search windows + se->registerSubsystem(silicon_match); + + // Associate Micromegas clusters with the tracks + if (Enable::MICROMEGAS) + { + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + + mm_match->set_rphi_search_window_lyr1(0.4); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + } +} + +void alignment(std::string datafilename = "mille_output_data_file", + std::string steeringfilename = "mille_steer") +{ + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + auto mille = new MakeMilleFiles; + mille->Verbosity(verbosity); + mille->set_datafile_name(datafilename + ".bin"); + mille->set_steeringfile_name(steeringfilename + ".txt"); + se->registerSubsystem(mille); + + auto helical = new HelicalFitter; + helical->Verbosity(verbosity); + helical->set_datafile_name(datafilename + "_helical.bin"); + helical->set_steeringfile_name(steeringfilename + "_helical.txt"); + se->registerSubsystem(helical); +} + +void Tracking_Reco() +{ + /* + * just a wrapper around track seeding and track fitting methods, + * to minimize disruption to existing steering macros + */ + if (G4TRACKING::use_alignment) + { + Tracking_Reco_CommissioningTrackSeed(); + } + else + { + Tracking_Reco_TrackSeed(); + } + + if (G4TRACKING::convert_seeds_to_svtxtracks) + { + convert_seeds(); + vertexing(); + } + else + { + Tracking_Reco_TrackFit(); + } + + if (G4TRACKING::iterative_seeding) + { + Tracking_Reco_TrackSeed_pass1(); + + if (G4TRACKING::convert_seeds_to_svtxtracks) + { + convert_seeds(); + vertexing(); + } + } + + if (G4TRACKING::use_alignment) + { + alignment(); + } +} + +void Filter_Conversion_Electrons(std::string ntuple_outfile) +{ + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + SecondaryVertexFinder* secvert = new SecondaryVertexFinder; + secvert->Verbosity(verbosity); + // secvert->set_write_electrons_node(true); // writes copy of filtered electron tracks to node tree + // secvert->set_write_ntuple(false); // writes ntuple for tuning cuts + secvert->setDecayParticleMass(0.000511); // for electrons + secvert->setOutfileName(ntuple_outfile); + se->registerSubsystem(secvert); +} + +#endif diff --git a/common/Trkr_RecoInit.C b/common/Trkr_RecoInit.C new file mode 100644 index 000000000..88ba55a80 --- /dev/null +++ b/common/Trkr_RecoInit.C @@ -0,0 +1,36 @@ +#ifndef MACRO_TRKRRECOINIT_C +#define MACRO_TRKRRECOINIT_C + +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) + +#include + +#include +#include +#include +#include + +void TrackingInit() +{ + G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sphenix3dtrackingmapxyz_gap_rebuild.root"); + G4MAGNET::magfield_rescale = 1.; + + ACTSGEOM::ActsGeomInit(); + // space charge correction + /* corrections are applied in the track finding, and via TpcClusterMover before the final track fit + */ + + if( G4TPC::ENABLE_CORRECTIONS ) + { + auto se = Fun4AllServer::instance(); + auto tpcLoadDistortionCorrection = new TpcLoadDistortionCorrection; + tpcLoadDistortionCorrection->set_read_phi_as_radians( G4TPC::DISTORTIONS_USE_PHI_AS_RADIANS ); + tpcLoadDistortionCorrection->set_distortion_filename( G4TPC::correction_filename ); + se->registerSubsystem(tpcLoadDistortionCorrection); + } + +} + + +#endif diff --git a/common/Trkr_Reco_Cosmics.C b/common/Trkr_Reco_Cosmics.C new file mode 100644 index 000000000..0d8d73e63 --- /dev/null +++ b/common/Trkr_Reco_Cosmics.C @@ -0,0 +1,182 @@ +#ifndef MACRO_TRKRRECO_COSMICS_C +#define MACRO_TRKRRECO_COSMICS_C + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libtpc.so) +R__LOAD_LIBRARY(libtrackeralign.so) +R__LOAD_LIBRARY(libTrackingDiagnostics.so) +void convert_seeds() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + TrackSeedTrackMapConverter *converter = new TrackSeedTrackMapConverter(); + // Default set to full SvtxTrackSeeds. Can be set to + // SiliconTrackSeedContainer or TpcTrackSeedContainer + converter->setTrackSeedName("SvtxTrackSeedContainer"); + converter->Verbosity(verbosity); + converter->cosmics(); + converter->setFieldMap(G4MAGNET::magfield); + se->registerSubsystem(converter); +} + +void Tracking_Reco_TrackSeed() +{ + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + PHCosmicSeeder *seeder = new PHCosmicSeeder; + seeder->Verbosity(verbosity); + se->registerSubsystem(seeder); + + PHCosmicSiliconPropagator *hprop = new PHCosmicSiliconPropagator("HelicalPropagator"); + hprop->Verbosity(verbosity); + if (std::stof(G4MAGNET::magfield) < 0.1) + { + hprop->zero_field(); + } + hprop->set_dca_z_cut(2); + hprop->set_dca_xy_cut(1.); + se->registerSubsystem(hprop); + + // Associate Micromegas clusters with the tracks + + auto merger = new PHCosmicTrackMerger("PHCosmicMerger"); + merger->Verbosity(verbosity); + if (std::stof(G4MAGNET::magfield) < 0.1) + { + merger->zero_field(); + } + se->registerSubsystem(merger); + + PHCosmicSiliconPropagator *hprop2 = new PHCosmicSiliconPropagator("HelicalPropagator2"); + hprop2->Verbosity(verbosity); + hprop2->resetSvtxSeedContainer(); + if (std::stof(G4MAGNET::magfield) < 0.1) + { + hprop2->zero_field(); + } + hprop2->set_dca_z_cut(2.); + hprop2->set_dca_xy_cut(0.5); + + se->registerSubsystem(hprop2); + + auto merger2 = new PHCosmicTrackMerger("PHCosmicMerger2"); + merger2->Verbosity(0); + merger2->dca_xycut(0.5); + merger2->dca_rzcut(1); + if (std::stof(G4MAGNET::magfield) < 0.1) + { + merger2->zero_field(); + } + se->registerSubsystem(merger2); +} + +void vertexing() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + auto vtxfinder = new PHSimpleVertexFinder; + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); +} + +void Tracking_Reco_TrackFit() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + auto se = Fun4AllServer::instance(); + + // correct clusters for particle propagation in TPC + auto deltazcorr = new PHTpcDeltaZCorrection; + deltazcorr->Verbosity(verbosity); + se->registerSubsystem(deltazcorr); + + // perform final track fit with ACTS + auto actsFit = new PHCosmicsTrkFitter; + actsFit->Verbosity(verbosity); + // actsFit->commissioning(G4TRACKING::use_alignment); + // actsFit->set_cluster_version(G4TRACKING::cluster_version); + // in calibration mode, fit only Silicons and Micromegas hits + actsFit->useActsEvaluator(true); + actsFit->useOutlierFinder(false); + actsFit->setFieldMap(G4MAGNET::magfield); + se->registerSubsystem(actsFit); +} + +void alignment(std::string datafilename = "mille_output_data_file", + std::string steeringfilename = "mille_steer") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + auto mille = new MakeMilleFiles; + mille->Verbosity(verbosity); + mille->set_datafile_name(datafilename + ".bin"); + mille->set_steeringfile_name(steeringfilename + ".txt"); + // mille->set_cluster_version(G4TRACKING::cluster_version); + se->registerSubsystem(mille); + + auto helical = new HelicalFitter; + helical->Verbosity(0); + helical->set_datafile_name(datafilename + "_helical.bin"); + helical->set_steeringfile_name(steeringfilename + "_helical.txt"); + // helical->set_cluster_version(G4TRACKING::cluster_version); + se->registerSubsystem(helical); +} + +void Tracking_Reco() +{ + Tracking_Reco_TrackSeed(); + if (G4TRACKING::convert_seeds_to_svtxtracks) + { + convert_seeds(); + } + else + { + Tracking_Reco_TrackFit(); + } + + vertexing(); + + if (G4TRACKING::use_alignment) + { + alignment(); + } +} + +#endif diff --git a/common/Trkr_TruthReco.C b/common/Trkr_TruthReco.C new file mode 100644 index 000000000..8ba923291 --- /dev/null +++ b/common/Trkr_TruthReco.C @@ -0,0 +1,468 @@ +#ifndef MACRO_TRKRTRUTHRECO_C +#define MACRO_TRKRTRUTHRECO_C + +#include + +#include + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +R__LOAD_LIBRARY(libTrackingDiagnostics.so) +R__LOAD_LIBRARY(libtrack_reco.so) +R__LOAD_LIBRARY(libtpccalib.so) +R__LOAD_LIBRARY(libtrackeralign.so) +R__LOAD_LIBRARY(libg4eval.so) + +void convert_seeds() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + TrackSeedTrackMapConverter *converter = new TrackSeedTrackMapConverter(); + // Default set to full SvtxTrackSeeds. Can be set to + // SiliconTrackSeedContainer or TpcTrackSeedContainer + converter->setTrackSeedName("SvtxTrackSeedContainer"); + converter->Verbosity(verbosity); + se->registerSubsystem(converter); +} + +void Tracking_Reco_TrackSeed() +{ + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + if (!G4TRACKING::use_full_truth_track_seeding) + { + // Assemble silicon clusters into track stubs + if (G4TRACKING::use_truth_silicon_seeding) + { + // For the silicon, for each truth particle, create a track and associate clusters with it using truth information, write to silicon track map + // track stubs are given the location of the truth vertex in this module + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingSilicon"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SiliconTrackSeedContainer"); + pat_rec->set_min_layer(0); + pat_rec->set_max_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + se->registerSubsystem(pat_rec); + } else { + auto silicon_Seeding = new PHActsSiliconSeeding; + silicon_Seeding->Verbosity(verbosity); + std::cout << "SETTING SI SEED CV" << std::endl; + se->registerSubsystem(silicon_Seeding); + + auto merger = new PHSiliconSeedMerger; + merger->Verbosity(verbosity); + se->registerSubsystem(merger); + } + + // Assemble TPC clusters into track stubs + if (G4TRACKING::use_truth_tpc_seeding) + { + // For the TPC, for each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position odf the truth vertex in this module + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingTpc"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("TpcTrackSeedContainer"); + pat_rec->set_min_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer); + pat_rec->set_max_layer(G4MVTX::n_maps_layer + G4INTT::n_intt_layer + G4TPC::n_gas_layer); + se->registerSubsystem(pat_rec); + + } else { + + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(1.5, 0.05); // (z width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + } + + // match silicon track seeds to TPC track seeds + if (G4TRACKING::use_truth_si_matching) + { + std::cout << "Tracking_Reco_TrackSeed - Using truth Si matching " << std::endl; + // use truth particle matching in TPC to assign clusters in silicon to TPC tracks from CA seeder + auto silicon_assoc = new PHTruthSiliconAssociation; + silicon_assoc->Verbosity(verbosity); + se->registerSubsystem(silicon_assoc); + } else { + std::cout << "Tracking_Reco_TrackSeed - Using stub matching for Si matching " << std::endl; + // The normal silicon association methods + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + auto silicon_match = new PHSiliconTpcTrackMatching; + silicon_match->Verbosity(verbosity); + silicon_match->set_pp_mode(TRACKING::pp_mode); + std::cout << "PHSiliconTpcTrackMatching pp_mode set to " << TRACKING::pp_mode << std::endl; + if (G4TRACKING::SC_CALIBMODE) + { + // search windows for initial matching with distortions + // tuned values are 0.04 and 0.008 in distorted events + silicon_match->set_phi_search_window(0.04); + silicon_match->set_eta_search_window(0.008); + } else { + // after distortion corrections and rerunning clustering, default tuned values are 0.02 and 0.004 in low occupancy events + silicon_match->set_phi_search_window(0.03); + silicon_match->set_eta_search_window(0.005); + } + silicon_match->set_test_windows_printout(false); // used for tuning search windows + se->registerSubsystem(silicon_match); + } + + // Associate Micromegas clusters with the tracks + if( Enable::MICROMEGAS ) + { + std::cout << "Tracking_Reco_TrackSeed - Using Micromegas matching " << std::endl; + + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + if (G4TRACKING::SC_CALIBMODE) + { + // configuration is potentially with different search windows + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } else { + // baseline configuration is (0.2, 13.0, 26, 0.2) and is the default + mm_match->set_rphi_search_window_lyr1(0.2); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + } + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + } + + } else { + + // full truth track finding + std::cout << "Tracking_Reco_TrackSeed - Using full truth track seeding" << std::endl; + + // For each truth particle, create a track and associate clusters with it using truth information, write to Svtx track map + // track stubs are given the position of the truth vertex in this module, but Genfit does not care + // Includes clusters for TPC, silicon and MM's + auto pat_rec = new PHTruthTrackSeeding("PHTruthTrackSeedingFull"); + pat_rec->Verbosity(verbosity); + pat_rec->set_track_map_name("SvtxTrackSeedContainer"); + se->registerSubsystem(pat_rec); + + } + + /* + * all done + * at this stage tracks are fully assembled. They contain clusters spaning Silicon detectors, TPC and Micromegas + * they are ready to be fit. + */ + if(G4TRACKING::convert_seeds_to_svtxtracks) + { + convert_seeds(); + } +} + + +void vertexing() +{ + Fun4AllServer* se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + if (G4TRACKING::use_truth_vertexing) + { + auto vtxing = new PHTruthVertexing; + vtxing->associate_tracks(true); + std::string trackmapnamef = "SvtxTrackMap"; + vtxing->set_track_map_name(trackmapnamef); + se->registerSubsystem(vtxing); + } else { + auto vtxfinder = new PHSimpleVertexFinder; + vtxfinder->Verbosity(verbosity); + se->registerSubsystem(vtxfinder); + } + +} + +void Tracking_Reco_TrackFit() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + auto se = Fun4AllServer::instance(); + + // correct clusters for particle propagation in TPC + auto deltazcorr = new PHTpcDeltaZCorrection; + deltazcorr->Verbosity(verbosity); + se->registerSubsystem(deltazcorr); + + + // perform final track fit with ACTS + auto actsFit = new PHActsTrkFitter; + actsFit->Verbosity(verbosity); + //actsFit->commissioning(G4TRACKING::use_alignment); + + actsFit->set_use_clustermover(true); + + + // in calibration mode, fit only Silicons and Micromegas hits + actsFit->fitSiliconMMs(G4TRACKING::SC_CALIBMODE); + actsFit->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); + actsFit->set_pp_mode(TRACKING::pp_mode); + actsFit->useActsEvaluator(false); + actsFit->useOutlierFinder(false); + actsFit->setFieldMap(G4MAGNET::magfield); + se->registerSubsystem(actsFit); + + if (G4TRACKING::SC_CALIBMODE) + { + /* + * in calibration mode, calculate residuals between TPC and fitted tracks, + * store in dedicated structure for distortion correction + */ + auto residuals = new PHTpcResiduals; + residuals->setOutputfile(G4TRACKING::SC_ROOTOUTPUT_FILENAME); + + residuals->setUseMicromegas(G4TRACKING::SC_USE_MICROMEGAS); + residuals->Verbosity(verbosity); + se->registerSubsystem(residuals); + } else { + + /* + * in full tracking mode, run track cleaner, vertex finder, + * propagete tracks to vertex + * propagate tracks to EMCAL + */ + + if( !G4TRACKING::use_full_truth_track_seeding ) + { + // Choose the best silicon matched track for each TPC track seed + /* this breaks in truth_track seeding mode because there is no TpcSeed */ + auto cleaner = new PHTrackCleaner; + cleaner->Verbosity(verbosity); + se->registerSubsystem(cleaner); + } + + vertexing(); + + // Propagate track positions to the vertex position + auto vtxProp = new PHActsVertexPropagator; + vtxProp->Verbosity(verbosity); + vtxProp->fieldMap(G4MAGNET::magfield); + se->registerSubsystem(vtxProp); + + // project tracks to EMCAL + auto projection = new PHActsTrackProjection; + projection->Verbosity(verbosity); + if(G4MAGNET::magfield.find(".root") == std::string::npos) + { projection->setConstFieldVal(std::stod(G4MAGNET::magfield)); } + se->registerSubsystem(projection); + } + +} + +void Tracking_Reco_CommissioningTrackSeed() +{ + // set up verbosity + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + // get fun4all server instance + auto se = Fun4AllServer::instance(); + + auto silicon_Seeding = new PHActsSiliconSeeding; + silicon_Seeding->Verbosity(verbosity); + silicon_Seeding->sigmaScattering(50.); + silicon_Seeding->setRPhiSearchWindow(0.4); + se->registerSubsystem(silicon_Seeding); + + auto merger = new PHSiliconSeedMerger; + merger->Verbosity(verbosity); + se->registerSubsystem(merger); + + // Assemble TPC clusters into track stubs + auto seeder = new PHCASeeding("PHCASeeding"); + seeder->set_field_dir(G4MAGNET::magfield_rescale); // to get charge sign right + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + seeder->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + seeder->Verbosity(verbosity); + seeder->SetLayerRange(7, 55); + seeder->SetSearchWindow(1.5, 0.05); // (z width, phi width) + seeder->SetMinHitsPerCluster(0); + seeder->SetMinClustersPerTrack(3); + seeder->useConstBField(false); + seeder->useFixedClusterError(true); + se->registerSubsystem(seeder); + + // expand stubs in the TPC using simple kalman filter + auto cprop = new PHSimpleKFProp("PHSimpleKFProp"); + cprop->set_field_dir(G4MAGNET::magfield_rescale); + if (G4MAGNET::magfield.find("3d") != std::string::npos) + { + cprop->set_field_dir(-1 * G4MAGNET::magfield_rescale); + } + cprop->useConstBField(false); + cprop->useFixedClusterError(true); + cprop->set_max_window(5.); + cprop->Verbosity(verbosity); + se->registerSubsystem(cprop); + + + // match silicon track seeds to TPC track seeds + + // The normal silicon association methods + // Match the TPC track stubs from the CA seeder to silicon track stubs from PHSiliconTruthTrackSeeding + auto silicon_match = new PHSiliconTpcTrackMatching; + silicon_match->Verbosity(verbosity); + silicon_match->set_pp_mode(TRACKING::pp_mode); + + silicon_match->set_phi_search_window(0.2); + silicon_match->set_eta_search_window(0.015); + silicon_match->set_x_search_window(std::numeric_limits::max()); + silicon_match->set_y_search_window(std::numeric_limits::max()); + silicon_match->set_z_search_window(std::numeric_limits::max()); + + silicon_match->set_test_windows_printout(false); // used for tuning search windows + se->registerSubsystem(silicon_match); + + + // Associate Micromegas clusters with the tracks + if( Enable::MICROMEGAS ) + { + // Match TPC track stubs from CA seeder to clusters in the micromegas layers + auto mm_match = new PHMicromegasTpcTrackMatching; + mm_match->Verbosity(verbosity); + + mm_match->set_rphi_search_window_lyr1(0.4); + mm_match->set_rphi_search_window_lyr2(13.0); + mm_match->set_z_search_window_lyr1(26.0); + mm_match->set_z_search_window_lyr2(0.2); + + mm_match->set_min_tpc_layer(38); // layer in TPC to start projection fit + mm_match->set_test_windows_printout(false); // used for tuning search windows only + se->registerSubsystem(mm_match); + + + } + if(G4TRACKING::convert_seeds_to_svtxtracks) + { + convert_seeds(); + } +} + +void alignment(std::string datafilename = "mille_output_data_file", + std::string steeringfilename = "mille_steer") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + + auto mille = new MakeMilleFiles; + mille->Verbosity(verbosity); + mille->set_datafile_name(datafilename + ".bin"); + mille->set_steeringfile_name(steeringfilename + ".txt"); + se->registerSubsystem(mille); + + auto helical = new HelicalFitter; + helical->Verbosity(0); + helical->set_datafile_name(datafilename + "_helical.bin"); + helical->set_steeringfile_name(steeringfilename + "_helical.txt"); + se->registerSubsystem(helical); + +} + +void Tracking_Reco() +{ + /* + * just a wrapper around track seeding and track fitting methods, + * to minimize disruption to existing steering macros + */ + if(G4TRACKING::use_alignment) + { + Tracking_Reco_CommissioningTrackSeed(); + } + else + { + Tracking_Reco_TrackSeed(); + } + + if(G4TRACKING::convert_seeds_to_svtxtracks) + { + vertexing(); + } + else + { + Tracking_Reco_TrackFit(); + } + + if(G4TRACKING::use_alignment) + { + alignment(); + } + +} + +void Filter_Conversion_Electrons(std::string ntuple_outfile) +{ + Fun4AllServer* se = Fun4AllServer::instance(); + SecondaryVertexFinder* secvert = new SecondaryVertexFinder; + secvert->Verbosity(0); + secvert->set_write_electrons_node(true); // writes copy of filtered electron tracks to node tree + secvert->set_write_ntuple(false); // writes ntuple for tuning cuts + secvert->setDecayParticleMass( 0.000511); // for electrons + secvert->setOutfileName(ntuple_outfile); + se->registerSubsystem(secvert); +} + + + +#endif diff --git a/common/Trkr_TruthTables.C b/common/Trkr_TruthTables.C new file mode 100644 index 000000000..6b5b2bbc7 --- /dev/null +++ b/common/Trkr_TruthTables.C @@ -0,0 +1,27 @@ +#ifndef MACRO_TRKRTRUTHTABLES_C +#define MACRO_TRKRTRUTHTABLES_C + +#include + +#include + +#include + +R__LOAD_LIBRARY(libg4eval.so) + +void build_truthreco_tables() +{ + int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY); + Fun4AllServer* se = Fun4AllServer::instance(); + + // this module builds high level truth track association table. + // If this module is used, this table should be called before any evaluator calls. + // Removing this module, evaluation will still work but trace truth association through the layers of G4-hit-cluster + SvtxTruthRecoTableEval *tables = new SvtxTruthRecoTableEval(); + tables->Verbosity(verbosity); + se->registerSubsystem(tables); + + return; +} + +#endif diff --git a/common/sPhenixStyle.C b/common/sPhenixStyle.C new file mode 100644 index 000000000..f958e92cc --- /dev/null +++ b/common/sPhenixStyle.C @@ -0,0 +1,115 @@ +// +// sPHENIX Style, based on a style file from BaBar, v0.1 +// + +#include + +#include +#include + +#include + +void SetsPhenixStyle() +{ + static TStyle* sphenixStyle = 0; + std::cout << "sPhenixStyle: Applying nominal settings." << std::endl; + if (sphenixStyle == 0) sphenixStyle = sPhenixStyle(); + gROOT->SetStyle("sPHENIX"); + gROOT->ForceStyle(); +} + +TStyle* sPhenixStyle() +{ + TStyle* sphenixStyle = new TStyle("sPHENIX", "sPHENIX style"); + + // use plain black on white colors + Int_t icol = 0; // WHITE + sphenixStyle->SetFrameBorderMode(icol); + sphenixStyle->SetFrameFillColor(icol); + sphenixStyle->SetCanvasBorderMode(icol); + sphenixStyle->SetCanvasColor(icol); + sphenixStyle->SetPadBorderMode(icol); + sphenixStyle->SetPadColor(icol); + sphenixStyle->SetStatColor(icol); + //sphenixStyle->SetFillColor(icol); // don't use: white fill color for *all* objects + + // set the paper & margin sizes + sphenixStyle->SetPaperSize(20, 26); + + // set margin sizes + sphenixStyle->SetPadTopMargin(0.05); + sphenixStyle->SetPadRightMargin(0.05); + sphenixStyle->SetPadBottomMargin(0.16); + sphenixStyle->SetPadLeftMargin(0.16); + + // set title offsets (for axis label) + sphenixStyle->SetTitleXOffset(1.4); + sphenixStyle->SetTitleYOffset(1.4); + + // use large fonts + //Int_t font=72; // Helvetica italics + Int_t font = 42; // Helvetica + Double_t tsize = 0.05; + sphenixStyle->SetTextFont(font); + + sphenixStyle->SetTextSize(tsize); + sphenixStyle->SetLabelFont(font, "x"); + sphenixStyle->SetTitleFont(font, "x"); + sphenixStyle->SetLabelFont(font, "y"); + sphenixStyle->SetTitleFont(font, "y"); + sphenixStyle->SetLabelFont(font, "z"); + sphenixStyle->SetTitleFont(font, "z"); + + sphenixStyle->SetLabelSize(tsize, "x"); + sphenixStyle->SetTitleSize(tsize, "x"); + sphenixStyle->SetLabelSize(tsize, "y"); + sphenixStyle->SetTitleSize(tsize, "y"); + sphenixStyle->SetLabelSize(tsize, "z"); + sphenixStyle->SetTitleSize(tsize, "z"); + + // use bold lines and markers + sphenixStyle->SetMarkerStyle(20); + sphenixStyle->SetMarkerSize(1.2); + sphenixStyle->SetHistLineWidth(2.); + sphenixStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes + + // get rid of X error bars + //sphenixStyle->SetErrorX(0.001); + // get rid of error bar caps + sphenixStyle->SetEndErrorSize(0.); + + // do not display any of the standard histogram decorations + sphenixStyle->SetOptTitle(0); + //sphenixStyle->SetOptStat(1111); + sphenixStyle->SetOptStat(0); + //sphenixStyle->SetOptFit(1111); + sphenixStyle->SetOptFit(0); + + // put tick marks on top and RHS of plots + sphenixStyle->SetPadTickX(1); + sphenixStyle->SetPadTickY(1); + + // legend modificatin + sphenixStyle->SetLegendBorderSize(0); + sphenixStyle->SetLegendFillColor(0); + sphenixStyle->SetLegendFont(font); + +#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 00, 0) + std::cout << "sPhenixStyle: ROOT6 mode" << std::endl; + sphenixStyle->SetLegendTextSize(tsize); + sphenixStyle->SetPalette(kBird); +#else + std::cout << "sPhenixStyle: ROOT5 mode" << std::endl; + // color palette - manually define 'kBird' palette only available in ROOT 6 + Int_t alpha = 0; + Double_t stops[9] = {0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000}; + Double_t red[9] = {0.2082, 0.0592, 0.0780, 0.0232, 0.1802, 0.5301, 0.8186, 0.9956, 0.9764}; + Double_t green[9] = {0.1664, 0.3599, 0.5041, 0.6419, 0.7178, 0.7492, 0.7328, 0.7862, 0.9832}; + Double_t blue[9] = {0.5293, 0.8684, 0.8385, 0.7914, 0.6425, 0.4662, 0.3499, 0.1968, 0.0539}; + TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha); +#endif + + sphenixStyle->SetNumberContours(80); + + return sphenixStyle; +} diff --git a/common/sPhenixStyle.h b/common/sPhenixStyle.h new file mode 100644 index 000000000..859eb2fa1 --- /dev/null +++ b/common/sPhenixStyle.h @@ -0,0 +1,51 @@ +// +// @file sPhenixStyle.h +// +// sPHENIX Style, based on a style file from ATLAS +// +// +// @author Peter Steinberg +// +// Copyright (C) 2017 sPhenix Collaboration +// +// Version 0.1 + +#ifndef __SPHENIXSTYLE_H +#define __SPHENIXSTYLE_H + +#include + +//! \brief sPHENIX Style, based on a style file from ATLAS by Peter Steinberg +/* +Please find instruction at https://wiki.bnl.gov/sPHENIX/index.php/Plot_template . Here is a snapshot: + +# How to use + +To ensure some consistency among plots produced by different sPHENIX members, a candidate style file is being proposed (May 2017), based on the ATLAS style file. Please click here for the gzipped tar file. +For general use, copy or link the ``sPHENIXStyle.h`` and ``sPHENIXStyle.C`` files somewhere, either locally or in your macro path (``gROOT->GetMacroPath()`` will tell you, and add it in ``.rootrc`` if you need one). +Then do +`` +[0] gROOT->LoadMacro("sPhenixStyle.C") +[1] SetsPhenixStyle() +`` +and you're good to go (even better, add this all into your ``.rootlogon.C`` file) + +# Rules of the sPHENIX style + +* Don't talk about the style file. +* Always use the style file. +* Units should always be indicated in brackets "[ ]", while counts will typically specify the bin width "Events / 2 GeV" or "Events / 0.13 rad". +* Every plot should have a legend indicating "sPHENIX", "sPHENIX Preliminary", "sPHENIX Simulation", etc. +* sPHENIX should be bold, italic +* Where possible, indicate the system being considered and it's energy +* "MC" predictions should be filled, with distinguishable colors +* Data or pseudodata should always be histograms or graphs with error bars +* Elements should never overlap, with each other or with the axis + + * + */ +void SetsPhenixStyle(); + +TStyle* sPhenixStyle(); + +#endif // __SPHENIXSTYLE_H diff --git a/macros/prototype3/DisplayOn.C b/detectors/sPHENIX/DisplayOn.C similarity index 63% rename from macros/prototype3/DisplayOn.C rename to detectors/sPHENIX/DisplayOn.C index cb75b1cbc..c2d112523 100644 --- a/macros/prototype3/DisplayOn.C +++ b/detectors/sPHENIX/DisplayOn.C @@ -1,3 +1,30 @@ +#pragma once + +#include + +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libg4testbench.so) + +namespace Enable +{ + bool DISPLAY = false; +} + +// This starts the QT based G4 gui which takes control +// when x'ed out it will return a pointer to PHG4Reco so +// the gui can be startrd again +PHG4Reco *QTGui() +{ + Fun4AllServer *se = Fun4AllServer::instance(); + PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); + g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); + g4->StartGui(); + return g4; +} + // stupid macro to turn on the geant4 display // we ask Fun4All for a pointer to PHG4Reco // using the ApplyCommand will start up the @@ -6,12 +33,13 @@ // start up the visualization, the next event will // be displayed. Do not execute this macro // before PHG4Reco was registered with Fun4All -PHG4Reco * DisplayOn(const char *mac = "vis_prototype3.mac") +PHG4Reco *DisplayOn(const char *mac = "vis.mac") { char cmd[100]; Fun4AllServer *se = Fun4AllServer::instance(); PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); g4->InitRun(se->topNode()); + g4->ApplyDisplayAction(); sprintf(cmd, "/control/execute %s", mac); g4->ApplyCommand(cmd); return g4; @@ -31,4 +59,6 @@ void displaycmd() cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl; cout << "set background color:" << endl; cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl; + cout << "Overlap check:" << endl; + cout << " g4->ApplyCommand(\"/geometry/test/run\")" << endl; } diff --git a/detectors/sPHENIX/Fun4All_G4_sPHENIX.C b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C new file mode 100644 index 000000000..e4c5d7aca --- /dev/null +++ b/detectors/sPHENIX/Fun4All_G4_sPHENIX.C @@ -0,0 +1,789 @@ +#ifndef MACRO_FUN4ALLG4SPHENIX_C +#define MACRO_FUN4ALLG4SPHENIX_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libffamodules.so) + +// For HepMC Hijing +// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat + +int Fun4All_G4_sPHENIX( + const int nEvents = 1, + const int process = 0, + const string &embed_input_str0 = "DST_TRUTH_G4HIT_pi_100_2000MeV_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000006-0", + const string &embed_input_str1 = "DST_TRKR_G4HIT_pi_100_2000MeV_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000006-0", + const string &embed_input_str2 = "DST_CALO_G4HIT_pi_100_2000MeV_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000006-0", + const string &outputFile_str = "G4sPHENIX.root", + const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root", + const int skip = 0, + const string &outdir = ".") +{ + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); + + //Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints. + PHRandomSeed::Verbosity(1); + + // construct the input and output file names + //char num_field[500]; + //sprintf(num_field,"%04d.root", process); + //string numin = num_field; + string embed_infile0 = embed_input_str0; + string embed_infile1 = embed_input_str1; + string embed_infile2 = embed_input_str2; + + cout << "Embedding input file0: " << embed_infile0 << endl; + cout << "Embedding input file1: " << embed_infile1 << endl; + cout << "Embedding input file2: " << embed_infile2 << endl; + + char outputFile[500]; + sprintf(outputFile,"%s%04d.root", outputFile_str.c_str(), process); + cout << "Embedding output file: " << outputFile << endl; + const string& inputFile = embed_input_str0; + + // just if we set some flags somewhere in this macro + recoConsts *rc = recoConsts::instance(); + // By default every random number generator uses + // PHRandomSeed() which reads /dev/urandom to get its seed + // if the RANDOMSEED flag is set its value is taken as seed + // You can either set this to a random value using PHRandomSeed() + // which will make all seeds identical (not sure what the point of + // this would be: + // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); + // or set it to a fixed value so you can debug your code + rc->set_IntFlag("RANDOMSEED", TString(outputFile).Hash()); + + + //=============== + // Input options + //=============== + // verbosity setting (applies to all input managers) + Input::VERBOSITY = 0; + // First enable the input generators + // Either: + // read previously generated g4-hits files, in this case it opens a DST and skips + // the simulations step completely. The G4Setup macro is only loaded to get information + // about the number of layers used for the cell reco code + Input::READHITS = true; + INPUTREADHITS::filename[0] = embed_infile0; + INPUTREADHITS::filename[1] = embed_infile1; + INPUTREADHITS::filename[2] = embed_infile2; + + // if you use a filelist + // INPUTREADHITS::listfile[0] = inputFile; + // Or: + // Use particle generator + // And + // Further choose to embed newly simulated events to a previous simulation. Not compatible with `readhits = true` + // In case embedding into a production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder + // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ + Input::EMBED = false; + INPUTEMBED::filename[0] = embed_infile0; + INPUTEMBED::filename[1] = embed_infile1; + INPUTEMBED::filename[2] = embed_infile2; + // if you use a filelist + //INPUTEMBED::listfile[0] = embed_input_file; + + Input::SIMPLE = false; + Input::SIMPLE_NUMBER = 2; // if you need 2 of them + // Input::SIMPLE_VERBOSITY = 1; + + // Enable this is emulating the nominal pp/pA/AA collision vertex distribution + // Input::BEAM_CONFIGURATION = Input::AA_COLLISION; // Input::AA_COLLISION (default), Input::pA_COLLISION, Input::pp_COLLISION + + // Input::PYTHIA6 = true; + + // Input::PYTHIA8 = true; + + // Input::GUN = true; + // Input::GUN_NUMBER = 3; // if you need 3 of them + // Input::GUN_VERBOSITY = 1; + + // Input::COSMIC = true; + + //D0 generator + //Input::DZERO = false; + //Input::DZERO_VERBOSITY = 0; + //Lambda_c generator //Not ready yet + //Input::LAMBDAC = false; + //Input::LAMBDAC_VERBOSITY = 0; + // Upsilon generator + Input::UPSILON = false; + Input::UPSILON_NUMBER = 1; // if you need 3 of them + //Input::UPSILON_VERBOSITY = 0; + + // Input::HEPMC = true; + INPUTHEPMC::filename = inputFile; + //----------------- + // Hijing options (symmetrize hijing, add flow, add fermi motion) + //----------------- + // INPUTHEPMC::HIJINGFLIP = true; + // INPUTHEPMC::FLOW = true; + // INPUTHEPMC::FLOW_VERBOSITY = 3; + // INPUTHEPMC::FERMIMOTION = true; + + + // Event pile up simulation with collision rate in Hz MB collisions. + //Input::PILEUPRATE = 50e3; // 50 kHz for AuAu + //Input::PILEUPRATE = 3e6; // 3MHz for pp + + // Enable this is emulating the nominal pp/pA/AA collision vertex distribution + // for HepMC records (hijing, pythia8) + // Input::BEAM_CONFIGURATION = Input::AA_COLLISION; // for 2023 sims we want the AA geometry for no pileup sims + // Input::BEAM_CONFIGURATION = Input::pp_COLLISION; // for 2024 sims we want the pp geometry for no pileup sims + // Input::BEAM_CONFIGURATION = Input::pA_COLLISION; // for pAu sims we want the pA geometry for no pileup sims + + //----------------- + // Initialize the selected Input/Event generation + //----------------- + // This creates the input generator(s) + InputInit(); + + //-------------- + // Set generator specific options + //-------------- + // can only be set after InputInit() is called + + // Simple Input generator: + // if you run more than one of these Input::SIMPLE_NUMBER > 1 + // add the settings for other with [1], next with [2]... + if (Input::SIMPLE) + { + // low pT pions + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 10); + INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi+", 10); + if (Input::HEPMC || Input::EMBED) + { + INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + else + { + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Gaus, + PHG4SimpleEventGenerator::Gaus, + PHG4SimpleEventGenerator::Gaus); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.); + INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0.01, 0.01, 5.); + } + INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1); + INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 2.); + + // high pT pions + INPUTGENERATOR::SimpleEventGenerator[1]->add_particles("pi-", 10); + INPUTGENERATOR::SimpleEventGenerator[1]->add_particles("pi+", 10); + INPUTGENERATOR::SimpleEventGenerator[1]->set_reuse_existing_vertex(true); + INPUTGENERATOR::SimpleEventGenerator[1]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + INPUTGENERATOR::SimpleEventGenerator[1]->set_eta_range(-1, 1); + INPUTGENERATOR::SimpleEventGenerator[1]->set_phi_range(-M_PI, M_PI); + INPUTGENERATOR::SimpleEventGenerator[1]->set_pt_range(2, 50.); + } + // Upsilons + // if you run more than one of these Input::UPSILON_NUMBER > 1 + // add the settings for other with [1], next with [2]... + if (Input::UPSILON) + { + INPUTGENERATOR::VectorMesonGenerator[0]->add_decay_particles("e", 0); + INPUTGENERATOR::VectorMesonGenerator[0]->set_rapidity_range(-1, 1); + INPUTGENERATOR::VectorMesonGenerator[0]->set_pt_range(0., 10.); + // Y species - select only one, last one wins + INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s(); + if (Input::HEPMC || Input::EMBED) + { + INPUTGENERATOR::VectorMesonGenerator[0]->set_reuse_existing_vertex(true); + INPUTGENERATOR::VectorMesonGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); + } + } + // particle gun + // if you run more than one of these Input::GUN_NUMBER > 1 + // add the settings for other with [1], next with [2]... + if (Input::GUN) + { + INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0); + INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0); + } + + // pythia6 + if (Input::PYTHIA6) + { + //! Nominal collision geometry is selected by Input::BEAM_CONFIGURATION + Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia6); + } + // pythia8 + if (Input::PYTHIA8) + { + //! Nominal collision geometry is selected by Input::BEAM_CONFIGURATION + Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia8); + } + + //-------------- + // Set Input Manager specific options + //-------------- + // can only be set after InputInit() is called + + if (Input::HEPMC) + { + //! Nominal collision geometry is selected by Input::BEAM_CONFIGURATION + Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCInputManager); + + // optional overriding beam parameters + //INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4, 100e-4, 8, 0); //optional collision smear in space, time + // INPUTMANAGER::HepMCInputManager->set_vertex_distribution_mean(0,0,0,0);//optional collision central position shift in space, time + // //optional choice of vertex distribution function in space, time + //INPUTMANAGER::HepMCInputManager->set_vertex_distribution_function(PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus); + //! embedding ID for the event + //! positive ID is the embedded event of interest, e.g. jetty event from pythia + //! negative IDs are backgrounds, .e.g out of time pile up collisions + //! Usually, ID = 0 means the primary Au+Au collision background + //INPUTMANAGER::HepMCInputManager->set_embedding_id(Input::EmbedID); + if (Input::PILEUPRATE > 0) + { + // Copy vertex settings from foreground hepmc input + INPUTMANAGER::HepMCPileupInputManager->CopyHelperSettings(INPUTMANAGER::HepMCInputManager); + // and then modify the ones you want to be different + // INPUTMANAGER::HepMCPileupInputManager->set_vertex_distribution_width(100e-4,100e-4,8,0); + } + } + if (Input::PILEUPRATE > 0) + { + //! Nominal collision geometry is selected by Input::BEAM_CONFIGURATION + Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCPileupInputManager); + } + // register all input generators with Fun4All + InputRegister(); + + if (! Input::READHITS) + { + rc->set_IntFlag("RUNNUMBER",1); + + SyncReco *sync = new SyncReco(); + se->registerSubsystem(sync); + + HeadReco *head = new HeadReco(); + se->registerSubsystem(head); + } +// Flag Handler is always needed to read flags from input (if used) +// and update our rc flags with them. At the end it saves all flags +// again on the DST in the Flags node under the RUN node + FlagHandler *flag = new FlagHandler(); + se->registerSubsystem(flag); + + // set up production relatedstuff + // Enable::PRODUCTION = true; + + //====================== + // Write the DST + //====================== + + //Enable::DSTOUT = true; + Enable::DSTOUT_COMPRESS = false; + DstOut::OutputDir = outdir; + DstOut::OutputFile = outputFile; + + //Option to convert DST to human command readable TTree for quick poke around the outputs + // Enable::DSTREADER = true; + + // turn the display on (default off) + //Enable::DISPLAY = true; + + //====================== + // What to run + //====================== + + // QA, main switch + Enable::QA = true; + + // Global options (enabled for all enables subsystems - if implemented) + // Enable::ABSORBER = true; + // Enable::OVERLAPCHECK = true; + // Enable::VERBOSITY = 1; + + // Enable::MBD = true; + // Enable::MBD_SUPPORT = true; // save hist in MBD/BBC support structure + // Enable::MBDRECO = Enable::MBD && true; + Enable::MBDFAKE = true; // Smeared vtx and t0, use if you don't want real MBD/BBC in simulation + + Enable::PIPE = true; + Enable::PIPE_ABSORBER = true; + + // central tracking + Enable::MVTX = true; + Enable::MVTX_CELL = Enable::MVTX && true; + Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true; + Enable::MVTX_QA = Enable::MVTX_CLUSTER && Enable::QA && true; + + Enable::INTT = true; +// Enable::INTT_ABSORBER = true; // enables layerwise support structure readout +// Enable::INTT_SUPPORT = true; // enable global support structure readout + Enable::INTT_CELL = Enable::INTT && true; + Enable::INTT_CLUSTER = Enable::INTT_CELL && true; + Enable::INTT_QA = Enable::INTT_CLUSTER && Enable::QA && true; + + Enable::TPC = true; + Enable::TPC_ABSORBER = true; + Enable::TPC_CELL = Enable::TPC && true; + Enable::TPC_CLUSTER = Enable::TPC_CELL && true; + Enable::TPC_QA = Enable::TPC_CLUSTER && Enable::QA && true; + + Enable::MICROMEGAS = true; + Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true; + Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true; + Enable::MICROMEGAS_QA = Enable::MICROMEGAS_CLUSTER && Enable::QA && true; + + Enable::TRACKING_TRACK = (Enable::MICROMEGAS_CLUSTER && Enable::TPC_CLUSTER && Enable::INTT_CLUSTER && Enable::MVTX_CLUSTER) && true; + Enable::GLOBAL_RECO = (Enable::MBDFAKE || Enable::MBDRECO || Enable::TRACKING_TRACK) && true; + Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && Enable::GLOBAL_RECO && true; + Enable::TRACKING_QA = Enable::TRACKING_TRACK && Enable::QA && true; + + // only do track matching if TRACKINGTRACK is also used + Enable::TRACK_MATCHING = Enable::TRACKING_TRACK && false; + Enable::TRACK_MATCHING_TREE = Enable::TRACK_MATCHING && false; + Enable::TRACK_MATCHING_TREE_CLUSTERS = Enable::TRACK_MATCHING_TREE && false; + + //Additional tracking tools + //Enable::TRACKING_DIAGNOSTICS = Enable::TRACKING_TRACK && true; + //G4TRACKING::filter_conversion_electrons = true; + // G4TRACKING::use_alignment = true; + + // enable pp mode and set extended readout time + // TRACKING::pp_mode = true; + // TRACKING::pp_extended_readout_time = 20000; + + // set flags to simulate and correct TPC distortions, specify distortion and correction files + //G4TPC::ENABLE_STATIC_DISTORTIONS = true; + //G4TPC::static_distortion_filename = std::string("/sphenix/user/rcorliss/distortion_maps/2023.02/Summary_hist_mdc2_UseFieldMaps_AA_event_0_bX180961051_0.distortion_map.hist.root"); + //G4TPC::ENABLE_CORRECTIONS = true; + //G4TPC::correction_filename = std::string("/sphenix/user/rcorliss/distortion_maps/2023.02/Summary_hist_mdc2_UseFieldMaps_AA_smoothed_average.correction_map.hist.root"); + + // cemc electronics + thin layer of W-epoxy to get albedo from cemc + // into the tracking, cannot run together with CEMC + // Enable::CEMCALBEDO = true; + + Enable::CEMC = false; + Enable::CEMC_ABSORBER = true; + Enable::CEMC_CELL = Enable::CEMC && true; + Enable::CEMC_TOWER = Enable::CEMC_CELL && true; + Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true; + Enable::CEMC_EVAL = Enable::CEMC_G4Hit && Enable::CEMC_CLUSTER && true; + Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && true; + + Enable::HCALIN = false; + Enable::HCALIN_ABSORBER = true; + Enable::HCALIN_CELL = Enable::HCALIN && true; + Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true; + Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true; + Enable::HCALIN_EVAL = Enable::HCALIN_G4Hit && Enable::HCALIN_CLUSTER && true; + Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && true; + + Enable::MAGNET = false; + Enable::MAGNET_ABSORBER = false; + + Enable::HCALOUT = false; + Enable::HCALOUT_ABSORBER = true; + Enable::HCALOUT_CELL = Enable::HCALOUT && true; + Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true; + Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true; + Enable::HCALOUT_EVAL = Enable::HCALOUT_G4Hit && Enable::HCALOUT_CLUSTER && true; + Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER && Enable::QA && true; + + Enable::EPD = false; + Enable::EPD_TILE = Enable::EPD && true; + + Enable::BEAMLINE = true; + +// Enable::BEAMLINE_ABSORBER = true; // makes the beam line magnets sensitive volumes +// Enable::BEAMLINE_BLACKHOLE = true; // turns the beamline magnets into black holes + Enable::ZDC = false; +// Enable::ZDC_ABSORBER = true; +// Enable::ZDC_SUPPORT = true; + + Enable::ZDC_TOWER = Enable::ZDC && true; + Enable::ZDC_EVAL = Enable::ZDC_TOWER && true; + + //! forward flux return plug door. Out of acceptance and off by default. + //Enable::PLUGDOOR = true; + Enable::PLUGDOOR_ABSORBER = true; + + //Enable::GLOBAL_FASTSIM = true; + + //Enable::KFPARTICLE = true; + //Enable::KFPARTICLE_VERBOSITY = 1; + //Enable::KFPARTICLE_TRUTH_MATCH = true; + //Enable::KFPARTICLE_SAVE_NTUPLE = true; + + Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + + Enable::JETS = (Enable::GLOBAL_RECO || Enable::GLOBAL_FASTSIM) && false; + Enable::JETS_EVAL = Enable::JETS && true; + Enable::JETS_QA = Enable::JETS && Enable::QA && true; + + // HI Jet Reco for p+Au / Au+Au collisions (default is false for + // single particle / p+p-only simulations, or for p+Au / Au+Au + // simulations which don't particularly care about jets) + Enable::HIJETS = Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + + // 3-D topoCluster reconstruction, potentially in all calorimeter layers + Enable::TOPOCLUSTER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false; + // particle flow jet reconstruction - needs topoClusters! + Enable::PARTICLEFLOW = Enable::TOPOCLUSTER && true; + // centrality reconstruction + Enable::CENTRALITY = true; + + // new settings using Enable namespace in GlobalVariables.C + Enable::BLACKHOLE = true; + //Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits + //Enable::BLACKHOLE_FORWARD_SAVEHITS = false; // disable forward/backward hits + //BlackHoleGeometry::visible = true; + + // run user provided code (from local G4_User.C) + //Enable::USER = true; + + //=============== + // conditions DB flags + //=============== + Enable::CDB = true; + // global tag + rc->set_StringFlag("CDB_GLOBALTAG",CDB::global_tag); + // 64 bit timestamp + rc->set_uint64Flag("TIMESTAMP",CDB::timestamp); + //--------------- + // World Settings + //--------------- + // G4WORLD::PhysicsList = "FTFP_BERT"; //FTFP_BERT_HP best for calo + // G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans + + //--------------- + // Magnet Settings + //--------------- + + // G4MAGNET::magfield = string(getenv("CALIBRATIONROOT"))+ string("/Field/Map/sphenix3dbigmapxyz.root"); // default map from the calibration database + // G4MAGNET::magfield = "1.5"; // alternatively to specify a constant magnetic field, give a float number, which will be translated to solenoidal field in T, if string use as fieldmap name (including path) +// G4MAGNET::magfield_rescale = 1.; // make consistent with expected Babar field strength of 1.4T + + //--------------- + // Pythia Decayer + //--------------- + // list of decay types in + // $OFFLINE_MAIN/include/g4decayer/EDecayType.hh + // default is All: + // G4P6DECAYER::decayType = EDecayType::kAll; + + // Initialize the selected subsystems + G4Init(); + + //--------------------- + // GEANT4 Detector description + //--------------------- + if (!Input::READHITS) + { + G4Setup(); + } + + //------------------ + // Detector Division + //------------------ + + if ((Enable::MBD && Enable::MBDRECO) || Enable::MBDFAKE) Mbd_Reco(); + + if (Enable::MVTX_CELL) Mvtx_Cells(); + if (Enable::INTT_CELL) Intt_Cells(); + if (Enable::TPC_CELL) TPC_Cells(); + if (Enable::MICROMEGAS_CELL) Micromegas_Cells(); + + if (Enable::CEMC_CELL) CEMC_Cells(); + + if (Enable::HCALIN_CELL) HCALInner_Cells(); + + if (Enable::HCALOUT_CELL) HCALOuter_Cells(); + + //----------------------------- + // CEMC towering and clustering + //----------------------------- + + if (Enable::CEMC_TOWER) CEMC_Towers(); + if (Enable::CEMC_CLUSTER) CEMC_Clusters(); + + //-------------- + // EPD tile reconstruction + //-------------- + + if (Enable::EPD_TILE) EPD_Tiles(); + + //----------------------------- + // HCAL towering and clustering + //----------------------------- + + if (Enable::HCALIN_TOWER) HCALInner_Towers(); + if (Enable::HCALIN_CLUSTER) HCALInner_Clusters(); + + if (Enable::HCALOUT_TOWER) HCALOuter_Towers(); + if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters(); + + // if enabled, do topoClustering early, upstream of any possible jet reconstruction + if (Enable::TOPOCLUSTER) TopoClusterReco(); + + //-------------- + // SVTX tracking + //-------------- + if(Enable::TRACKING_TRACK) + { + TrackingInit(); + } + if (Enable::MVTX_CLUSTER) Mvtx_Clustering(); + if (Enable::INTT_CLUSTER) Intt_Clustering(); + if (Enable::TPC_CLUSTER) + { + if(G4TPC::ENABLE_DIRECT_LASER_HITS || G4TPC::ENABLE_CENTRAL_MEMBRANE_HITS) + { + TPC_LaserClustering(); + } + else + { + TPC_Clustering(); + } + } + if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering(); + + if (Enable::TRACKING_TRACK) + { + Tracking_Reco(); + } + + + + if(Enable::TRACKING_DIAGNOSTICS) + { + const std::string kshortFile = "./kshort_" + outputFile_str; + const std::string residualsFile = "./residuals_" + outputFile_str; + + G4KshortReconstruction(kshortFile); + seedResiduals(residualsFile); + } + + + //----------------- + // Global Vertexing + //----------------- + + if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM) + { + cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl; + gSystem->Exit(1); + } + if (Enable::GLOBAL_RECO) + { + Global_Reco(); + } + else if (Enable::GLOBAL_FASTSIM) + { + Global_FastSim(); + } + + //----------------- + // Centrality Determination + //----------------- + + if (Enable::CENTRALITY) + { + Centrality(); + } + + //----------------- + // Calo Trigger Simulation + //----------------- + + if (Enable::CALOTRIGGER) + { + CaloTrigger_Sim(); + } + + //--------- + // Jet reco + //--------- + + if (Enable::JETS) Jet_Reco(); + if (Enable::HIJETS) HIJetReco(); + + if (Enable::PARTICLEFLOW) ParticleFlow(); + + //---------------------- + // Simulation evaluation + //---------------------- + string outputroot = outputFile; + string remove_this = ".root"; + size_t pos = outputroot.find(remove_this); + if (pos != string::npos) + { + outputroot.erase(pos, remove_this.length()); + } + + if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4svtx_eval.root"); + + if (Enable::CEMC_EVAL) CEMC_Eval(outputroot + "_g4cemc_eval.root"); + + if (Enable::HCALIN_EVAL) HCALInner_Eval(outputroot + "_g4hcalin_eval.root"); + + if (Enable::HCALOUT_EVAL) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root"); + + if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root"); + + if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root"); + + + + if (Enable::USER) UserAnalysisInit(); + + // Writes electrons from conversions to a new track map on the node tree + // the ntuple file is for diagnostics, it is produced only if the flag is set in G4_Tracking.C + if(G4TRACKING::filter_conversion_electrons) Filter_Conversion_Electrons(outputroot + "_secvert_ntuple.root"); + + + //====================== + // Run KFParticle on evt + //====================== + if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco(); + if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco(); + + //---------------------- + // Standard QAs + //---------------------- + + if (Enable::CEMC_QA) CEMC_QA(); + if (Enable::HCALIN_QA) HCALInner_QA(); + if (Enable::HCALOUT_QA) HCALOuter_QA(); + + if (Enable::JETS_QA) Jet_QA(); + + if (Enable::MVTX_QA) Mvtx_QA(); + if (Enable::INTT_QA) Intt_QA(); + if (Enable::TPC_QA) TPC_QA(); + if (Enable::MICROMEGAS_QA) Micromegas_QA(); + if (Enable::TRACKING_QA) Tracking_QA(); + + if (Enable::TRACKING_QA && Enable::CEMC_QA && Enable::HCALIN_QA && Enable::HCALOUT_QA) QA_G4CaloTracking(); + + if (Enable::TRACK_MATCHING) Track_Matching(outputroot + "_g4trackmatching.root"); + + //-------------- + // Set up Input Managers + //-------------- + + InputManagers(); + + if (Enable::PRODUCTION) + { + Production_CreateOutputDir(); + } + + if (Enable::DSTOUT) + { + string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile; + Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile); + if (Enable::DSTOUT_COMPRESS) + { + ShowerCompress(); + DstCompress(out); + } + se->registerOutputManager(out); + } + //----------------- + // Event processing + //----------------- + if (Enable::DISPLAY) + { + DisplayOn(); + + gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();"); + gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");"); + + cout << "-------------------------------------------------" << endl; + cout << "You are in event display mode. Run one event with" << endl; + cout << "se->run(1)" << endl; + cout << "Run Geant4 command with following examples" << endl; + gROOT->ProcessLine("displaycmd()"); + + return 0; + } + + // if we use a negative number of events we go back to the command line here + if (nEvents < 0) + { + return 0; + } + // if we run the particle generator and use 0 it'll run forever + // for embedding it runs forever if the repeat flag is set + if (nEvents == 0 && !Input::HEPMC && !Input::READHITS && INPUTEMBED::REPEAT) + { + cout << "using 0 for number of events is a bad idea when using particle generators" << endl; + cout << "it will run forever, so I just return without running anything" << endl; + return 0; + } + + se->skip(skip); + se->run(nEvents); + // se->PrintTimer(); + + //----- + // QA output + //----- + + if (Enable::QA) QA_Output(outputroot + "_qa.root"); + + //----- + // Exit + //----- + +// CDBInterface::instance()->Print(); // print used DB files + se->End(); + se->PrintTimer(); + std::cout << "All done" << std::endl; + delete se; + if (Enable::PRODUCTION) + { + Production_MoveOutput(); + } + + gSystem->Exit(0); + return 0; +} +#endif diff --git a/detectors/sPHENIX/G4Setup_sPHENIX.C b/detectors/sPHENIX/G4Setup_sPHENIX.C new file mode 100644 index 000000000..24b5f1795 --- /dev/null +++ b/detectors/sPHENIX/G4Setup_sPHENIX.C @@ -0,0 +1,224 @@ +#ifndef MACRO_G4SETUPSPHENIX_C +#define MACRO_G4SETUPSPHENIX_C + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +R__LOAD_LIBRARY(libg4decayer.so) +R__LOAD_LIBRARY(libg4detectors.so) + +void G4Init() +{ + // Check on invalid combinations + if (Enable::CEMC && Enable::CEMCALBEDO) + { + cout << "Enable::CEMCALBEDO and Enable::CEMC cannot be set simultanously" << endl; + gSystem->Exit(1); + } + // load detector/material macros and execute Init() function + + if (Enable::PIPE) PipeInit(); + if (Enable::MVTX) MvtxInit(); + if (Enable::INTT) InttInit(); + if (Enable::TPC) TPCInit(); + if (Enable::MICROMEGAS) MicromegasInit(); + if (Enable::MBD) MbdInit(); + if (Enable::CEMCALBEDO) CEmcAlbedoInit(); + if (Enable::CEMC) CEmcInit(); + if (Enable::HCALIN) HCalInnerInit(); + if (Enable::MAGNET) MagnetInit(); + MagnetFieldInit(); // We want the field - even if the magnet volume is disabled + if (Enable::HCALOUT) HCalOuterInit(); + if (Enable::PLUGDOOR) PlugDoorInit(); + if (Enable::EPD) EPDInit(); + if (Enable::BEAMLINE) + { + BeamLineInit(); + if (Enable::ZDC) + { + ZDCInit(); + } + } + if (Enable::USER) UserInit(); + if (Enable::BLACKHOLE) BlackHoleInit(); +} + +int G4Setup() +{ + //--------------- + // Fun4All server + //--------------- + + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4Reco *g4Reco = new PHG4Reco(); + g4Reco->set_rapidity_coverage(1.1); // according to drawings + WorldInit(g4Reco); + //PYTHIA 6 + if (G4P6DECAYER::decayType != EDecayType::kAll) + { + g4Reco->set_force_decay(G4P6DECAYER::decayType); + } + //EvtGen + g4Reco->CustomizeEvtGenDecay(EVTGENDECAYER::DecayFile); + + double fieldstrength; + istringstream stringline(G4MAGNET::magfield); + stringline >> fieldstrength; + if (stringline.fail()) + { // conversion to double fails -> we have a string + + if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos || + G4MAGNET::magfield == "CDB") + { + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::Field3DCartesian); + } + else + { + g4Reco->set_field_map(G4MAGNET::magfield, PHFieldConfig::kField2D); + } + } + else + { + g4Reco->set_field(fieldstrength); // use const soleniodal field + } + g4Reco->set_field_rescale(G4MAGNET::magfield_rescale); + +// the radius is an older protection against overlaps, it is not +// clear how well this works nowadays but it doesn't hurt either + double radius = 0.; + + if (Enable::PIPE) radius = Pipe(g4Reco, radius); + if (Enable::MVTX) radius = Mvtx(g4Reco, radius); + if (Enable::INTT) radius = Intt(g4Reco, radius); + if (Enable::TPC) radius = TPC(g4Reco, radius); + if (Enable::MICROMEGAS) Micromegas(g4Reco); + if (Enable::MBD) Mbd(g4Reco); + if (Enable::CEMCALBEDO) CEmcAlbedo(g4Reco); + if (Enable::CEMC) radius = CEmc(g4Reco, radius, 8); + if (Enable::HCALIN) radius = HCalInner(g4Reco, radius, 4); + if (Enable::MAGNET) radius = Magnet(g4Reco, radius); + if (Enable::HCALOUT) radius = HCalOuter(g4Reco, radius, 4); + if (Enable::PLUGDOOR) PlugDoor(g4Reco); + if (Enable::EPD) EPD(g4Reco); + if (Enable::BEAMLINE) + { + BeamLineDefineMagnets(g4Reco); + BeamLineDefineBeamPipe(g4Reco); + if (Enable::ZDC) + { + ZDCSetup(g4Reco); + } + } + if (Enable::USER) UserDetector(g4Reco); + + + //---------------------------------------- + // BLACKHOLE + + if (Enable::BLACKHOLE) BlackHole(g4Reco, radius); + + PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); + g4Reco->registerSubsystem(truth); + + // finally adjust the world size in case the default is too small + WorldSize(g4Reco, radius); + + se->registerSubsystem(g4Reco); + return 0; +} + +void ShowerCompress(int verbosity = 0) +{ + Fun4AllServer *se = Fun4AllServer::instance(); + + PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco"); + compress->AddHitContainer("G4HIT_PIPE"); + compress->AddHitContainer("G4HIT_SVTXSUPPORT"); + compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); + compress->AddHitContainer("G4HIT_CEMC"); + compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); + compress->AddHitContainer("G4HIT_CEMC_SPT"); + compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); + compress->AddHitContainer("G4HIT_HCALIN"); + compress->AddHitContainer("G4HIT_HCALIN_SPT"); + compress->AddHitContainer("G4HIT_MAGNET"); + compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); + compress->AddHitContainer("G4HIT_HCALOUT"); + compress->AddHitContainer("G4HIT_BH_1"); + compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); + compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); + compress->AddHitContainer("G4HIT_BBC"); + compress->AddCellContainer("G4CELL_CEMC"); + compress->AddCellContainer("G4CELL_HCALIN"); + compress->AddCellContainer("G4CELL_HCALOUT"); + compress->AddTowerContainer("TOWER_SIM_CEMC"); + compress->AddTowerContainer("TOWER_RAW_CEMC"); + compress->AddTowerContainer("TOWER_CALIB_CEMC"); + compress->AddTowerContainer("TOWER_SIM_HCALIN"); + compress->AddTowerContainer("TOWER_RAW_HCALIN"); + compress->AddTowerContainer("TOWER_CALIB_HCALIN"); + compress->AddTowerContainer("TOWER_SIM_HCALOUT"); + compress->AddTowerContainer("TOWER_RAW_HCALOUT"); + compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); + se->registerSubsystem(compress); + + return; +} + +void DstCompress(Fun4AllDstOutputManager *out) +{ + if (out) + { + out->StripNode("G4HIT_PIPE"); + out->StripNode("G4HIT_SVTXSUPPORT"); + out->StripNode("G4HIT_CEMC_ELECTRONICS"); + out->StripNode("G4HIT_CEMC"); + out->StripNode("G4HIT_ABSORBER_CEMC"); + out->StripNode("G4HIT_CEMC_SPT"); + out->StripNode("G4HIT_ABSORBER_HCALIN"); + out->StripNode("G4HIT_HCALIN"); + out->StripNode("G4HIT_HCALIN_SPT"); + out->StripNode("G4HIT_MAGNET"); + out->StripNode("G4HIT_ABSORBER_HCALOUT"); + out->StripNode("G4HIT_HCALOUT"); + out->StripNode("G4HIT_BH_1"); + out->StripNode("G4HIT_BH_FORWARD_PLUS"); + out->StripNode("G4HIT_BH_FORWARD_NEG"); + out->StripNode("G4HIT_BBC"); + out->StripNode("G4CELL_CEMC"); + out->StripNode("G4CELL_HCALIN"); + out->StripNode("G4CELL_HCALOUT"); + } +} +#endif diff --git a/detectors/sPHENIX/README.md b/detectors/sPHENIX/README.md new file mode 100644 index 000000000..cde1b7bbb --- /dev/null +++ b/detectors/sPHENIX/README.md @@ -0,0 +1,7 @@ +[//]: # (This section starts with a 2nd level heading and get embedded in the result QA report at https://github.com/sPHENIX-Collaboration/QA-gallery/tree/QA-tracking-low-occupancy) + +## Tracking QA at low occupancy + +Low occupancy tracking QA concists full tracker + reconstruction of events with 20 $\pi^+$, 20 $\pi^-$ and one $\Upsilon(1S) \rightarrow e^+ e^-$. Please note the calorimeters are disabled to improve execution speed, which also removed some of the correlated albedo background for the tracker. + +The source code of the macro can be found at https://github.com/sPHENIX-Collaboration/macros/tree/QA-tracking-low-occupancy or [comparing it to the master branch](https://github.com/sPHENIX-Collaboration/macros/compare/QA-tracking-low-occupancy?expand=1). diff --git a/detectors/sPHENIX/init_gui_vis.mac b/detectors/sPHENIX/init_gui_vis.mac new file mode 100644 index 000000000..8aca21396 --- /dev/null +++ b/detectors/sPHENIX/init_gui_vis.mac @@ -0,0 +1,20 @@ +# Macro file for the initialization of example B3 +# in interactive session +# +# Set some default verbose +# +/control/verbose 2 +/control/saveHistory +/run/verbose 2 +# +# Change the default number of threads (in multi-threaded mode) +#/run/numberOfThreads 4 +# +# Initialize kernel +/run/initialize +# +# create empty scene +# +/vis/scene/create +# open graphics (opengl QT) +/vis/open OGL diff --git a/macros/g4simulations/vis.mac b/detectors/sPHENIX/vis.mac similarity index 96% rename from macros/g4simulations/vis.mac rename to detectors/sPHENIX/vis.mac index a26de7a81..47db266aa 100644 --- a/macros/g4simulations/vis.mac +++ b/detectors/sPHENIX/vis.mac @@ -26,7 +26,9 @@ # machines. You might have to play with it. GEANT prints out a # list of available graphics systems at some point. #/vis/open OGLIX -/vis/open OGLSX 1200x900-0+0 +/vis/open OGL 1200x900-0+0 +# increase display limit for more complex detectors +/vis/ogl/set/displayListLimit 500000 /vis/viewer/set/viewpointThetaPhi 240 -10 /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0 # our world is 4x4 meters, the detector is about 1m across diff --git a/eventcombine/Fun4All_Combiner.C b/eventcombine/Fun4All_Combiner.C new file mode 100644 index 000000000..bff977c54 --- /dev/null +++ b/eventcombine/Fun4All_Combiner.C @@ -0,0 +1,74 @@ +#include +#include +#include +#include +#include +#include + +#include + +//#include +#include + +R__LOAD_LIBRARY(libfun4all.so) +R__LOAD_LIBRARY(libfun4allraw.so) +R__LOAD_LIBRARY(libffarawmodules.so) +//9451 +void Fun4All_Combiner(int nEvents = 0, + const string &input_file00 = "seb00.list", + const string &input_file01 = "seb01.list", + const string &input_file02 = "seb02.list", + const string &input_file03 = "seb03.list", + const string &input_file04 = "seb04.list", + const string &input_file05 = "seb05.list", + const string &input_file06 = "seb06.list", + const string &input_file07 = "seb07.list", + const string &input_file08 = "seb14.list", + const string &input_file09 = "seb18.list", + const string &input_file10 = "hcaleast.list", + const string &input_file11 = "hcalwest.list" +) +{ + vector infile; + infile.push_back(input_file00); + infile.push_back(input_file01); + infile.push_back(input_file02); + infile.push_back(input_file03); + infile.push_back(input_file04); + infile.push_back(input_file05); + infile.push_back(input_file06); + infile.push_back(input_file07); + infile.push_back(input_file08); + infile.push_back(input_file10); + infile.push_back(input_file11); + + Fun4AllServer *se = Fun4AllServer::instance(); + se->Verbosity(1); + Fun4AllPrdfInputPoolManager *in = new Fun4AllPrdfInputPoolManager("Comb"); + in->Verbosity(1); +// this one is the reference with the mbd data + in->AddPrdfInputList(input_file09)->MakeReference(true); + for (auto iter : infile) + { + in->AddPrdfInputList(iter);//->Verbosity(2); + } + + se->registerInputManager(in); + + // EventNumberCheck *evtchk = new EventNumberCheck(); + // evtchk->MyPrdfNode("PRDF"); + // se->registerSubsystem(evtchk); + + Fun4AllEventOutputManager *out = new Fun4AllEventOutputManager("EvtOut","/sphenix/lustre01/sphnxpro/commissioning/aligned_prdf/beam-%08d-%04d.prdf",20000); +// out->DropPacket(21102); + se->registerOutputManager(out); + if (nEvents < 0) + { + return; + } + se->run(nEvents); + in->Print(); + se->End(); + delete se; + gSystem->Exit(0); +} diff --git a/eventcombine/README b/eventcombine/README new file mode 100644 index 000000000..53afd7a63 --- /dev/null +++ b/eventcombine/README @@ -0,0 +1,14 @@ +Run event combiner in condor. Used for runs where all prdf's exist +(MBD, ZDC/sEPD, HCals) and the prdf files are in lustre under +/sphenix/lustre01/sphnxpro/commissioning + +The list of runs to be processed is in runnumbers.txt, the condor bash script +run_eventcombiner.sh creates the list files with the prdf's and runs the Fun4All_Combiner.C macro which reads in those lists. The output filepath is hardcoded in Fun4All_Combiner.C: + + Fun4AllEventOutputManager *out = new Fun4AllEventOutputManager("EvtOut","/sphenix/lustre01/sphnxpro/commissioning/aligned_prdf/beam-%08d-%04d.prdf",20000); + +choose a directory you can write to. The output files will be named +beam-00000-00.prdf. The run number is taken from the input +prdfs, the segment number starts with 0 and is then incremented for each new +output file. The size of the combined prdf files is set by the second parameter, +it is the size in MB after which a new file is opened. diff --git a/eventcombine/condor.job b/eventcombine/condor.job new file mode 100644 index 000000000..3bdd3ba96 --- /dev/null +++ b/eventcombine/condor.job @@ -0,0 +1,15 @@ +Universe = vanilla +Executable = run_eventcombiner.sh +Arguments = $(runnumber) +Output = /sphenix/user/sphnxpro/chp/eventcombine/$(runnumber).out +Error = /sphenix/user/sphnxpro/chp/eventcombine/$(runnumber).err +Log = /tmp/$(runnumber).log +Initialdir = /sphenix/u/sphnxpro/chp/eventcombine/condor +PeriodicHold = (NumJobStarts>=1 && JobStatus == 1) +accounting_group = group_sphenix.mdc2 +accounting_group_user = sphnxpro +Requirements = (CPU_Type == "mdc2") +request_memory = 4096MB +Priority = 99 +job_lease_duration = 3600 +Queue runnumber from runnumbers.txt diff --git a/eventcombine/makelist.sh b/eventcombine/makelist.sh new file mode 100644 index 000000000..763d288db --- /dev/null +++ b/eventcombine/makelist.sh @@ -0,0 +1,12 @@ +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb00-000$1-* > seb00.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb01-000$1-* > seb01.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb02-000$1-* > seb02.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb03-000$1-* > seb03.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb04-000$1-* > seb04.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb05-000$1-* > seb05.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb06-000$1-* > seb06.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/emcal/beam/beam_seb07-000$1-* > seb07.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/ZDC/beam/beam_seb14-000$1-* > seb14.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/mbd/beam/beam_seb18-000$1-* > seb18.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/HCal/beam/beam_East-000$1-* > hcaleast.list +ls -1 /sphenix/lustre01/sphnxpro/commissioning/HCal/beam/beam_West-000$1-* > hcalwest.list diff --git a/eventcombine/run_eventcombiner.sh b/eventcombine/run_eventcombiner.sh new file mode 100755 index 000000000..cf42acf64 --- /dev/null +++ b/eventcombine/run_eventcombiner.sh @@ -0,0 +1,43 @@ +#!/usr/bin/bash + +export USER="$(id -u -n)" +export LOGNAME=${USER} +export HOME=/sphenix/u/${USER} + +hostname + +this_script=$BASH_SOURCE +this_script=`readlink -f $this_script` +this_dir=`dirname $this_script` +echo rsyncing from $this_dir +echo running: $this_script $* + +source /cvmfs/sphenix.sdcc.bnl.gov/gcc-12.1.0/opt/sphenix/core/bin/sphenix_setup.sh -n +#source /cvmfs/sphenix.sdcc.bnl.gov/gcc-12.1.0/opt/sphenix/core/bin/setup_local.sh /sphenix/u/sphnxpro/chp/eventcombine/install + +if [[ ! -z "$_CONDOR_SCRATCH_DIR" && -d $_CONDOR_SCRATCH_DIR ]] +then + cd $_CONDOR_SCRATCH_DIR + rsync -av $this_dir/* . +else + echo condor scratch NOT set + exit -1 +fi + +# arguments +# $1: run number +# $2: hepmc input file +# $3: output file +# $4: no events to skip +# $5: output dir +# $6: runnumber +# $7: sequence + +echo 'here comes your environment' +printenv + +sh makelist.sh $1 + +root.exe -q -b Fun4All_Combiner.C\(0\) + +echo "script done" diff --git a/eventcombine/runnumbers.txt b/eventcombine/runnumbers.txt new file mode 100644 index 000000000..0582de6d4 --- /dev/null +++ b/eventcombine/runnumbers.txt @@ -0,0 +1,154 @@ +21199 +23696 +21739 +21798 +22948 +20869 +20877 +20888 +21665 +21796 +21599 +21615 +21704 +21774 +21776 +21783 +23547 +20864 +21598 +21616 +21626 +21678 +21683 +21772 +21785 +23059 +23724 +20859 +20885 +21748 +21754 +21788 +21793 +23058 +23566 +20867 +20868 +21609 +21681 +21682 +21705 +21707 +21733 +21740 +21745 +21747 +21750 +21770 +21778 +21782 +21792 +23557 +23563 +23572 +23697 +23726 +23745 +23746 +20876 +21200 +22026 +23052 +23053 +23055 +23060 +23550 +23558 +23562 +23582 +23594 +20880 +21560 +21581 +21608 +21679 +21780 +22034 +23543 +23574 +23617 +23671 +23681 +23693 +23694 +23702 +23714 +23735 +21562 +21564 +21568 +21584 +21587 +21594 +21663 +21674 +21703 +21744 +21751 +21769 +22027 +23020 +23049 +23050 +23051 +23536 +23552 +23561 +23568 +23590 +23592 +23618 +23619 +23672 +23676 +23682 +23718 +23723 +23727 +23737 +23743 +24316 +20878 +20883 +21561 +21565 +21567 +21578 +21579 +21580 +21589 +21627 +21709 +21719 +21787 +21795 +22033 +22037 +22046 +22946 +23575 +23604 +23605 +23687 +23690 +23695 +23699 +23721 +23722 +23725 +23728 +23738 +23739 +23740 +23761 diff --git a/macros/g4simulations/Fun4All_G4_EICDetector.C b/macros/g4simulations/Fun4All_G4_EICDetector.C deleted file mode 100644 index 66df27db1..000000000 --- a/macros/g4simulations/Fun4All_G4_EICDetector.C +++ /dev/null @@ -1,616 +0,0 @@ -int Fun4All_G4_EICDetector( - const int nEvents = 1, - const char * inputFile = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", - const char * outputFile = "G4EICDetector.root" - ) -{ - // Set the number of TPC layer - const int n_TPC_layers = 40; // use 60 for backward compatibility only - - //=============== - // Input options - //=============== - - // Either: - // read previously generated g4-hits files, in this case it opens a DST and skips - // the simulations step completely. The G4Setup macro is only loaded to get information - // about the number of layers used for the cell reco code - // - // In case reading production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ - const bool readhits = false; - // Or: - // read files in HepMC format (typically output from event generators like hijing or pythia) - const bool readhepmc = false; // read HepMC files - // Or: - // read files in EICTree format generated by eicsmear package - const bool readeictree = false; - // Or: - // Use Pythia 8 - const bool runpythia8 = false; - // Or: - // Use Pythia 6 - const bool runpythia6 = false; - // Or: - // Use HEPGen - const bool runhepgen = false; - // Or: - // Use Sartre - const bool runsartre = false; - - - - // Besides the above flags. One can further choose to further put in following particles in Geant4 simulation - // Use multi-particle generator (PHG4SimpleEventGenerator), see the code block below to choose particle species and kinematics - const bool particles = false && !readhits; - // or gun/ very simple single particle gun generator - const bool usegun = true && !readhits; - // Throw single Upsilons, may be embedded in Hijing by setting readhepmc flag also (note, careful to set Z vertex equal to Hijing events) - const bool upsilons = false && !readhits; - - //====================== - // What to run - //====================== - - // sPHENIX barrel - bool do_bbc = true; - - bool do_pipe = true; - - bool do_svtx = true; - bool do_svtx_cell = do_svtx && true; - bool do_svtx_track = do_svtx_cell && true; - bool do_svtx_eval = do_svtx_track && true; - - bool do_pstof = false; - - bool do_cemc = true; - bool do_cemc_cell = do_cemc && true; - bool do_cemc_twr = do_cemc_cell && true; - bool do_cemc_cluster = do_cemc_twr && true; - bool do_cemc_eval = do_cemc_cluster && true; - - bool do_hcalin = true; - bool do_hcalin_cell = do_hcalin && true; - bool do_hcalin_twr = do_hcalin_cell && true; - bool do_hcalin_cluster = do_hcalin_twr && true; - bool do_hcalin_eval = do_hcalin_cluster && true; - - bool do_magnet = true; - - bool do_hcalout = true; - bool do_hcalout_cell = do_hcalout && true; - bool do_hcalout_twr = do_hcalout_cell && true; - bool do_hcalout_cluster = do_hcalout_twr && true; - bool do_hcalout_eval = do_hcalout_cluster && true; - - // EICDetector geometry - barrel - bool do_DIRC = true; - - // EICDetector geometry - 'hadron' direction - bool do_FGEM = true; - bool do_FGEM_track = do_FGEM && true; - - bool do_RICH = true; - bool do_Aerogel = true; - - bool do_FEMC = true; - bool do_FEMC_cell = do_FEMC && true; - bool do_FEMC_twr = do_FEMC_cell && true; - bool do_FEMC_cluster = do_FEMC_twr && true; - bool do_FEMC_eval = do_FEMC_cluster && true; - - bool do_FHCAL = true; - bool do_FHCAL_cell = do_FHCAL && true; - bool do_FHCAL_twr = do_FHCAL_cell && true; - bool do_FHCAL_cluster = do_FHCAL_twr && true; - bool do_FHCAL_eval = do_FHCAL_cluster && true; - - // EICDetector geometry - 'electron' direction - bool do_EGEM = true; - bool do_EGEM_track = do_EGEM && true; - - bool do_EEMC = true; - bool do_EEMC_cell = do_EEMC && true; - bool do_EEMC_twr = do_EEMC_cell && true; - bool do_EEMC_cluster = do_EEMC_twr && true; - bool do_EEMC_eval = do_EEMC_cluster && true; - - // Other options - bool do_global = true; - bool do_global_fastsim = false; - - bool do_calotrigger = false && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - bool do_jet_reco = true; - bool do_jet_eval = do_jet_reco && true; - - bool do_fwd_jet_reco = true; - bool do_fwd_jet_eval = do_fwd_jet_reco && true; - - // HI Jet Reco for jet simulations in Au+Au (default is false for - // single particle / p+p simulations, or for Au+Au simulations which - // don't care about jets) - bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - // Compress DST files - bool do_dst_compress = false; - - //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = true; - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); - gSystem->Load("libg4eval.so"); - - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_EICDetector.C"); - G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FGEM,do_EGEM,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel,n_TPC_layers); - - int absorberactive = 0; // set to 1 to make all absorbers active volumes - // const string magfield = "1.5"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const string magfield = "/phenix/upgrades/decadal/fieldmaps/sPHENIX.2d.root"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const float magfield_rescale = 1.4/1.5; // scale the map to a 1.4 T field - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); // uncomment for batch production running with minimal output messages - // se->Verbosity(Fun4AllServer::VERBOSITY_SOME); // uncomment for some info for interactive running - - // just if we set some flags somewhere in this macro - recoConsts *rc = recoConsts::instance(); - // By default every random number generator uses - // PHRandomSeed() which reads /dev/urandom to get its seed - // if the RANDOMSEED flag is set its value is taken as seed - // You can either set this to a random value using PHRandomSeed() - // which will make all seeds identical (not sure what the point of - // this would be: - // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); - // or set it to a fixed value so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //----------------- - // Event generation - //----------------- - - if (readhits) - { - // Get the hits from a file - // The input manager is declared later - } - else if (readhepmc) - { - // this module is needed to read the HepMC records into our G4 sims - // but only if you read HepMC input files - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (readeictree) - { - // this module is needed to read the EICTree style records into our G4 sims - ReadEICFiles *eicr = new ReadEICFiles(); - eicr->OpenInputFile(inputFile); - - se->registerSubsystem(eicr); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - // see coresoftware/generators/PHPythia6 for example config - pythia6->set_config_file("phpythia6_ep.cfg"); - se->registerSubsystem(pythia6); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runhepgen) - { - gSystem->Load("libsHEPGen.so"); - - sHEPGen *hepgen = new sHEPGen(); - // see HEPGen source directory/share/vggdata for required .dat files - // see HEPGen source directory/share/datacards for required datacard files - hepgen->set_datacard_file("hepgen_dvcs.data"); - hepgen->set_momentum_electron(-20); - hepgen->set_momentum_hadron(250); - se->registerSubsystem(hepgen); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runsartre) - { - // see coresoftware/generators/PHSartre/README for setup instructions - // before running: - // setenv SARTRE_DIR /opt/sphenix/core/sartre-1.20_root-5.34.36 - gSystem->Load("libPHSartre.so"); - - PHSartre* mysartre = new PHSartre(); - // see coresoftware/generators/PHSartre for example config - mysartre->set_config_file("sartre.cfg"); - - // particle trigger to enhance forward J/Psi -> ee - PHSartreParticleTrigger* pTrig = new PHSartreParticleTrigger("MySartreTrigger"); - pTrig->AddParticles(-11); - //pTrig->SetEtaHighLow(4.0,1.4); - pTrig->SetEtaHighLow(1.0,-1.1); // central arm - pTrig->PrintConfig(); - mysartre->register_trigger((PHSartreGenTrigger *)pTrig); - se->registerSubsystem(mysartre); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - - // If "readhepMC" is also set, the particles will be embedded in Hijing events - if(particles) - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-",1); // mu+,e+,proton,pi+,Upsilon - //gen->add_particles("pi+",100); // 100 pion option - if (readhepmc) - { - gen->set_reuse_existing_vertex(true); - gen->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); - } - else - { - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_distribution_mean(0.0, 0.0, 0.0); - gen->set_vertex_distribution_width(0.0, 0.0, 0.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-1.0, 1.0); - gen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); - //gen->set_pt_range(0.1, 50.0); - gen->set_pt_range(0.1, 20.0); - gen->Embed(1); - gen->Verbosity(0); - - se->registerSubsystem(gen); - } - if (usegun) - { - // PHG4ParticleGun *gun = new PHG4ParticleGun(); - // gun->set_name("anti_proton"); - // gun->set_name("geantino"); - // gun->set_vtx(0, 0, 0); - // gun->set_mom(10, 0, 0.01); - // gun->AddParticle("geantino",1.7776,-0.4335,0.); - // gun->AddParticle("geantino",1.7709,-0.4598,0.); - // gun->AddParticle("geantino",2.5621,0.60964,0.); - // gun->AddParticle("geantino",1.8121,0.253,0.); - // se->registerSubsystem(gun); - PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); - pgen->set_name("e-"); - pgen->set_z_range(0,0); - pgen->set_eta_range(0.01,0.01); - pgen->set_mom_range(10,10); - pgen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); - se->registerSubsystem(pgen); - } - - // If "readhepMC" is also set, the Upsilons will be embedded in Hijing events, if 'particles" is set, the Upsilons will be embedded in whatever particles are thrown - if(upsilons) - { - // run upsilons for momentum, dca performance, alone or embedded in Hijing - - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - vgen->add_decay_particles("e+","e-",0); // i = decay id - // event vertex - if (readhepmc || particles) - { - vgen->set_reuse_existing_vertex(true); - } - else - { - vgen->set_vtx_zrange(-10.0, +10.0); - } - - // Note: this rapidity range completely fills the acceptance of eta = +/- 1 unit - vgen->set_rapidity_range(-1.0, +1.0); - vgen->set_pt_range(0.0, 10.0); - - int istate = 1; - - if(istate == 1) - { - // Upsilon(1S) - vgen->set_mass(9.46); - vgen->set_width(54.02e-6); - } - else if (istate == 2) - { - // Upsilon(2S) - vgen->set_mass(10.0233); - vgen->set_width(31.98e-6); - } - else - { - // Upsilon(3S) - vgen->set_mass(10.3552); - vgen->set_width(20.32e-6); - } - - vgen->Verbosity(0); - vgen->Embed(2); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe, - do_FGEM,do_EGEM,do_FEMC,do_FHCAL,do_EEMC,do_DIRC,do_RICH,do_Aerogel, - magfield_rescale); - - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - - //------------------ - // Detector Division - //------------------ - - if (do_svtx_cell) Svtx_Cells(); - - if (do_cemc_cell) CEMC_Cells(); - - if (do_hcalin_cell) HCALInner_Cells(); - - if (do_hcalout_cell) HCALOuter_Cells(); - - if (do_FEMC_cell) FEMC_Cells(); - - if (do_FHCAL_cell) FHCAL_Cells(); - - if (do_EEMC_cell) EEMC_Cells(); - - //----------------------------- - // CEMC towering and clustering - //----------------------------- - - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); - - //----------------------------- - // HCAL towering and clustering - //----------------------------- - - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); - - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); - - //----------------------------- - // e, h direction Calorimeter towering and clustering - //----------------------------- - - if (do_FEMC_twr) FEMC_Towers(); - if (do_FEMC_cluster) FEMC_Clusters(); - - if (do_FHCAL_twr) FHCAL_Towers(); - if (do_FHCAL_cluster) FHCAL_Clusters(); - - if (do_EEMC_twr) EEMC_Towers(); - if (do_EEMC_cluster) EEMC_Clusters(); - - if (do_dst_compress) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_svtx_track) Svtx_Reco(); - - //-------------- - // FGEM tracking - //-------------- - - if(do_FGEM_track) FGEM_FastSim_Reco(); - - //-------------- - // EGEM tracking - //-------------- - - if(do_EGEM_track) EGEM_FastSim_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } - - else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } - - //----------------- - // Calo Trigger Simulation - //----------------- - - if (do_calotrigger) - { - gROOT->LoadMacro("G4_CaloTrigger.C"); - CaloTrigger_Sim(); - } - - //--------- - // Jet reco - //--------- - - if (do_jet_reco) - { - gROOT->LoadMacro("G4_Jets.C"); - Jet_Reco(); - } - - if (do_HIjetreco) { - gROOT->LoadMacro("G4_HIJetReco.C"); - HIJetReco(); - } - - if (do_fwd_jet_reco) - { - gROOT->LoadMacro("G4_FwdJets.C"); - Jet_FwdReco(); - } - - //---------------------- - // Simulation evaluation - //---------------------- - - if (do_svtx_eval) Svtx_Eval(string(outputFile) + "_g4svtx_eval.root"); - - if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); - - if (do_hcalin_eval) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); - - if (do_hcalout_eval) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); - - if (do_FEMC_eval) FEMC_Eval(string(outputFile) + "_g4femc_eval.root"); - - if (do_FHCAL_eval) FHCAL_Eval(string(outputFile) + "_g4fhcal_eval.root"); - - if (do_EEMC_eval) EEMC_Eval(string(outputFile) + "_g4eemc_eval.root"); - - if (do_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); - - if (do_fwd_jet_eval) Jet_FwdEval(string(outputFile) + "_g4fwdjet_eval.root"); - - //-------------- - // IO management - //-------------- - - if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } - if (readhepmc) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - } - else - { - // for single particle generators we just need something which drives - // the event loop, the Dummy Input Mgr does just that - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - } - - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - gROOT->LoadMacro("G4_DSTReader_EICDetector.C"); - - G4DSTreader_EICDetector( outputFile, // - /*int*/ absorberactive , - /*bool*/ do_svtx , - /*bool*/ do_cemc , - /*bool*/ do_hcalin , - /*bool*/ do_magnet , - /*bool*/ do_hcalout , - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , - /*bool*/ do_hcalout_twr, - /*bool*/ do_FGEM, - /*bool*/ do_EGEM, - /*bool*/ do_FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ do_FEMC, - /*bool*/ do_FEMC_twr, - /*bool*/ do_EEMC, - /*bool*/ do_EEMC_twr - ); - } - - //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - //if (do_dst_compress) DstCompress(out); - //se->registerOutputManager(out); - - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return; - } - // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !readhepmc) - { - cout << "using 0 for number of events is a bad idea when using particle generators" << endl; - cout << "it will run forever, so I just return without running anything" << endl; - return; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); -} diff --git a/macros/g4simulations/Fun4All_G4_fsPHENIX.C b/macros/g4simulations/Fun4All_G4_fsPHENIX.C deleted file mode 100644 index f87231ce3..000000000 --- a/macros/g4simulations/Fun4All_G4_fsPHENIX.C +++ /dev/null @@ -1,450 +0,0 @@ - -int Fun4All_G4_fsPHENIX( - const int nEvents = 2, - const char * inputFile = "/sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", - const char * outputFile = "G4fsPHENIX.root", - const char * embed_input_file = "/sphenix/sim/sim01/production/2016-07-12/sHijing/spacal2d/G4Hits_sPHENIX_sHijing-0-4.4fm.list" - ) -{ - // Set the number of TPC layer - const int n_TPC_layers = 40; // use 60 for backward compatibility only - - //=============== - // Input options - //=============== - - // Either: - // read previously generated g4-hits files, in this case it opens a DST and skips - // the simulations step completely. The G4Setup macro is only loaded to get information - // about the number of layers used for the cell reco code - const bool readhits = false; - // Or: - // read files in HepMC format (typically output from event generators like hijing or pythia) - const bool readhepmc = false; // read HepMC files - // Or: - // Use particle generator - const bool runpythia8 = false; - const bool runpythia6 = false; - // And - // Further choose to embed newly simulated events to a previous simulation. Not compatible with `readhits = true` - // In case embedding into a production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ - const bool do_embedding = false; - - //====================== - // What to run - //====================== - - bool do_bbc = true; - - bool do_pipe = true; - - bool do_svtx = true; - bool do_svtx_cell = do_svtx && true; - bool do_svtx_track = do_svtx_cell && true; - bool do_svtx_eval = do_svtx_track && false; - - bool do_cemc = true; - bool do_cemc_cell = do_cemc && true; - bool do_cemc_twr = do_cemc_cell && true; - bool do_cemc_cluster = do_cemc_twr && true; - bool do_cemc_eval = do_cemc_cluster && false; - - bool do_hcalin = true; - bool do_hcalin_cell = do_hcalin && true; - bool do_hcalin_twr = do_hcalin_cell && true; - bool do_hcalin_cluster = do_hcalin_twr && true; - bool do_hcalin_eval = do_hcalin_cluster && false; - - bool do_magnet = true; - - bool do_hcalout = true; - bool do_hcalout_cell = do_hcalout && true; - bool do_hcalout_twr = do_hcalout_cell && true; - bool do_hcalout_cluster = do_hcalout_twr && true; - bool do_hcalout_eval = do_hcalout_cluster && false; - - bool do_global = true; - bool do_global_fastsim = false; - - bool do_jet_reco = false; - bool do_jet_eval = do_jet_reco && true; - - bool do_fwd_jet_reco = true; - bool do_fwd_jet_eval = do_fwd_jet_reco && true; - - // fsPHENIX geometry - - bool do_FGEM = true; - bool do_FGEM_track = do_FGEM && true; - - bool do_FEMC = true; - bool do_FEMC_cell = do_FEMC && true; - bool do_FEMC_twr = do_FEMC_cell && true; - bool do_FEMC_cluster = do_FEMC_twr && true; - - bool do_FHCAL = true; - bool do_FHCAL_cell = do_FHCAL && true; - bool do_FHCAL_twr = do_FHCAL_cell && true; - bool do_FHCAL_cluster = do_FHCAL_twr && true; - - bool do_dst_compress = false; - - //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = true; - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); - gSystem->Load("libg4eval.so"); - - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_fsPHENIX.C"); - G4Init(do_svtx,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,do_FGEM,do_FEMC,do_FHCAL,n_TPC_layers); - - int absorberactive = 0; // set to 1 to make all absorbers active volumes - // const string magfield = "1.5"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const string magfield = "/phenix/upgrades/decadal/fieldmaps/fsPHENIX.2d.root"; // fsPHENIX field map by Cesar Luiz da Silva , sPHENIX + piston - const float magfield_rescale = 1.0; // already adjusted to 1.4T central field - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); -// se->Verbosity(0); // uncomment for batch production running with minimal output messages - se->Verbosity(Fun4AllServer::VERBOSITY_SOME); // uncomment for some info for interactive running - // just if we set some flags somewhere in this macro - recoConsts *rc = recoConsts::instance(); - // By default every random number generator uses - // PHRandomSeed() which reads /dev/urandom to get its seed - // if the RANDOMSEED flag is set its value is taken as seed - // You can either set this to a random value using PHRandomSeed() - // which will make all seeds identical (not sure what the point of - // this would be: - // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); - // or set it to a fixed value so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //----------------- - // Event generation - //----------------- - - if (readhits) - { - // Get the hits from a file - // The input manager is declared later - if (do_embedding) - { - cout <<"Do not support read hits and embed background at the same time."<registerSubsystem(hr); - } - else if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); - se->registerSubsystem(pythia6); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - //gen->add_particles("e-",5); // mu+,e+,proton,pi+,Upsilon - //gen->add_particles("e+",5); // mu-,e-,anti_proton,pi- - gen->add_particles("pi-",1); // mu-,e-,anti_proton,pi- - if (readhepmc || do_embedding) { - gen->set_reuse_existing_vertex(true); - gen->set_existing_vertex_offset_vector(0.0,0.0,0.0); - } else { - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_distribution_mean(0.0,0.0,0.0); - gen->set_vertex_distribution_width(0.0,0.0,5.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0,0.0); - gen->set_eta_range(1.4, 3.0); - //gen->set_eta_range(3.0, 3.0); //fsPHENIX FWD - gen->set_phi_range(-1.0*TMath::Pi(), 1.0*TMath::Pi()); - //gen->set_phi_range(TMath::Pi()/2-0.1, TMath::Pi()/2-0.1); - gen->set_p_range(30.0, 30.0); - gen->Embed(1); - gen->Verbosity(0); - se->registerSubsystem(gen); - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, - do_FGEM, do_FEMC, do_FHCAL, - magfield_rescale); - - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - - //------------------ - // Detector Division - //------------------ - - if (do_svtx_cell) Svtx_Cells(); - - if (do_cemc_cell) CEMC_Cells(); - - if (do_hcalin_cell) HCALInner_Cells(); - - if (do_hcalout_cell) HCALOuter_Cells(); - - if (do_FEMC_cell) FEMC_Cells(); - if (do_FHCAL_cell) FHCAL_Cells(); - - //----------------------------- - // CEMC towering and clustering - //----------------------------- - - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); - - //----------------------------- - // HCAL towering and clustering - //----------------------------- - - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); - - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); - - if (do_FEMC_twr) FEMC_Towers(); - if (do_FEMC_cluster) FEMC_Clusters(); - - if (do_FHCAL_twr) FHCAL_Towers(); - if (do_FHCAL_cluster) FHCAL_Clusters(); - - if (do_dst_compress) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_svtx_track) Svtx_Reco(); - - //-------------- - // FGEM tracking - //-------------- - - if(do_FGEM_track) FGEM_FastSim_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } - - else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } - - //--------- - // Jet reco - //--------- - - if (do_jet_reco) - { - gROOT->LoadMacro("G4_Jets.C"); - Jet_Reco(); - } - - if (do_fwd_jet_reco) - { - gROOT->LoadMacro("G4_FwdJets.C"); - Jet_FwdReco(); - } - //---------------------- - // Simulation evaluation - //---------------------- - - if (do_svtx_eval) Svtx_Eval("g4svtx_eval.root"); - - if (do_cemc_eval) CEMC_Eval("g4cemc_eval.root"); - - if (do_hcalin_eval) HCALInner_Eval("g4hcalin_eval.root"); - - if (do_hcalout_eval) HCALOuter_Eval("g4hcalout_eval.root"); - - if (do_jet_eval) Jet_Eval("g4jet_eval.root"); - - if (do_fwd_jet_eval) Jet_FwdEval("g4fwdjet_eval.root"); - - //-------------- - // IO management - //-------------- - - if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } - if (do_embedding) - { - if (embed_input_file == NULL) - { - cout << "Missing embed_input_file! Exit"; - exit(3); - } - - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - // in1->AddFile(embed_input_file); // if one use a single input file - in1->AddListFile(embed_input_file); // RecommendedL: if one use a text list of many input files - se->registerInputManager(in1); - } - if (readhepmc) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - } - else - { - // for single particle generators we just need something which drives - // the event loop, the Dummy Input Mgr does just that - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - } - - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - gROOT->LoadMacro("G4_DSTReader_fsPHENIX.C"); - - G4DSTreader_fsPHENIX( outputFile, // - /*int*/ absorberactive , - /*bool*/ do_svtx , - /*bool*/ do_cemc , - /*bool*/ do_hcalin , - /*bool*/ do_magnet , - /*bool*/ do_hcalout , - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , - /*bool*/ do_hcalout_twr, - /*bool*/ do_FGEM, - /*bool*/ do_FHCAL, - /*bool*/ do_FHCAL_twr, - /*bool*/ do_FEMC, - /*bool*/ do_FEMC_twr - ); - } - - //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - //if (do_dst_compress) DstCompress(out); - //se->registerOutputManager(out); - - if (nEvents == 0 && !readhits && !readhepmc) - { - cout << "using 0 for number of events is a bad idea when using particle generators" << endl; - cout << "it will run forever, so I just return without running anything" << endl; - return; - } - - if (nEvents < 0) - { - PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); - g4->ApplyCommand("/control/execute vis.mac"); - //g4->StartGui(); - se->run(1); - - se->End(); - std::cout << "All done" << std::endl; - - - std::cout << "==== Useful display commands ==" << std::endl; - cout << "draw axis: " << endl; - cout << " G4Cmd(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl; - cout << "zoom" << endl; - cout << " G4Cmd(\"/vis/viewer/zoom 1\")" << endl; - cout << "viewpoint:" << endl; - cout << " G4Cmd(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl; - cout << "panTo:" << endl; - cout << " G4Cmd(\"/vis/viewer/panTo 0 0 cm\")" << endl; - cout << "print to eps:" << endl; - cout << " G4Cmd(\"/vis/ogl/printEPS\")" << endl; - cout << "set background color:" << endl; - cout << " G4Cmd(\"/vis/viewer/set/background white\")" << endl; - std::cout << "===============================" << std::endl; - } - else - { - - se->run(nEvents); - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); - } - -} - - -void -G4Cmd(const char * cmd) -{ - Fun4AllServer *se = Fun4AllServer::instance(); - PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); - g4->ApplyCommand(cmd); -} diff --git a/macros/g4simulations/Fun4All_G4_sPHENIX.C b/macros/g4simulations/Fun4All_G4_sPHENIX.C deleted file mode 100644 index 7d4b221a7..000000000 --- a/macros/g4simulations/Fun4All_G4_sPHENIX.C +++ /dev/null @@ -1,484 +0,0 @@ -int Fun4All_G4_sPHENIX( - const int nEvents = 1, - const char * inputFile = "/sphenix/data/data02/review_2017-08-02/single_particle/spacal2d/fieldmap/G4Hits_sPHENIX_e-_eta0_8GeV-0002.root", - const char * outputFile = "G4sPHENIX.root", - const char * embed_input_file = "/sphenix/data/data02/review_2017-08-02/sHijing/fm_0-4.list" - ) -{ - // Set the number of TPC layer - const int n_TPC_layers = 40; // use 60 for backward compatibility only - - //=============== - // Input options - //=============== - - // Either: - // read previously generated g4-hits files, in this case it opens a DST and skips - // the simulations step completely. The G4Setup macro is only loaded to get information - // about the number of layers used for the cell reco code - // - // In case reading production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/ - const bool readhits = false; - // Or: - // read files in HepMC format (typically output from event generators like hijing or pythia) - const bool readhepmc = false; // read HepMC files - // Or: - // Use pythia - const bool runpythia8 = false; - const bool runpythia6 = false; - // - // **** And **** - // Further choose to embed newly simulated events to a previous simulation. Not compatible with `readhits = true` - // In case embedding into a production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder - // E.g. /sphenix/data/data02/review_2017-08-02/ - const bool do_embedding = false; - - // Besides the above flags. One can further choose to further put in following particles in Geant4 simulation - // Use multi-particle generator (PHG4SimpleEventGenerator), see the code block below to choose particle species and kinematics - const bool particles = true && !readhits; - // or gun/ very simple single particle gun generator - const bool usegun = false && !readhits; - // Throw single Upsilons, may be embedded in Hijing by setting readhepmc flag also (note, careful to set Z vertex equal to Hijing events) - const bool upsilons = false && !readhits; - - //====================== - // What to run - //====================== - - bool do_bbc = true; - - bool do_pipe = true; - - bool do_svtx = true; - bool do_svtx_cell = do_svtx && true; - bool do_svtx_track = do_svtx_cell && true; - bool do_svtx_eval = do_svtx_track && true; - - bool do_pstof = false; - - bool do_cemc = true; - bool do_cemc_cell = do_cemc && true; - bool do_cemc_twr = do_cemc_cell && true; - bool do_cemc_cluster = do_cemc_twr && true; - bool do_cemc_eval = do_cemc_cluster && true; - - - bool do_hcalin = true; - bool do_hcalin_cell = do_hcalin && true; - bool do_hcalin_twr = do_hcalin_cell && true; - bool do_hcalin_cluster = do_hcalin_twr && true; - bool do_hcalin_eval = do_hcalin_cluster && true; - - bool do_magnet = true; - - bool do_hcalout = true; - bool do_hcalout_cell = do_hcalout && true; - bool do_hcalout_twr = do_hcalout_cell && true; - bool do_hcalout_cluster = do_hcalout_twr && true; - bool do_hcalout_eval = do_hcalout_cluster && true; - - bool do_global = true; - bool do_global_fastsim = true; - - bool do_calotrigger = true && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - bool do_jet_reco = true; - bool do_jet_eval = do_jet_reco &&true; - - // HI Jet Reco for jet simulations in Au+Au (default is false for - // single particle / p+p simulations, or for Au+Au simulations which - // don't care about jets) - bool do_HIjetreco = false && do_jet_reco && do_cemc_twr && do_hcalin_twr && do_hcalout_twr; - - bool do_dst_compress = false; - - //Option to convert DST to human command readable TTree for quick poke around the outputs - bool do_DSTReader = false; - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libphhepmc.so"); - gSystem->Load("libg4testbench.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libcemc.so"); - gSystem->Load("libg4eval.so"); - - // establish the geometry and reconstruction setup - gROOT->LoadMacro("G4Setup_sPHENIX.C"); - G4Init(do_svtx,do_pstof,do_cemc,do_hcalin,do_magnet,do_hcalout,do_pipe,n_TPC_layers); - - int absorberactive = 1; // set to 1 to make all absorbers active volumes - // const string magfield = "1.5"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const string magfield = "/phenix/upgrades/decadal/fieldmaps/sPHENIX.2d.root"; // if like float -> solenoidal field in T, if string use as fieldmap name (including path) - const float magfield_rescale = -1.4/1.5; // scale the map to a 1.4 T field - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(0); - // just if we set some flags somewhere in this macro - recoConsts *rc = recoConsts::instance(); - // By default every random number generator uses - // PHRandomSeed() which reads /dev/urandom to get its seed - // if the RANDOMSEED flag is set its value is taken as seed - // You ca neither set this to a random value using PHRandomSeed() - // which will make all seeds identical (not sure what the point of - // this would be: - // rc->set_IntFlag("RANDOMSEED",PHRandomSeed()); - // or set it to a fixed value so you can debug your code - // rc->set_IntFlag("RANDOMSEED", 12345); - - //----------------- - // Event generation - //----------------- - - if (readhits) - { - // Get the hits from a file - // The input manager is declared later - - if (do_embedding) - { - cout <<"Do not support read hits and embed background at the same time."<registerSubsystem(hr); - } - else if (runpythia8) - { - gSystem->Load("libPHPythia8.so"); - - PHPythia8* pythia8 = new PHPythia8(); - // see coresoftware/generators/PHPythia8 for example config - pythia8->set_config_file("phpythia8.cfg"); - se->registerSubsystem(pythia8); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - else if (runpythia6) - { - gSystem->Load("libPHPythia6.so"); - - PHPythia6 *pythia6 = new PHPythia6(); - pythia6->set_config_file("phpythia6.cfg"); - se->registerSubsystem(pythia6); - - HepMCNodeReader *hr = new HepMCNodeReader(); - se->registerSubsystem(hr); - } - - // If "readhepMC" is also set, the particles will be embedded in Hijing events - if(particles) - { - // toss low multiplicity dummy events - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-",2); // mu+,e+,proton,pi+,Upsilon - //gen->add_particles("pi+",100); // 100 pion option - if (readhepmc || do_embedding) - { - gen->set_reuse_existing_vertex(true); - gen->set_existing_vertex_offset_vector(0.0, 0.0, 0.0); - } - else - { - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform, - PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_distribution_mean(0.0, 0.0, 0.0); - gen->set_vertex_distribution_width(0.0, 0.0, 5.0); - } - gen->set_vertex_size_function(PHG4SimpleEventGenerator::Uniform); - gen->set_vertex_size_parameters(0.0, 0.0); - gen->set_eta_range(-1.0, 1.0); - gen->set_phi_range(-1.0 * TMath::Pi(), 1.0 * TMath::Pi()); - //gen->set_pt_range(0.1, 50.0); - gen->set_pt_range(0.1, 20.0); - gen->Embed(1); - gen->Verbosity(0); - - se->registerSubsystem(gen); - } - if (usegun) - { - PHG4ParticleGun *gun = new PHG4ParticleGun(); - // gun->set_name("anti_proton"); - gun->set_name("geantino"); - gun->set_vtx(0, 0, 0); - gun->set_mom(10, 0, 0.01); - // gun->AddParticle("geantino",1.7776,-0.4335,0.); - // gun->AddParticle("geantino",1.7709,-0.4598,0.); - // gun->AddParticle("geantino",2.5621,0.60964,0.); - // gun->AddParticle("geantino",1.8121,0.253,0.); - // se->registerSubsystem(gun); - PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); - pgen->set_name("geantino"); - pgen->set_z_range(0,0); - pgen->set_eta_range(0.01,0.01); - pgen->set_mom_range(10,10); - pgen->set_phi_range(5.3/180.*TMath::Pi(),5.7/180.*TMath::Pi()); - se->registerSubsystem(pgen); - } - - // If "readhepMC" is also set, the Upsilons will be embedded in Hijing events, if 'particles" is set, the Upsilons will be embedded in whatever particles are thrown - if(upsilons) - { - // run upsilons for momentum, dca performance, alone or embedded in Hijing - - PHG4ParticleGeneratorVectorMeson *vgen = new PHG4ParticleGeneratorVectorMeson(); - vgen->add_decay_particles("e+","e-",0); // i = decay id - // event vertex - if (readhepmc || do_embedding || particles) - { - vgen->set_reuse_existing_vertex(true); - } - else - { - vgen->set_vtx_zrange(-10.0, +10.0); - } - - // Note: this rapidity range completely fills the acceptance of eta = +/- 1 unit - vgen->set_rapidity_range(-1.0, +1.0); - vgen->set_pt_range(0.0, 10.0); - - int istate = 1; - - if(istate == 1) - { - // Upsilon(1S) - vgen->set_mass(9.46); - vgen->set_width(54.02e-6); - } - else if (istate == 2) - { - // Upsilon(2S) - vgen->set_mass(10.0233); - vgen->set_width(31.98e-6); - } - else - { - // Upsilon(3S) - vgen->set_mass(10.3552); - vgen->set_width(20.32e-6); - } - - vgen->Verbosity(0); - vgen->Embed(2); - se->registerSubsystem(vgen); - - cout << "Upsilon generator for istate = " << istate << " created and registered " << endl; - } - - if (!readhits) - { - //--------------------- - // Detector description - //--------------------- - - G4Setup(absorberactive, magfield, TPythia6Decayer::kAll, - do_svtx, do_pstof, do_cemc, do_hcalin, do_magnet, do_hcalout, do_pipe, magfield_rescale); - } - - //--------- - // BBC Reco - //--------- - - if (do_bbc) - { - gROOT->LoadMacro("G4_Bbc.C"); - BbcInit(); - Bbc_Reco(); - } - //------------------ - // Detector Division - //------------------ - - if (do_svtx_cell) Svtx_Cells(); - - if (do_cemc_cell) CEMC_Cells(); - - if (do_hcalin_cell) HCALInner_Cells(); - - if (do_hcalout_cell) HCALOuter_Cells(); - - //----------------------------- - // CEMC towering and clustering - //----------------------------- - - if (do_cemc_twr) CEMC_Towers(); - if (do_cemc_cluster) CEMC_Clusters(); - - //----------------------------- - // HCAL towering and clustering - //----------------------------- - - if (do_hcalin_twr) HCALInner_Towers(); - if (do_hcalin_cluster) HCALInner_Clusters(); - - if (do_hcalout_twr) HCALOuter_Towers(); - if (do_hcalout_cluster) HCALOuter_Clusters(); - - if (do_dst_compress) ShowerCompress(); - - //-------------- - // SVTX tracking - //-------------- - - if (do_svtx_track) Svtx_Reco(); - - //----------------- - // Global Vertexing - //----------------- - - if (do_global) - { - gROOT->LoadMacro("G4_Global.C"); - Global_Reco(); - } - - else if (do_global_fastsim) - { - gROOT->LoadMacro("G4_Global.C"); - Global_FastSim(); - } - - //----------------- - // Calo Trigger Simulation - //----------------- - - if (do_calotrigger) - { - gROOT->LoadMacro("G4_CaloTrigger.C"); - CaloTrigger_Sim(); - } - - //--------- - // Jet reco - //--------- - - if (do_jet_reco) - { - gROOT->LoadMacro("G4_Jets.C"); - Jet_Reco(); - } - - if (do_HIjetreco) { - gROOT->LoadMacro("G4_HIJetReco.C"); - HIJetReco(); - } - - //---------------------- - // Simulation evaluation - //---------------------- - - if (do_svtx_eval) Svtx_Eval(string(outputFile) + "_g4svtx_eval.root"); - - if (do_cemc_eval) CEMC_Eval(string(outputFile) + "_g4cemc_eval.root"); - - if (do_hcalin_eval) HCALInner_Eval(string(outputFile) + "_g4hcalin_eval.root"); - - if (do_hcalout_eval) HCALOuter_Eval(string(outputFile) + "_g4hcalout_eval.root"); - - if (do_jet_eval) Jet_Eval(string(outputFile) + "_g4jet_eval.root"); - - //-------------- - // IO management - //-------------- - - if (readhits) - { - // Hits file - Fun4AllInputManager *hitsin = new Fun4AllDstInputManager("DSTin"); - hitsin->fileopen(inputFile); - se->registerInputManager(hitsin); - } - if (do_embedding) - { - if (embed_input_file == NULL) - { - cout << "Missing embed_input_file! Exit"; - exit(3); - } - - Fun4AllDstInputManager *in1 = new Fun4AllNoSyncDstInputManager("DSTinEmbed"); - // in1->AddFile(embed_input_file); // if one use a single input file - in1->AddListFile(embed_input_file); // RecommendedL: if one use a text list of many input files - se->registerInputManager(in1); - } - if (readhepmc) - { - Fun4AllInputManager *in = new Fun4AllHepMCInputManager( "DSTIN"); - se->registerInputManager( in ); - se->fileopen( in->Name().c_str(), inputFile ); - } - else - { - // for single particle generators we just need something which drives - // the event loop, the Dummy Input Mgr does just that - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - } - - if (do_DSTReader) - { - //Convert DST to human command readable TTree for quick poke around the outputs - gROOT->LoadMacro("G4_DSTReader.C"); - - G4DSTreader( outputFile, // - /*int*/ absorberactive , - /*bool*/ do_svtx , - /*bool*/ do_pstof , - /*bool*/ do_cemc , - /*bool*/ do_hcalin , - /*bool*/ do_magnet , - /*bool*/ do_hcalout , - /*bool*/ do_cemc_twr , - /*bool*/ do_hcalin_twr , - /*bool*/ do_magnet , - /*bool*/ do_hcalout_twr - ); - } - - // Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", outputFile); - // if (do_dst_compress) DstCompress(out); - // se->registerOutputManager(out); - - //----------------- - // Event processing - //----------------- - if (nEvents < 0) - { - return; - } - // if we run the particle generator and use 0 it'll run forever - if (nEvents == 0 && !readhits && !readhepmc) - { - cout << "using 0 for number of events is a bad idea when using particle generators" << endl; - cout << "it will run forever, so I just return without running anything" << endl; - return; - } - - se->run(nEvents); - - //----- - // Exit - //----- - - se->End(); - std::cout << "All done" << std::endl; - delete se; - gSystem->Exit(0); -} diff --git a/macros/g4simulations/G4Setup_EICDetector.C b/macros/g4simulations/G4Setup_EICDetector.C deleted file mode 100644 index e6453f717..000000000 --- a/macros/g4simulations/G4Setup_EICDetector.C +++ /dev/null @@ -1,403 +0,0 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -bool overlapcheck = false; // set to true if you want to check for overlaps - -void G4Init(bool do_svtx = true, - bool do_cemc = true, - bool do_hcalin = true, - bool do_magnet = true, - bool do_hcalout = true, - bool do_pipe = true, - bool do_FGEM = true, - bool do_EGEM = true, - bool do_FEMC = true, - bool do_FHCAL = true, - bool do_EEMC = true, - bool do_DIRC = true, - bool do_RICH = true, - bool do_Aerogel = true, - int n_TPC_layers = 40) -{ - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_svtx) - { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); - } - - if (do_cemc) - { - gROOT->LoadMacro("G4_CEmc_Spacal.C"); - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (do_hcalin) - { - gROOT->LoadMacro("G4_HcalIn_ref.C"); - HCalInnerInit(); - } - - if (do_magnet) - { - gROOT->LoadMacro("G4_Magnet.C"); - MagnetInit(); - } - if (do_hcalout) - { - gROOT->LoadMacro("G4_HcalOut_ref.C"); - HCalOuterInit(); - } - - if (do_FGEM) - { - gROOT->LoadMacro("G4_FGEM_fsPHENIX.C"); - FGEM_Init(); - } - - if (do_EGEM) - { - gROOT->LoadMacro("G4_EGEM_EIC.C"); - EGEM_Init(); - } - - if (do_FEMC) - { - gROOT->LoadMacro("G4_FEMC.C"); - FEMCInit(); - } - - if (do_FHCAL) - { - gROOT->LoadMacro("G4_FHCAL.C"); - FHCALInit(); - } - - if (do_EEMC) - { - gROOT->LoadMacro("G4_EEMC.C"); - EEMCInit(); - } - - if (do_DIRC) - { - gROOT->LoadMacro("G4_DIRC.C"); - DIRCInit(); - } - - if (do_RICH) - { - gROOT->LoadMacro("G4_RICH.C"); - RICHInit(); - } - - if (do_Aerogel) - { - gROOT->LoadMacro("G4_Aerogel.C"); - AerogelInit(); - } - - -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, - const bool do_cemc = true, - const bool do_hcalin = true, - const bool do_magnet = true, - const bool do_hcalout = true, - const bool do_pipe = true, - const bool do_FGEM = true, - const bool do_EGEM = true, - const bool do_FEMC = false, - const bool do_FHCAL = false, - const bool do_EEMC = true, - const bool do_DIRC = true, - const bool do_RICH = true, - const bool do_Aerogel = true, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_rapidity_coverage(1.1); // according to drawings -// uncomment to set QGSP_BERT_HP physics list for productions -// (default is QGSP_BERT for speed) - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - - if (decayType != TPythia6Decayer::kAll) { - g4Reco->set_force_decay(decayType); - } - - double fieldstrength; - istringstream stringline(field); - stringline >> fieldstrength; - if (stringline.fail()) { // conversion to double fails -> we have a string - - if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); - } else { - g4Reco->set_field_map(field, 2); - } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field - } - g4Reco->set_field_rescale(magfield_rescale); - - double radius = 0.; - - //---------------------------------------- - // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - - //---------------------------------------- - // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); - - //---------------------------------------- - // CEMC - // - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); - // if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render - - //---------------------------------------- - // HCALIN - - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // MAGNET - - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - - //---------------------------------------- - // HCALOUT - - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // Forward tracking - - if ( do_FGEM ) - FGEMSetup(g4Reco); - - if ( do_EGEM ) - EGEMSetup(g4Reco); - - //---------------------------------------- - // FEMC - - if ( do_FEMC ) - FEMCSetup(g4Reco, absorberactive); - - //---------------------------------------- - // FHCAL - - if ( do_FHCAL ) - FHCALSetup(g4Reco, absorberactive); - - //---------------------------------------- - // EEMC - - if ( do_EEMC ) - EEMCSetup(g4Reco, absorberactive); - - //---------------------------------------- - // PID - - if ( do_DIRC ) - DIRCSetup(g4Reco); - - if ( do_RICH ) - RICHSetup(g4Reco); - - if ( do_Aerogel ) - AerogelSetup(g4Reco); - - // sPHENIX forward flux return(s) - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_int_param("lengthviarapidity",0); - flux_return_plus->set_double_param("length",10.2); - flux_return_plus->set_double_param("radius",2.1); - flux_return_plus->set_double_param("thickness",263.5-5.0); - flux_return_plus->set_double_param("place_z",335.9); - flux_return_plus->set_string_param("material","G4_Fe"); - flux_return_plus->SetActive(false); - flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); - flux_return_plus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_minus->set_int_param("lengthviarapidity",0); - flux_return_minus->set_double_param("length",10.2); - flux_return_minus->set_double_param("radius",90.0); - flux_return_minus->set_double_param("place_z",-335.9); - flux_return_minus->set_double_param("thickness",263.5-5.0 - (90-2.1)); - flux_return_minus->set_string_param("material","G4_Fe"); - flux_return_minus->SetActive(false); - flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); - flux_return_minus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_minus); - - //---------------------------------------- - // BLACKHOLE - - // swallow all particles coming out of the backend of sPHENIX - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); - blackhole->set_double_param("radius",radius + 100); // add 100 cm - - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",g4Reco->GetWorldSizeZ() - no_overlapp); // make it cover the world in length - blackhole->BlackHole(); - blackhole->set_double_param("thickness",0.1); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - //---------------------------------------- - // FORWARD BLACKHOLEs - // +Z - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); - blackhole->SuperDetector("BH_FORWARD_PLUS"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - 0.1 - no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); - blackhole->SuperDetector("BH_FORWARD_NEG"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. +0.1 + no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - se->registerSubsystem( g4Reco ); -} - - -void ShowerCompress(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_SVTXSUPPORT"); - compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); - compress->AddHitContainer("G4HIT_CEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); - compress->AddHitContainer("G4HIT_CEMC_SPT"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN_SPT"); - compress->AddHitContainer("G4HIT_MAGNET"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); - compress->AddHitContainer("G4HIT_HCALOUT"); - compress->AddHitContainer("G4HIT_BH_1"); - compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); - compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); - compress->AddCellContainer("G4CELL_CEMC"); - compress->AddCellContainer("G4CELL_HCALIN"); - compress->AddCellContainer("G4CELL_HCALOUT"); - compress->AddTowerContainer("TOWER_SIM_CEMC"); - compress->AddTowerContainer("TOWER_RAW_CEMC"); - compress->AddTowerContainer("TOWER_CALIB_CEMC"); - compress->AddTowerContainer("TOWER_SIM_HCALIN"); - compress->AddTowerContainer("TOWER_RAW_HCALIN"); - compress->AddTowerContainer("TOWER_CALIB_HCALIN"); - compress->AddTowerContainer("TOWER_SIM_HCALOUT"); - compress->AddTowerContainer("TOWER_RAW_HCALOUT"); - compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); - - compress->AddHitContainer("G4HIT_FEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_FEMC"); - compress->AddHitContainer("G4HIT_FHCAL"); - compress->AddHitContainer("G4HIT_ABSORBER_FHCAL"); - compress->AddCellContainer("G4CELL_FEMC"); - compress->AddCellContainer("G4CELL_FHCAL"); - compress->AddTowerContainer("TOWER_SIM_FEMC"); - compress->AddTowerContainer("TOWER_RAW_FEMC"); - compress->AddTowerContainer("TOWER_CALIB_FEMC"); - compress->AddTowerContainer("TOWER_SIM_FHCAL"); - compress->AddTowerContainer("TOWER_RAW_FHCAL"); - compress->AddTowerContainer("TOWER_CALIB_FHCAL"); - - compress->AddHitContainer("G4HIT_EEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_EEMC"); - compress->AddCellContainer("G4CELL_EEMC"); - compress->AddTowerContainer("TOWER_SIM_EEMC"); - compress->AddTowerContainer("TOWER_RAW_EEMC"); - compress->AddTowerContainer("TOWER_CALIB_EEMC"); - - se->registerSubsystem(compress); - - return; -} - -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { - out->StripNode("G4HIT_PIPE"); - out->StripNode("G4HIT_SVTXSUPPORT"); - out->StripNode("G4HIT_CEMC_ELECTRONICS"); - out->StripNode("G4HIT_CEMC"); - out->StripNode("G4HIT_ABSORBER_CEMC"); - out->StripNode("G4HIT_CEMC_SPT"); - out->StripNode("G4HIT_ABSORBER_HCALIN"); - out->StripNode("G4HIT_HCALIN"); - out->StripNode("G4HIT_HCALIN_SPT"); - out->StripNode("G4HIT_MAGNET"); - out->StripNode("G4HIT_ABSORBER_HCALOUT"); - out->StripNode("G4HIT_HCALOUT"); - out->StripNode("G4HIT_BH_1"); - out->StripNode("G4HIT_BH_FORWARD_PLUS"); - out->StripNode("G4HIT_BH_FORWARD_NEG"); - out->StripNode("G4CELL_CEMC"); - out->StripNode("G4CELL_HCALIN"); - out->StripNode("G4CELL_HCALOUT"); - - out->StripNode("G4HIT_FEMC"); - out->StripNode("G4HIT_ABSORBER_FEMC"); - out->StripNode("G4HIT_FHCAL"); - out->StripNode("G4HIT_ABSORBER_FHCAL"); - out->StripNode("G4CELL_FEMC"); - out->StripNode("G4CELL_FHCAL"); - - out->StripNode("G4HIT_EEMC"); - out->StripNode("G4HIT_ABSORBER_EEMC"); - out->StripNode("G4CELL_EEMC"); - } -} diff --git a/macros/g4simulations/G4Setup_fsPHENIX.C b/macros/g4simulations/G4Setup_fsPHENIX.C deleted file mode 100644 index 751d7286c..000000000 --- a/macros/g4simulations/G4Setup_fsPHENIX.C +++ /dev/null @@ -1,432 +0,0 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -bool overlapcheck = false; // set to true if you want to check for overlaps - -void G4Init(bool do_svtx = true, - bool do_cemc = true, - bool do_hcalin = true, - bool do_magnet = true, - bool do_hcalout = true, - bool do_pipe = true, - bool do_FGEM = true, - bool do_FEMC = true, - bool do_FHCAL = true, - int n_TPC_layers = 40) { - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_svtx) - { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); - } - - if (do_cemc) - { - gROOT->LoadMacro("G4_CEmc_Spacal.C"); - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (do_hcalin) - { - gROOT->LoadMacro("G4_HcalIn_ref.C"); - HCalInnerInit(); - } - - if (do_magnet) - { - gROOT->LoadMacro("G4_Magnet.C"); - MagnetInit(); - } - if (do_hcalout) - { - gROOT->LoadMacro("G4_HcalOut_ref.C"); - HCalOuterInit(); - } - - if (do_FGEM) - { - gROOT->LoadMacro("G4_FGEM_fsPHENIX.C"); - FGEM_Init(); - } - - if (do_FEMC) - { - gROOT->LoadMacro("G4_FEMC.C"); - FEMCInit(); - } - - if (do_FHCAL) - { - gROOT->LoadMacro("G4_FHCAL.C"); - FHCALInit(); - } -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, - const bool do_cemc = true, - const bool do_hcalin = true, - const bool do_magnet = true, - const bool do_hcalout = true, - const bool do_pipe = true, - const bool do_FGEM = true, - const bool do_FEMC = false, - const bool do_FHCAL = false, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->save_DST_geometry(true); //Save geometry from Geant4 to DST - g4Reco->set_rapidity_coverage(1.1); // according to drawings -// uncomment to set QGSP_BERT_HP physics list for productions -// (default is QGSP_BERT for speed) - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - - if (decayType != TPythia6Decayer::kAll) { - g4Reco->set_force_decay(decayType); - } - - double fieldstrength; - istringstream stringline(field); - stringline >> fieldstrength; - if (stringline.fail()) { // conversion to double fails -> we have a string - - if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); - } else { - g4Reco->set_field_map(field, 2); - } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field - } - g4Reco->set_field_rescale(magfield_rescale); - - double radius = 0.; - - //---------------------------------------- - // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - - //---------------------------------------- - // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); - - //---------------------------------------- - // CEMC -// - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); -// if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render - - //---------------------------------------- - // HCALIN - - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // MAGNET - - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - - //---------------------------------------- - // HCALOUT - - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // Forward tracking - - if ( do_FGEM ) - FGEMSetup(g4Reco); - - //---------------------------------------- - // FEMC - - if ( do_FEMC ) - FEMCSetup(g4Reco, absorberactive); - - //---------------------------------------- - // FHCAL - - if ( do_FHCAL ) - FHCALSetup(g4Reco, absorberactive); - - // sPHENIX forward flux return(s) - PHG4CylinderSubsystem *flux_return_plus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_plus->set_int_param("lengthviarapidity",0); - flux_return_plus->set_double_param("length",10.2); - flux_return_plus->set_double_param("radius",2.1); - flux_return_plus->set_double_param("thickness",263.5-5.0); - flux_return_plus->set_double_param("place_z",335.9); - flux_return_plus->set_string_param("material","G4_Fe"); - flux_return_plus->SetActive(false); - flux_return_plus->SuperDetector("FLUXRET_ETA_PLUS"); - flux_return_plus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_plus); - - PHG4CylinderSubsystem *flux_return_minus = new PHG4CylinderSubsystem("FWDFLUXRET", 0); - flux_return_minus->set_int_param("lengthviarapidity",0); - flux_return_minus->set_double_param("length",10.2); - flux_return_minus->set_double_param("radius",2.1); - flux_return_minus->set_double_param("place_z",-335.9); - flux_return_minus->set_double_param("thickness",263.5-5.0); - flux_return_minus->set_string_param("material","G4_Fe"); - flux_return_minus->SetActive(false); - flux_return_minus->SuperDetector("FLUXRET_ETA_MINUS"); - flux_return_minus->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(flux_return_minus); - - //---------------------------------------- - // piston magnet - make_piston("magpiston", g4Reco); - - //---------------------------------------- - // BLACKHOLE - - // swallow all particles coming out of the backend of sPHENIX - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); -blackhole->set_double_param("radius",radius + 10); // add 10 cm - - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",g4Reco->GetWorldSizeZ() - no_overlapp); // make it cover the world in length - blackhole->BlackHole(); - blackhole->set_double_param("thickness",0.1); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - //---------------------------------------- - // FORWARD BLACKHOLEs - // +Z - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); - blackhole->SuperDetector("BH_FORWARD_PLUS"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - 0.1 - no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); - blackhole->SuperDetector("BH_FORWARD_NEG"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. +0.1 + no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - se->registerSubsystem( g4Reco ); -} - - -void ShowerCompress(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_SVTXSUPPORT"); - compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); - compress->AddHitContainer("G4HIT_CEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); - compress->AddHitContainer("G4HIT_CEMC_SPT"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN_SPT"); - compress->AddHitContainer("G4HIT_MAGNET"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); - compress->AddHitContainer("G4HIT_HCALOUT"); - compress->AddHitContainer("G4HIT_BH_1"); - compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); - compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); - compress->AddCellContainer("G4CELL_CEMC"); - compress->AddCellContainer("G4CELL_HCALIN"); - compress->AddCellContainer("G4CELL_HCALOUT"); - compress->AddTowerContainer("TOWER_SIM_CEMC"); - compress->AddTowerContainer("TOWER_RAW_CEMC"); - compress->AddTowerContainer("TOWER_CALIB_CEMC"); - compress->AddTowerContainer("TOWER_SIM_HCALIN"); - compress->AddTowerContainer("TOWER_RAW_HCALIN"); - compress->AddTowerContainer("TOWER_CALIB_HCALIN"); - compress->AddTowerContainer("TOWER_SIM_HCALOUT"); - compress->AddTowerContainer("TOWER_RAW_HCALOUT"); - compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); - - compress->AddHitContainer("G4HIT_FEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_FEMC"); - compress->AddHitContainer("G4HIT_FHCAL"); - compress->AddHitContainer("G4HIT_ABSORBER_FHCAL"); - compress->AddCellContainer("G4CELL_FEMC"); - compress->AddCellContainer("G4CELL_FHCAL"); - compress->AddTowerContainer("TOWER_SIM_FEMC"); - compress->AddTowerContainer("TOWER_RAW_FEMC"); - compress->AddTowerContainer("TOWER_CALIB_FEMC"); - compress->AddTowerContainer("TOWER_SIM_FHCAL"); - compress->AddTowerContainer("TOWER_RAW_FHCAL"); - compress->AddTowerContainer("TOWER_CALIB_FHCAL"); - - se->registerSubsystem(compress); - - return; -} - -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { - out->StripNode("G4HIT_PIPE"); - out->StripNode("G4HIT_SVTXSUPPORT"); - out->StripNode("G4HIT_CEMC_ELECTRONICS"); - out->StripNode("G4HIT_CEMC"); - out->StripNode("G4HIT_ABSORBER_CEMC"); - out->StripNode("G4HIT_CEMC_SPT"); - out->StripNode("G4HIT_ABSORBER_HCALIN"); - out->StripNode("G4HIT_HCALIN"); - out->StripNode("G4HIT_HCALIN_SPT"); - out->StripNode("G4HIT_MAGNET"); - out->StripNode("G4HIT_ABSORBER_HCALOUT"); - out->StripNode("G4HIT_HCALOUT"); - out->StripNode("G4HIT_BH_1"); - out->StripNode("G4HIT_BH_FORWARD_PLUS"); - out->StripNode("G4HIT_BH_FORWARD_NEG"); - out->StripNode("G4CELL_CEMC"); - out->StripNode("G4CELL_HCALIN"); - out->StripNode("G4CELL_HCALOUT"); - - out->StripNode("G4HIT_FEMC"); - out->StripNode("G4HIT_ABSORBER_FEMC"); - out->StripNode("G4HIT_FHCAL"); - out->StripNode("G4HIT_ABSORBER_FHCAL"); - out->StripNode("G4CELL_FEMC"); - out->StripNode("G4CELL_FHCAL"); - } -} - -int -make_piston(string name, PHG4Reco* g4Reco) -{ - double be_pipe_radius = 2.16; // 2.16 cm based on spec sheet - double be_pipe_thickness = 0.0760; // 760 um based on spec sheet - double be_pipe_length = 80.0; // +/- 40 cm - - double al_pipe_radius = 2.16; // same as Be pipe - double al_pipe_thickness = 0.1600; // 1.6 mm based on spec - double al_pipe_length = 88.3; // extension beyond +/- 40 cm - - const double zpos0 = al_pipe_length + be_pipe_length * 0.5; // first large GEM station - const double zpos1 = 305 - 20; // front of forward ECal/MPC - const double zpos2 = 335.9 - 10.2 / 2.; // front of the forward field endcap - const double calorimeter_hole_diamater = 9.92331 *2; // side length of the middle hole of MPC that can hold the piston. Also the max diameter of the piston in that region - - const double beampipe_radius = be_pipe_radius; - - // teeth cone section specific - const double number_of_wteeth = 100; - const double teeth_thickness = 0.3504 * 2; //2 X0 - const double eta_inner = -log(tan(atan((beampipe_radius + 0.1) / zpos0) / 2)); - const double eta_outter = 4.2; - const double eta_teeth_outter = 4.05; - double pos = zpos0 + (zpos1 - zpos0) / 2; -// cout << "MAGNETIC PISTON:" << eta_inner << " " << eta_outter << " " << pos -// << endl; - - PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem("Piston", 0); - magpiston->SetZlength((zpos1 - zpos0) / 2); - magpiston->SetPlaceZ((zpos1 + zpos0) / 2); - magpiston->SetR1(beampipe_radius, - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter)) * zpos0); - magpiston->SetR2(beampipe_radius, - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter)) * zpos1); - magpiston->SetMaterial("G4_Fe"); - magpiston->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(magpiston); - -// PHG4ConeSubsystem *magpiston = new PHG4ConeSubsystem(name.c_str(), 1); -// magpiston->SetZlength((zpos1 - zpos0) / 2); -// magpiston->SetPlaceZ(pos); -// magpiston->Set_eta_range(eta_outter, eta_inner); -// magpiston->SetMaterial("G4_Fe"); -// magpiston->SuperDetector(name.c_str()); -// magpiston->SetActive(false); -// g4Reco->registerSubsystem(magpiston); - - pos = zpos0 + 1.0 + teeth_thickness / 2; - for (int i = 0; i < number_of_wteeth; i++) - { - stringstream s; - s << name; - s << "_teeth_"; - s << i; - - magpiston = new PHG4ConeSubsystem(s.str(), i); - magpiston->SuperDetector(name); - magpiston->SetZlength(teeth_thickness / 2); - magpiston->SetPlaceZ(pos); - magpiston->SetR1( - // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter - .01)) - * (pos - teeth_thickness / 2), // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_teeth_outter)) - * (pos - teeth_thickness / 2) // - ); - magpiston->SetR2( - // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter - .01)) - * (pos + teeth_thickness / 2), // - tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(eta_outter - .01)) - * (pos + teeth_thickness / 2) + .1 // - ); - magpiston->SetMaterial("G4_W"); - magpiston->SuperDetector(name.c_str()); - magpiston->SetActive(false); - magpiston->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(magpiston); - pos += ((zpos1 - zpos0 - 10) / number_of_wteeth); - } - - // last piece connect to the field return - PHG4CylinderSubsystem *magpiston2 = new PHG4CylinderSubsystem("Piston_EndSection", 0); - magpiston2->set_int_param("lengthviarapidity",0); - magpiston2->set_double_param("length",zpos2 - zpos1); - magpiston2->set_double_param("place_z", (zpos2 + zpos1) / 2.); - magpiston2->set_double_param("radius",beampipe_radius); - magpiston2->set_double_param("thickness",calorimeter_hole_diamater / 2. - beampipe_radius); - magpiston2->set_string_param("material","G4_Fe"); - magpiston2->SuperDetector(name); - magpiston2->SetActive(false); - magpiston2->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(magpiston2); - - return 0; -} - diff --git a/macros/g4simulations/G4Setup_sPHENIX.C b/macros/g4simulations/G4Setup_sPHENIX.C deleted file mode 100644 index 2bd56db20..000000000 --- a/macros/g4simulations/G4Setup_sPHENIX.C +++ /dev/null @@ -1,253 +0,0 @@ - -double no_overlapp = 0.0001; // added to radii to avoid overlapping volumes -bool overlapcheck = false; // set to true if you want to check for overlaps - -void G4Init(bool do_svtx = true, - bool do_pstof = true, - bool do_cemc = true, - bool do_hcalin = true, - bool do_magnet = true, - bool do_hcalout = true, - bool do_pipe = true, - int n_TPC_layers = 40) - { - - // load detector/material macros and execute Init() function - - if (do_pipe) - { - gROOT->LoadMacro("G4_Pipe.C"); - PipeInit(); - } - if (do_svtx) - { - gROOT->LoadMacro("G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C"); - SvtxInit(n_TPC_layers); - } - - if (do_pstof) - { - gROOT->LoadMacro("G4_PSTOF.C"); - PSTOFInit(); - } - - if (do_cemc) - { - gROOT->LoadMacro("G4_CEmc_Spacal.C"); - CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations - } - - if (do_hcalin) - { - gROOT->LoadMacro("G4_HcalIn_ref.C"); - HCalInnerInit(); - } - - if (do_magnet) - { - gROOT->LoadMacro("G4_Magnet.C"); - MagnetInit(); - } - if (do_hcalout) - { - gROOT->LoadMacro("G4_HcalOut_ref.C"); - HCalOuterInit(); - } - -} - - -int G4Setup(const int absorberactive = 0, - const string &field ="1.5", - const EDecayType decayType = TPythia6Decayer::kAll, - const bool do_svtx = true, - const bool do_pstof = true, - const bool do_cemc = true, - const bool do_hcalin = true, - const bool do_magnet = true, - const bool do_hcalout = true, - const bool do_pipe = true, - const float magfield_rescale = 1.0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_rapidity_coverage(1.1); // according to drawings -// uncomment to set QGSP_BERT_HP physics list for productions -// (default is QGSP_BERT for speed) - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); - if (decayType != TPythia6Decayer::kAll) { - g4Reco->set_force_decay(decayType); - } - - double fieldstrength; - istringstream stringline(field); - stringline >> fieldstrength; - if (stringline.fail()) { // conversion to double fails -> we have a string - - if (field.find("sPHENIX.root") != string::npos) { - g4Reco->set_field_map(field, 1); - } else { - g4Reco->set_field_map(field, 2); - } - } else { - g4Reco->set_field(fieldstrength); // use const soleniodal field - } - g4Reco->set_field_rescale(magfield_rescale); - - double radius = 0.; - - //---------------------------------------- - // PIPE - if (do_pipe) radius = Pipe(g4Reco, radius, absorberactive); - - //---------------------------------------- - // SVTX - if (do_svtx) radius = Svtx(g4Reco, radius, absorberactive); - - //---------------------------------------- - // PSTOF - - if (do_pstof) radius = PSTOF(g4Reco, radius, absorberactive); - - //---------------------------------------- - // CEMC -// - if (do_cemc) radius = CEmc(g4Reco, radius, 8, absorberactive); -// if (do_cemc) radius = CEmc_Vis(g4Reco, radius, 8, absorberactive);// for visualization substructure of SPACAL, slow to render - - //---------------------------------------- - // HCALIN - - if (do_hcalin) radius = HCalInner(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // MAGNET - - if (do_magnet) radius = Magnet(g4Reco, radius, 0, absorberactive); - - //---------------------------------------- - // HCALOUT - - if (do_hcalout) radius = HCalOuter(g4Reco, radius, 4, absorberactive); - - //---------------------------------------- - // BLACKHOLE - - // swallow all particles coming out of the backend of sPHENIX - PHG4CylinderSubsystem *blackhole = new PHG4CylinderSubsystem("BH", 1); -blackhole->set_double_param("radius",radius + 10); // add 10 cm - - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",g4Reco->GetWorldSizeZ() - no_overlapp); // make it cover the world in length - blackhole->BlackHole(); - blackhole->set_double_param("thickness",0.1); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - //---------------------------------------- - // FORWARD BLACKHOLEs - // +Z - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_PLUS", 1); - blackhole->SuperDetector("BH_FORWARD_PLUS"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z",g4Reco->GetWorldSizeZ()/2. - 0.1 - no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - blackhole = new PHG4CylinderSubsystem("BH_FORWARD_NEG", 1); - blackhole->SuperDetector("BH_FORWARD_NEG"); - blackhole->set_double_param("radius",0); // add 10 cm - blackhole->set_int_param("lengthviarapidity",0); - blackhole->set_double_param("length",0.1); // make it cover the world in length - blackhole->set_double_param("place_z", - g4Reco->GetWorldSizeZ()/2. +0.1 + no_overlapp); - blackhole->BlackHole(); - blackhole->set_double_param("thickness",radius - no_overlapp); // it needs some thickness - blackhole->SetActive(); // always see what leaks out - blackhole->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(blackhole); - - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - se->registerSubsystem( g4Reco ); -} - -void ShowerCompress(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4DstCompressReco* compress = new PHG4DstCompressReco("PHG4DstCompressReco"); - compress->AddHitContainer("G4HIT_PIPE"); - compress->AddHitContainer("G4HIT_SVTXSUPPORT"); - compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS"); - compress->AddHitContainer("G4HIT_CEMC"); - compress->AddHitContainer("G4HIT_ABSORBER_CEMC"); - compress->AddHitContainer("G4HIT_CEMC_SPT"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN"); - compress->AddHitContainer("G4HIT_HCALIN_SPT"); - compress->AddHitContainer("G4HIT_MAGNET"); - compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT"); - compress->AddHitContainer("G4HIT_HCALOUT"); - compress->AddHitContainer("G4HIT_BH_1"); - compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS"); - compress->AddHitContainer("G4HIT_BH_FORWARD_NEG"); - compress->AddCellContainer("G4CELL_CEMC"); - compress->AddCellContainer("G4CELL_HCALIN"); - compress->AddCellContainer("G4CELL_HCALOUT"); - compress->AddTowerContainer("TOWER_SIM_CEMC"); - compress->AddTowerContainer("TOWER_RAW_CEMC"); - compress->AddTowerContainer("TOWER_CALIB_CEMC"); - compress->AddTowerContainer("TOWER_SIM_HCALIN"); - compress->AddTowerContainer("TOWER_RAW_HCALIN"); - compress->AddTowerContainer("TOWER_CALIB_HCALIN"); - compress->AddTowerContainer("TOWER_SIM_HCALOUT"); - compress->AddTowerContainer("TOWER_RAW_HCALOUT"); - compress->AddTowerContainer("TOWER_CALIB_HCALOUT"); - se->registerSubsystem(compress); - - return; -} - -void DstCompress(Fun4AllDstOutputManager* out) { - if (out) { - out->StripNode("G4HIT_PIPE"); - out->StripNode("G4HIT_SVTXSUPPORT"); - out->StripNode("G4HIT_CEMC_ELECTRONICS"); - out->StripNode("G4HIT_CEMC"); - out->StripNode("G4HIT_ABSORBER_CEMC"); - out->StripNode("G4HIT_CEMC_SPT"); - out->StripNode("G4HIT_ABSORBER_HCALIN"); - out->StripNode("G4HIT_HCALIN"); - out->StripNode("G4HIT_HCALIN_SPT"); - out->StripNode("G4HIT_MAGNET"); - out->StripNode("G4HIT_ABSORBER_HCALOUT"); - out->StripNode("G4HIT_HCALOUT"); - out->StripNode("G4HIT_BH_1"); - out->StripNode("G4HIT_BH_FORWARD_PLUS"); - out->StripNode("G4HIT_BH_FORWARD_NEG"); - out->StripNode("G4CELL_CEMC"); - out->StripNode("G4CELL_HCALIN"); - out->StripNode("G4CELL_HCALOUT"); - } -} diff --git a/macros/g4simulations/G4_Aerogel.C b/macros/g4simulations/G4_Aerogel.C deleted file mode 100644 index c56b45d2c..000000000 --- a/macros/g4simulations/G4_Aerogel.C +++ /dev/null @@ -1,51 +0,0 @@ -// $Id: G4_Aerogel.C,v 1.2 2013/10/09 01:08:17 jinhuang Exp $ - -/*! - * \file G4_Aerogel.C - * \brief Aerogel RICH for EIC detector - * \author Jin Huang - * \version $Revision: 1.2 $ - * \date $Date: 2013/10/09 01:08:17 $ - */ - -void -AerogelInit() -{ - -} - -void -AerogelSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.1 // 1.45 - ) -{ - - PHG4SectorSubsystem *ag; - ag = new PHG4SectorSubsystem("Aerogel"); - - ag->get_geometry().set_normal_polar_angle( - (PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) - + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)) / 2); -// ag->get_geometry().set_normal_polar_angle(0); - ag->get_geometry().set_normal_start( - 280 * PHG4Sector::Sector_Geometry::Unit_cm()); // 307 - ag->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(1.9)); - ag->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); - ag->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - ag->get_geometry().set_material("G4_AIR"); - ag->get_geometry().set_N_Sector(N_Sector); - ag->OverlapCheck(overlapcheck); - - // Aerogel dimensions ins cm - double radiator_length = 2.; - double expansion_length = 10.; - - ag->get_geometry().AddLayers_AeroGel_ePHENIX( radiator_length * PHG4Sector::Sector_Geometry::Unit_cm(), - expansion_length * PHG4Sector::Sector_Geometry::Unit_cm() ); - g4Reco->registerSubsystem(ag); - -} - diff --git a/macros/g4simulations/G4_Bbc.C b/macros/g4simulations/G4_Bbc.C deleted file mode 100644 index c3012a589..000000000 --- a/macros/g4simulations/G4_Bbc.C +++ /dev/null @@ -1,36 +0,0 @@ - -void BbcInit() {} - -double Bbc(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) { - - // the BBC is a fast sim only at the moment - // this is a place holder for the G4 material setup - - return radius; -} - -void Bbc_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4bbc.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - BbcVertexFastSimReco* bbcvertex = new BbcVertexFastSimReco(); - bbcvertex->set_z_smearing(0.0); // 6 mm, temporarily perfect for TPC initial vertexing - bbcvertex->set_t_smearing(0.002); // 20 ps - se->registerSubsystem(bbcvertex); - - return; -} diff --git a/macros/g4simulations/G4_CEmc_Spacal.C b/macros/g4simulations/G4_CEmc_Spacal.C deleted file mode 100644 index 412b7de72..000000000 --- a/macros/g4simulations/G4_CEmc_Spacal.C +++ /dev/null @@ -1,399 +0,0 @@ - -int Min_cemc_layer = 1; -int Max_cemc_layer = 1; - -// set a default value for SPACAL configuration -// // 1D azimuthal projective SPACAL (fast) -//int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal; -// 2D azimuthal projective SPACAL (slow) -int Cemc_spacal_configuration = PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal; - -#include - -// just a dummy parameter used by the tilted plate geom -void CEmcInit(const int nslats = 1) -{ - Min_cemc_layer = 1; - Max_cemc_layer = 1; -} - -//! EMCal main setup macro -double -CEmc(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0) -{ - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - return CEmc_1DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ - crossings, /*const int*/ absorberactive); - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - return CEmc_2DProjectiveSpacal(/*PHG4Reco**/ g4Reco, /*double*/ radius, /*const int */ - crossings, /*const int*/ absorberactive); - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return 0; - } -} - -//! EMCal setup macro - 1D azimuthal projective SPACAL -double -CEmc_1DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, const int absorberactive = 0) -{ - double emc_inner_radius = 95.; // emc inner radius from engineering drawing - double cemcthickness = 12.7; - double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius - - if (radius > emc_inner_radius) - { - cout << "inconsistency: pstof outer radius: " << radius - << " larger than emc inner radius: " << emc_inner_radius - << endl; - gSystem->Exit(-1); - } - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // boundary check - if (radius > emc_inner_radius - 1.5 - no_overlapp) - { - cout << "G4_CEmc_Spacal.C::CEmc() - expect radius < " << emc_inner_radius - 1.5 - no_overlapp << " to install SPACAL" << endl; - exit(1); - } - radius = emc_inner_radius - 1.5 - no_overlapp; - - // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); - cyl->SuperDetector("CEMC_ELECTRONICS"); - cyl->set_double_param("radius", radius); - cyl->set_string_param("material", "G4_TEFLON"); - cyl->set_double_param("thickness", 1.5); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius += 1.5; - radius += no_overlapp; - - int ilayer = Min_cemc_layer; - PHG4SpacalSubsystem *cemc; - cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - cemc->set_double_param("radius",emc_inner_radius); - cemc->set_double_param("thickness", cemcthickness); - - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - if (absorberactive) cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cemc); - - if (ilayer > Max_cemc_layer) - { - cout << "layer discrepancy, current layer " << ilayer - << " max cemc layer: " << Max_cemc_layer << endl; - } - - radius += cemcthickness; - radius += no_overlapp; - - // 0.5cm thick Stainless Steel as an approximation for EMCAl support system - cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); - cyl->SuperDetector("CEMC_SPT"); - cyl->set_double_param("radius", radius); - cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel - cyl->set_double_param("thickness", 0.5); - if (absorberactive) - cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius += 0.5; - radius += no_overlapp; - - return radius; -} - -//! 2D full projective SPACAL -double -CEmc_2DProjectiveSpacal(PHG4Reco *g4Reco, double radius, const int crossings, - const int absorberactive = 0) -{ - double emc_inner_radius = 92; // emc inner radius from engineering drawing - double cemcthickness = 24.00000 - no_overlapp; - - //max radius is 116 cm; - double emc_outer_radius = emc_inner_radius + cemcthickness; // outer radius - assert(emc_outer_radius < 116); - - if (radius > emc_inner_radius) - { - cout << "inconsistency: preshower radius+thickness: " << radius - << " larger than emc inner radius: " << emc_inner_radius << endl; - gSystem->Exit(-1); - } - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - - // the radii are only to determined the thickness of the cemc - radius = emc_inner_radius; - - //--------------- - // Load libraries - //--------------- - - // 1.5cm thick teflon as an approximation for EMCAl light collection + electronics (10% X0 total estimated) - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("CEMC_ELECTRONICS", 0); - cyl->set_double_param("radius", radius); - cyl->set_string_param("material", "G4_TEFLON"); - cyl->set_double_param("thickness", 1.5 - no_overlapp); - cyl->SuperDetector("CEMC_ELECTRONICS"); - cyl->OverlapCheck(overlapcheck); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - radius += 1.5; - cemcthickness -= 1.5 + no_overlapp; - - // 0.5cm thick Stainless Steel as an approximation for EMCAl support system - cyl = new PHG4CylinderSubsystem("CEMC_SPT", 0); - cyl->SuperDetector("CEMC_SPT"); - cyl->set_double_param("radius", radius + cemcthickness - 0.5); - cyl->set_string_param("material", "SS310"); // SS310 Stainless Steel - cyl->set_double_param("thickness", 0.5 - no_overlapp); - cyl->OverlapCheck(overlapcheck); - if (absorberactive) - cyl->SetActive(); - g4Reco->registerSubsystem(cyl); - - cemcthickness -= 0.5 + no_overlapp; - - //--------------- - // Load libraries - //--------------- - - int ilayer = 0; - PHG4SpacalSubsystem *cemc; - - const bool use_2015_design = false; - if (use_2015_design) - { - cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - - cemc->set_int_param("config", PHG4CylinderGeom_Spacalv1::kFullProjective_2DTaper_SameLengthFiberPerTower); - cemc->set_double_param("radius", radius); // overwrite minimal radius - cemc->set_double_param("thickness", cemcthickness); // overwrite thickness - cemc->set_int_param("azimuthal_n_sec", 32); - // cemc->set_int_param("construction_verbose", 2); - - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - if (absorberactive) - cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); - } - - else - { - cemc = new PHG4SpacalSubsystem("CEMC", ilayer); - - cemc->set_int_param("virualize_fiber", 0); - cemc->set_int_param("azimuthal_seg_visible", 1); - cemc->set_int_param("construction_verbose", 0); - cemc->Verbosity(0); - - cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); - cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/CEMC/Geometry_2017ProjTilted/")); - cemc->set_double_param("radius", radius); // overwrite minimal radius - cemc->set_double_param("thickness", cemcthickness); // overwrite thickness - - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - if (absorberactive) - cemc->SetAbsorberActive(); - cemc->OverlapCheck(overlapcheck); - } - - g4Reco->registerSubsystem(cemc); - - if (ilayer > Max_cemc_layer) - { - cout << "layer discrepancy, current layer " << ilayer - << " max cemc layer: " << Max_cemc_layer << endl; - } - - radius += cemcthickness; - radius += no_overlapp; - - return radius; -} - -void CEMC_Cells(int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - PHG4CylinderCellReco *cemc_cells = new PHG4CylinderCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->Verbosity(verbosity); - for (int i = Min_cemc_layer; i <= Max_cemc_layer; i++) - { - // cemc_cells->etaphisize(i, 0.024, 0.024); - const double radius = 95; - cemc_cells->cellsize(i, 2 * TMath::Pi() / 256. * radius, 2 * TMath::Pi() / 256. * radius); - cemc_cells->set_double_param(i, "tmin", 0.); - cemc_cells->set_double_param(i, "tmax", 60.); - } - se->registerSubsystem(cemc_cells); - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->Verbosity(verbosity); - cemc_cells->set_timing_window(0.0, 60.0); - cemc_cells->get_light_collection_model().load_data_file( - string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype3Module.xml"), - "data_grid_light_guide_efficiency", "data_grid_fiber_trans"); - se->registerSubsystem(cemc_cells); - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEmc - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return; - } - - return; -} - -void CEMC_Towers(int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - TowerBuilder->Detector("CEMC"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - TowerBuilder->Verbosity(verbosity); - se->registerSubsystem(TowerBuilder); - - double sampling_fraction = 1; - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - sampling_fraction = 0.0234335; //from production:/gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal1d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - // sampling_fraction = 0.02244; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.3/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root -// sampling_fraction = 2.36081e-02; //from production: /gpfs02/phenix/prod/sPHENIX/preCDR/pro.1-beta.5/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_e-_eta0_8GeV.root -// sampling_fraction = 1.90951e-02; // 2017 Tilt porjective SPACAL, 8 GeV photon, eta = 0.3 - 0.4 - sampling_fraction = 2e-02; // 2017 Tilt porjective SPACAL, tower-by-tower calibration - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return; - } - - static const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizer"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->Verbosity(verbosity); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(8); // eRD1 test beam setting - TowerDigitizer->set_photonelec_ADC(1); //not simulating ADC discretization error - TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(16); // eRD1 test beam setting - se->registerSubsystem(TowerDigitizer); - - if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k1DProjectiveSpacal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->Verbosity(verbosity); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration); - } - else if (Cemc_spacal_configuration == PHG4CylinderGeom_Spacalv1::k2DProjectiveSpacal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibration"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->Verbosity(verbosity); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kTower_by_tower_calibration); - TowerCalibration->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/CEMC/TowerCalib_2017ProjTilted/")); // calibration database - TowerCalibration->set_calib_const_GeV_ADC(1. / photoelectron_per_GeV / 0.9715 ); // overall energy scale based on 4-GeV photon simulations - TowerCalibration->set_pedstal_ADC(0); - se->registerSubsystem(TowerCalibration); - } - else - { - std::cout - << "G4_CEmc_Spacal.C::CEMC_Towers - Fatal Error - unrecognized SPACAL configuration #" - << Cemc_spacal_configuration << ". Force exiting..." << std::endl; - exit(-1); - return; - } - - return; -} - -void CEMC_Clusters(int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilder *ClusterBuilder = new RawClusterBuilder("EmcRawClusterBuilder"); - ClusterBuilder->Detector("CEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem(ClusterBuilder); - - RawClusterPositionCorrection *clusterCorrection = new RawClusterPositionCorrection("CEMC"); - clusterCorrection->GetCalibrationParameters().ReadFromFile("CEMC_RECALIB","xml",0,0, - //raw location - string(getenv("CALIBRATIONROOT"))+string("/CEMC/PositionRecalibration/")); - clusterCorrection->Verbosity(verbosity); - se->registerSubsystem(clusterCorrection); - - return; -} -void CEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("CEMCEVALUATOR", "CEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_CaloTrigger.C b/macros/g4simulations/G4_CaloTrigger.C deleted file mode 100644 index d23bd0616..000000000 --- a/macros/g4simulations/G4_CaloTrigger.C +++ /dev/null @@ -1,22 +0,0 @@ - -void CaloTrigger_Sim(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libcalotrigger.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloTriggerSim* calotriggersim = new CaloTriggerSim(); - calotriggersim->Verbosity( verbosity ); - se->registerSubsystem( calotriggersim ); - - return; - -} diff --git a/macros/g4simulations/G4_DIRC.C b/macros/g4simulations/G4_DIRC.C deleted file mode 100644 index 032e4fae9..000000000 --- a/macros/g4simulations/G4_DIRC.C +++ /dev/null @@ -1,88 +0,0 @@ -// $Id: G4_DIRC.C,v 1.3 2013/10/09 01:08:17 jinhuang Exp $ - -/*! - * \file G4_DIRC.C - * \brief Macro setting up the barrel DIRC - * \author Jin Huang - * \version $Revision: 1.3 $ - * \date $Date: 2013/10/09 01:08:17 $ - */ - -#include - -void -DIRCInit() -{ - -} - -//! Babar DIRC (Without most of support structure) -//! Ref: I. Adam et al. The DIRC particle identification system for the BaBar experiment. -//! Nucl. Instrum. Meth., A538:281-357, 2005. doi:10.1016/j.nima.2004.08.129. -double -DIRCSetup(PHG4Reco* g4Reco) -{ - const double radiator_R = 83.65; - const double length = 470; - const double z_shift = -115; - const double z_start = z_shift + length / 2.; - const double z_end = z_shift - length / 2.; - - PHG4SectorSubsystem *dirc; - dirc = new PHG4SectorSubsystem("DIRC"); - dirc->get_geometry().set_normal_polar_angle(3.14159265358979323846/2); - dirc->get_geometry().set_normal_start( - 83.65 * PHG4Sector::Sector_Geometry::Unit_cm()); - dirc->get_geometry().set_min_polar_angle(atan2(radiator_R, z_start)); - dirc->get_geometry().set_max_polar_angle(atan2(radiator_R, z_end)); - dirc->get_geometry().set_min_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); - dirc->get_geometry().set_max_polar_edge(PHG4Sector::Sector_Geometry::FlatEdge()); - dirc->get_geometry().set_material("Quartz"); - dirc->get_geometry().set_N_Sector(12); - dirc->OverlapCheck(overlapcheck); - dirc->get_geometry().AddLayer("Radiator", "Quartz", - 1.7 * PHG4Sector::Sector_Geometry::Unit_cm(), true); - g4Reco->registerSubsystem(dirc); - - PHG4CylinderSubsystem *cyl; - - // The cylinder skins provide most of the strength - // and stiffness of the CST. The thickness of the inner - // and outer skins is 1.27 and 0.76 mm, respectively - - // Inner skin: - cyl = new PHG4CylinderSubsystem("DIRC_CST_Inner_Skin", 10); - cyl->set_double_param("radius",81.71); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",0.127); - cyl->set_double_param("place_x",0.); - cyl->set_double_param("place_y",0.); - cyl->set_double_param("place_z",z_shift); - cyl->SetActive(0); - cyl->SuperDetector("DIRC"); - cyl->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cyl); - - // Outer skin: - cyl = new PHG4CylinderSubsystem("DIRC_CST_Outer_Skin", 11); - cyl->set_double_param("radius",89.25 - 0.076); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",0.076); - cyl->set_double_param("place_x",0.); - cyl->set_double_param("place_y",0.); - cyl->set_double_param("place_z",z_shift); - cyl->SetActive(0); - cyl->SuperDetector("DIRC"); - cyl->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem(cyl); - - // Done - return 89.25; - -} diff --git a/macros/g4simulations/G4_DSTReader.C b/macros/g4simulations/G4_DSTReader.C deleted file mode 100644 index 79624588c..000000000 --- a/macros/g4simulations/G4_DSTReader.C +++ /dev/null @@ -1,132 +0,0 @@ -////////////////////////////////////////////////////////////////// -/*! - \file G4_DSTReader.C - \brief Convert DST to human command readable TTree for quick poke around the outputs - \author Jin Huang - \version $Revision: $ - \date $Date: $ - */ -////////////////////////////////////////////////////////////////// - -#include - -void -G4DSTreader( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - bool do_svtx = true, // - bool do_pstof = true, // - bool do_cemc = true, // - bool do_hcalin = true, // - bool do_magnet = true, // - bool do_hcalout = true, // - bool do_cemc_twr = true, // - bool do_hcalin_twr = true, // - bool do_magnet = true, // - bool do_hcalout_twr = true // - ) -{ - - //! debug output on screen? - const bool debug = false; - - //! save raw g4 hits - const bool save_g4_raw = true; - - // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(true); - ana->set_save_vertex(true); - - if (debug) - { - ana->Verbosity(2); - } - - if (save_g4_raw) - { - if (do_svtx) - { - ana->AddNode("SVTX"); - } - - if (do_pstof) - { - ana->AddNode("PSTOF_0"); - } - - if (do_cemc) - { - ana->AddNode("CEMC"); - if (absorberactive) - { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS"); - ana->AddNode("CEMC_SPT"); - } - } - - if (do_hcalin) - { - ana->AddNode("HCALIN"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALIN"); - } - - if (do_magnet) - { - if (absorberactive) - ana->AddNode("MAGNET"); - } - - if (do_hcalout) - { - ana->AddNode("HCALOUT"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALOUT"); - } - - - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); - - } - - ana->set_tower_zero_sup(1e-6); - if (do_cemc_twr) - { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); - } - if (do_hcalin_twr) - { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); - } - if (do_hcalout_twr) - { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); - } - - // Jets disabled for now -// if (do_jet_reco) -// { -// -// ana->AddJet("AntiKt06JetsInPerfect"); -// ana->AddJet("G4TowerJets_6"); -// } -// if (embed_input_file && do_jet_reco) -// { -// ana->AddJet("G4TowerJets_combined_6"); -// } - - Fun4AllServer *se = Fun4AllServer::instance(); - se->registerSubsystem(ana); -} diff --git a/macros/g4simulations/G4_DSTReader_EICDetector.C b/macros/g4simulations/G4_DSTReader_EICDetector.C deleted file mode 100644 index e8e83f3ae..000000000 --- a/macros/g4simulations/G4_DSTReader_EICDetector.C +++ /dev/null @@ -1,188 +0,0 @@ -////////////////////////////////////////////////////////////////// -/*! - \file G4_DSTReader.C - \brief Convert DST to human command readable TTree for quick poke around the outputs - \author Jin Huang - \version $Revision: $ - \date $Date: $ -*/ -////////////////////////////////////////////////////////////////// - -#include - -void -G4DSTreader_EICDetector( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - bool do_svtx = true, // - bool do_cemc = true, // - bool do_hcalin = true, // - bool do_magnet = true, // - bool do_hcalout = true, // - bool do_cemc_twr = true, // - bool do_hcalin_twr = true, // - bool do_magnet = true, // - bool do_hcalout_twr = true, // - bool do_FGEM = true, // - bool do_EGEM = true, // - bool do_FHCAL = true, // - bool do_FHCAL_twr = true, // - bool do_FEMC = true, // - bool do_FEMC_twr = true, // - bool do_EEMC = true, // - bool do_EEMC_twr = true // - ) -{ - - //! debug output on screen? - const bool debug = false; - - //! save raw g4 hits - const bool save_g4_raw = true; - - // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(true); - ana->set_save_vertex(true); - - if (debug) - { - ana->Verbosity(2); - } - - if (save_g4_raw) - { - if (do_svtx) - { - ana->AddNode("SVTX"); - } - - if (do_cemc) - { - ana->AddNode("CEMC"); - if (absorberactive) - { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS"); - ana->AddNode("CEMC_SPT"); - } - } - - if (do_hcalin) - { - ana->AddNode("HCALIN"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALIN"); - } - - if (do_magnet) - { - if (absorberactive) - ana->AddNode("MAGNET"); - } - - if (do_hcalout) - { - ana->AddNode("HCALOUT"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALOUT"); - } - - if (do_FHCAL) - { - ana->AddNode("FHCAL"); - if (absorberactive) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (do_FEMC) - { - ana->AddNode("FEMC"); - if (absorberactive) - ana->AddNode("ABSORBER_FEMC"); - } - - if (do_EEMC) - { - ana->AddNode("EEMC"); - if (absorberactive) - ana->AddNode("ABSORBER_EEMC"); - } - - if (do_FGEM) - { - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - - if (do_EGEM) - { - ana->AddNode("EGEM_0"); - ana->AddNode("EGEM_1"); - ana->AddNode("EGEM_2"); - } - - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); - - } - - ana->set_tower_zero_sup(1e-6); - if (do_cemc_twr) - { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); - } - if (do_hcalin_twr) - { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); - } - if (do_hcalout_twr) - { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); - } - if (do_FHCAL_twr) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (do_FEMC_twr) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - if (do_EEMC_twr) - { - ana->AddTower("SIM_EEMC"); - ana->AddTower("RAW_EEMC"); - ana->AddTower("CALIB_EEMC"); - } - - // Jets disabled for now - // if (do_jet_reco) - // { - // - // ana->AddJet("AntiKt06JetsInPerfect"); - // ana->AddJet("G4TowerJets_6"); - // } - // if (embed_input_file && do_jet_reco) - // { - // ana->AddJet("G4TowerJets_combined_6"); - // } - - Fun4AllServer *se = Fun4AllServer::instance(); - se->registerSubsystem(ana); -} diff --git a/macros/g4simulations/G4_DSTReader_fsPHENIX.C b/macros/g4simulations/G4_DSTReader_fsPHENIX.C deleted file mode 100644 index 5edfc6282..000000000 --- a/macros/g4simulations/G4_DSTReader_fsPHENIX.C +++ /dev/null @@ -1,165 +0,0 @@ -////////////////////////////////////////////////////////////////// -/*! - \file G4_DSTReader.C - \brief Convert DST to human command readable TTree for quick poke around the outputs - \author Jin Huang - \version $Revision: $ - \date $Date: $ - */ -////////////////////////////////////////////////////////////////// - -#include - -void -G4DSTreader_fsPHENIX( const char * outputFile = "G4sPHENIXCells.root",// - int absorberactive = 1, // - bool do_svtx = true, // - bool do_cemc = true, // - bool do_hcalin = true, // - bool do_magnet = true, // - bool do_hcalout = true, // - bool do_cemc_twr = true, // - bool do_hcalin_twr = true, // - bool do_magnet = true, // - bool do_hcalout_twr = true, // - bool do_FGEM = true, // - bool do_FHCAL = true, // - bool do_FHCAL_twr = true, // - bool do_FEMC = true, // - bool do_FEMC_twr = true // - ) -{ - - //! debug output on screen? - const bool debug = false; - - //! save raw g4 hits - const bool save_g4_raw = true; - - // save a comprehensive evaluation file - PHG4DSTReader* ana = new PHG4DSTReader( - string(outputFile) + string("_DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(true); - ana->set_save_vertex(true); - - if (debug) - { - ana->Verbosity(2); - } - - if (save_g4_raw) - { - if (do_svtx) - { - ana->AddNode("SVTX"); - } - - if (do_cemc) - { - ana->AddNode("CEMC"); - if (absorberactive) - { - ana->AddNode("ABSORBER_CEMC"); - ana->AddNode("CEMC_ELECTRONICS"); - ana->AddNode("CEMC_SPT"); - } - } - - if (do_hcalin) - { - ana->AddNode("HCALIN"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALIN"); - } - - if (do_magnet) - { - if (absorberactive) - ana->AddNode("MAGNET"); - } - - if (do_hcalout) - { - ana->AddNode("HCALOUT"); - if (absorberactive) - ana->AddNode("ABSORBER_HCALOUT"); - } - - if (do_FHCAL) - { - ana->AddNode("FHCAL"); - if (absorberactive) - ana->AddNode("ABSORBER_FHCAL"); - } - - if (do_FEMC) - { - ana->AddNode("FEMC"); - if (absorberactive) - ana->AddNode("ABSORBER_FEMC"); - } - - if (do_FGEM) - { - ana->AddNode("FGEM_0"); - ana->AddNode("FGEM_1"); - ana->AddNode("FGEM_2"); - ana->AddNode("FGEM_3"); - ana->AddNode("FGEM_4"); - } - - ana->AddNode("BH_1"); - ana->AddNode("BH_FORWARD_PLUS"); - ana->AddNode("BH_FORWARD_NEG"); - - } - - ana->set_tower_zero_sup(1e-6); - if (do_cemc_twr) - { - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_CEMC"); - ana->AddTower("CALIB_CEMC"); - } - if (do_hcalin_twr) - { - ana->AddTower("SIM_HCALIN"); - ana->AddTower("RAW_HCALIN"); - ana->AddTower("CALIB_HCALIN"); - } - if (do_hcalout_twr) - { - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("RAW_HCALOUT"); - ana->AddTower("CALIB_HCALOUT"); - } - if (do_FHCAL_twr) - { - ana->AddTower("SIM_FHCAL"); - ana->AddTower("RAW_FHCAL"); - ana->AddTower("CALIB_FHCAL"); - } - if (do_FEMC_twr) - { - ana->AddTower("SIM_FEMC"); - ana->AddTower("RAW_FEMC"); - ana->AddTower("CALIB_FEMC"); - } - - // Jets disabled for now -// if (do_jet_reco) -// { -// -// ana->AddJet("AntiKt06JetsInPerfect"); -// ana->AddJet("G4TowerJets_6"); -// } -// if (embed_input_file && do_jet_reco) -// { -// ana->AddJet("G4TowerJets_combined_6"); -// } - - Fun4AllServer *se = Fun4AllServer::instance(); - se->registerSubsystem(ana); -} diff --git a/macros/g4simulations/G4_EEMC.C b/macros/g4simulations/G4_EEMC.C deleted file mode 100644 index 37ce6c09d..000000000 --- a/macros/g4simulations/G4_EEMC.C +++ /dev/null @@ -1,122 +0,0 @@ -using namespace std; - -void -EEMCInit() -{ -} - -void EEMC_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("EEMCCellReco"); - hc->Detector("EEMC"); - se->registerSubsystem(hc); - - return; -} - -void -EEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - /** Use dedicated EEMC module */ - PHG4CrystalCalorimeterSubsystem *eemc = new PHG4CrystalCalorimeterSubsystem("EEMC"); - - /* path to central copy of calibrations repositry */ - ostringstream mapping_eemc; - - /* Use non-projective geometry */ - mapping_eemc << getenv("CALIBRATIONROOT") << "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt"; - cout << mapping_eemc.str() << endl; - - eemc->SetTowerMappingFile( mapping_eemc.str() ); - eemc->OverlapCheck(overlapcheck); - - if (absorberactive) eemc->SetAbsorberActive(); - - /* register Ecal module */ - g4Reco->registerSubsystem( eemc ); - -} - -void EEMC_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_eemc; - mapping_eemc << getenv("CALIBRATIONROOT") << - "/CrystalCalorimeter/mapping/towerMap_EEMC_v004.txt"; - - RawTowerBuilderByHitIndex* tower_EEMC = new RawTowerBuilderByHitIndex("TowerBuilder_EEMC"); - tower_EEMC->Detector("EEMC"); - tower_EEMC->set_sim_tower_node_prefix("SIM"); - tower_EEMC->GeometryTableFile( mapping_eemc.str() ); - - se->registerSubsystem(tower_EEMC); - - - /* Calorimeter digitization */ - - // CMS lead tungstate barrel ECAL at 18 degree centrigrade: 4.5 photoelectrons per MeV - const double EEMC_photoelectron_per_GeV = 4500; - - RawTowerDigitizer *TowerDigitizer_EEMC = new RawTowerDigitizer("EEMCRawTowerDigitizer"); - TowerDigitizer_EEMC->Detector("EEMC"); - TowerDigitizer_EEMC->Verbosity(verbosity); - TowerDigitizer_EEMC->set_raw_tower_node_prefix("RAW"); - TowerDigitizer_EEMC->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - TowerDigitizer_EEMC->set_pedstal_central_ADC(0); - TowerDigitizer_EEMC->set_pedstal_width_ADC(8);// eRD1 test beam setting - TowerDigitizer_EEMC->set_photonelec_ADC(1);//not simulating ADC discretization error - TowerDigitizer_EEMC->set_photonelec_yield_visible_GeV( EEMC_photoelectron_per_GeV ); - TowerDigitizer_EEMC->set_zero_suppression_ADC(16); // eRD1 test beam setting - - se->registerSubsystem( TowerDigitizer_EEMC ); - - - /* Calorimeter calibration */ - - RawTowerCalibration *TowerCalibration_EEMC = new RawTowerCalibration("EEMCRawTowerCalibration"); - TowerCalibration_EEMC->Detector("EEMC"); - TowerCalibration_EEMC->Verbosity(verbosity); - TowerCalibration_EEMC->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration_EEMC->set_calib_const_GeV_ADC( 1. / EEMC_photoelectron_per_GeV ); - TowerCalibration_EEMC->set_pedstal_ADC( 0 ); - - se->registerSubsystem( TowerCalibration_EEMC ); - -} - -void EEMC_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("EEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("EEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void EEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("EEMCEVALUATOR", "EEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_EGEM_EIC.C b/macros/g4simulations/G4_EGEM_EIC.C deleted file mode 100644 index 5eb2220c6..000000000 --- a/macros/g4simulations/G4_EGEM_EIC.C +++ /dev/null @@ -1,119 +0,0 @@ -// $Id: G4_FGEM_ePHENIX.C,v 1.4 2013/10/13 21:45:27 jinhuang Exp $ - -/*! - * \file G4_FGEM_ePHENIX.C - * \brief - * \author Jin Huang - * \version $Revision: 1.4 $ - * \date $Date: 2013/10/13 21:45:27 $ - */ - -using namespace std; - -void -EGEM_Init() -{ - -} - -void -EGEMSetup(PHG4Reco* g4Reco) -{ - make_GEM_station("EGEM_0", g4Reco, -32., -1.6, -3.4); - make_GEM_station("EGEM_1", g4Reco, -58., -2.1, -3.98); // reduce max eta from -4.0 to -3.98 to avoid overlap with volume S_AL_PIPE_5 (aluminum beam pipe) - make_GEM_station("EGEM_2", g4Reco, -101., -1.2, -4.5); -} - -int -make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, - double etamax) -{ - - // cout - // << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " - // << name << endl; - - double polar_angle = 0; - - if (zpos < 0) - { - zpos = -zpos; - polar_angle = TMath::Pi(); - - } - if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } - - PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->get_geometry().set_normal_polar_angle(polar_angle); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(1); - gem->OverlapCheck(overlapcheck); - - gem->get_geometry().AddLayers_DriftVol_COMPASS(); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - -} - -void EGEM_FastSim_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(0); - - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); - - kalman->set_detector_type(PHG4TrackFastSim::Vertical_Plane); // Vertical_Plane, Cylinder - kalman->set_phi_resolution(50E-4); - kalman->set_r_resolution(1.); - - kalman->set_mag_field_file_name("/phenix/upgrades/decadal/fieldmaps/fsPHENIX.2d.root"); - kalman->set_mag_field_re_scaling_factor(1.); - - kalman->set_pat_rec_hit_finding_eff(1.); - kalman->set_pat_rec_noise_prob(0.); - - std::string phg4hits_names[] = {"G4HIT_EGEM_0","G4HIT_EGEM_1","G4HIT_EGEM_2"}; - kalman->set_phg4hits_names(phg4hits_names, 3); - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMapNegativeEta"); - - // Saved track states (projections) - std::string state_names[] = {"EEMC"}; - kalman->set_state_names(state_names, 1); - - kalman->set_fit_alg_name("KalmanFitterRefTrack");// - kalman->set_primary_assumption_pid(-211); // -211 = pi- - kalman->set_do_evt_display(false); - - se->registerSubsystem(kalman); - -} - diff --git a/macros/g4simulations/G4_FEMC.C b/macros/g4simulations/G4_FEMC.C deleted file mode 100644 index 6e55cce39..000000000 --- a/macros/g4simulations/G4_FEMC.C +++ /dev/null @@ -1,132 +0,0 @@ -using namespace std; - -void -FEMCInit() -{ -} - -void FEMC_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - - return; -} - -void -FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - femc->SetfsPHENIXDetector(); - mapping_femc<< getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt"; - - cout << mapping_femc.str() << endl; - - femc->SetTowerMappingFile( mapping_femc.str() ); - femc->OverlapCheck(overlapcheck); - - if (absorberactive) femc->SetAbsorberActive(); - - g4Reco->registerSubsystem( femc ); - -} - -void FEMC_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - - // fsPHENIX ECAL - mapping_femc << getenv("CALIBRATIONROOT") << - "/ForwardEcal/mapping/towerMap_FEMC_fsPHENIX_v002.txt"; - - RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); - tower_FEMC->Detector("FEMC"); - tower_FEMC->set_sim_tower_node_prefix("SIM"); - tower_FEMC->GeometryTableFile( mapping_femc.str() ); - - se->registerSubsystem(tower_FEMC); - - // PbW crystals - RawTowerDigitizer *TowerDigitizer1 = new RawTowerDigitizer("FEMCRawTowerDigitizer1"); - TowerDigitizer1->Detector("FEMC"); - TowerDigitizer1->TowerType(1); - TowerDigitizer1->Verbosity(verbosity); - TowerDigitizer1->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer1 ); - - // PbSc towers - RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); - TowerDigitizer2->Detector("FEMC"); - TowerDigitizer2->TowerType(2); - TowerDigitizer2->Verbosity(verbosity); - TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer2 ); - - // PbW crystals - RawTowerCalibration *TowerCalibration1 = new RawTowerCalibration("FEMCRawTowerCalibration1"); - TowerCalibration1->Detector("FEMC"); - TowerCalibration1->TowerType(1); - TowerCalibration1->Verbosity(verbosity); - TowerCalibration1->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration1->set_calib_const_GeV_ADC(1.0); // sampling fraction = 1.0 - TowerCalibration1->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration1 ); - - // PbSc towers - RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2"); - TowerCalibration2->Detector("FEMC"); - TowerCalibration2->TowerType(2); - TowerCalibration2->Verbosity(verbosity); - TowerCalibration2->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration2->set_calib_const_GeV_ADC(1.0/0.249); // sampling fraction = 0.249 for e- - TowerCalibration2->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration2 ); - -} - -void FEMC_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void FEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_FEMC_EIC.C b/macros/g4simulations/G4_FEMC_EIC.C deleted file mode 100644 index b02b5ce0d..000000000 --- a/macros/g4simulations/G4_FEMC_EIC.C +++ /dev/null @@ -1,111 +0,0 @@ -using namespace std; - -void -FEMCInit() -{ -} - -void FEMC_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FEMCCellReco"); - hc->Detector("FEMC"); - se->registerSubsystem(hc); - - return; -} - -void -FEMCSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FEMC module */ - PHG4ForwardEcalSubsystem *femc = new PHG4ForwardEcalSubsystem("FEMC"); - - ostringstream mapping_femc; - - // EIC ECAL - femc->SetEICDetector(); - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v005.txt"; - - cout << mapping_femc.str() << endl; - - femc->SetTowerMappingFile( mapping_femc.str() ); - femc->OverlapCheck(overlapcheck); - - if (absorberactive) femc->SetAbsorberActive(); - - g4Reco->registerSubsystem( femc ); - -} - -void FEMC_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_femc; - // EIC ECAL - mapping_femc << getenv("CALIBRATIONROOT") << "/ForwardEcal/mapping/towerMap_FEMC_v005.txt"; - - RawTowerBuilderByHitIndex* tower_FEMC = new RawTowerBuilderByHitIndex("TowerBuilder_FEMC"); - tower_FEMC->Detector("FEMC"); - tower_FEMC->set_sim_tower_node_prefix("SIM"); - tower_FEMC->GeometryTableFile( mapping_femc.str() ); - - se->registerSubsystem(tower_FEMC); - - // PbSc towers - RawTowerDigitizer *TowerDigitizer2 = new RawTowerDigitizer("FEMCRawTowerDigitizer2"); - TowerDigitizer2->Detector("FEMC"); - TowerDigitizer2->TowerType(2); - TowerDigitizer2->Verbosity(verbosity); - TowerDigitizer2->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer2 ); - - // PbSc towers - RawTowerCalibration *TowerCalibration2 = new RawTowerCalibration("FEMCRawTowerCalibration2"); - TowerCalibration2->Detector("FEMC"); - TowerCalibration2->TowerType(2); - TowerCalibration2->Verbosity(verbosity); - TowerCalibration2->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration2->set_calib_const_GeV_ADC(1.0/0.249); // sampling fraction = 0.249 for e- - TowerCalibration2->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration2 ); - -} - -void FEMC_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FEMCRawClusterBuilderFwd"); - ClusterBuilder->Detector("FEMC"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void FEMC_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FEMCEVALUATOR", "FEMC", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_FGEM_fsPHENIX.C b/macros/g4simulations/G4_FGEM_fsPHENIX.C deleted file mode 100644 index 70ea650c1..000000000 --- a/macros/g4simulations/G4_FGEM_fsPHENIX.C +++ /dev/null @@ -1,301 +0,0 @@ -// $Id: G4_FGEM_fsPHENIX.C,v 1.2 2014/01/22 01:44:13 jinhuang Exp $ - -/*! - * \file G4_FGEM_fsPHENIX.C - * \brief - * \author Jin Huang - * \version $Revision: 1.2 $ - * \date $Date: 2014/01/22 01:44:13 $ - */ - -using namespace std; - -void -FGEM_Init() -{ - -} - -void -FGEMSetup(PHG4Reco* g4Reco, const int N_Sector = 8, // - const double min_eta = 1.45 // - ) -{ - - const double tilt = .1; - - string name; - double etamax; - double etamin; - double zpos; - PHG4SectorSubsystem *gem; - - make_GEM_station("FGEM_0", g4Reco, 17, 1.01, 2.7, N_Sector); - make_GEM_station("FGEM_1", g4Reco, 62, 2.15, 4.0, N_Sector); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_2"; - etamax = 4; - etamin = min_eta; - zpos = 1.2e2; - - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->get_geometry().set_normal_polar_angle(tilt); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->OverlapCheck(overlapcheck); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_3"; - etamax = 4; - etamin = min_eta; - zpos = 1.6e2; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->SuperDetector(name); - gem->get_geometry().set_normal_polar_angle(tilt); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->OverlapCheck(overlapcheck); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - gem = new PHG4SectorSubsystem(name + "_LowerEta"); - gem->SuperDetector(name); - - zpos = zpos - - (zpos * sin(tilt) - + zpos * cos(tilt) - * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(2) - tilt)) - * sin(tilt); - - gem->get_geometry().set_normal_polar_angle( - (PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) - + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)) / 2); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - - name = "FGEM_4"; - etamax = 4; - etamin = min_eta; - zpos = 2.75e2; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->SuperDetector(name); - gem->get_geometry().set_normal_polar_angle(tilt); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), 0); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->OverlapCheck(overlapcheck); - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - - zpos = zpos - - (zpos * sin(tilt) - + zpos * cos(tilt) - * tan(PHG4Sector::Sector_Geometry::eta_to_polar_angle(2) - tilt)) - * sin(tilt); - - gem = new PHG4SectorSubsystem(name + "_LowerEta"); - gem->SuperDetector(name); - - gem->get_geometry().set_normal_polar_angle( - (PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta) - + PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)) / 2); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm(), - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(2)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(min_eta)); - gem->get_geometry().set_material("G4_METHANE"); - gem->get_geometry().set_N_Sector(N_Sector); - gem->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - gem->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(gem); - - /////////////////////////////////////////////////////////////////////////// - -} - -//! Add drift layers to mini TPC -void -AddLayers_MiniTPCDrift(PHG4SectorSubsystem *gem) -{ - assert(gem); - - const double cm = PHG4Sector::Sector_Geometry::Unit_cm(); - const double mm = .1 * cm; - const double um = 1e-3 * mm; - -// const int N_Layers = 70; // used for mini-drift TPC timing digitalization - const int N_Layers = 1; // simplified setup - const double thickness = 2 * cm; - - gem->get_geometry().AddLayer("EntranceWindow", "G4_MYLAR", 25 * um, false, - 100); - gem->get_geometry().AddLayer("Cathode", "G4_GRAPHITE", 10 * um, false, 100); - - for (int d = 1; d <= N_Layers; d++) - { - stringstream s; - s << "DriftLayer_"; - s << d; - - gem->get_geometry().AddLayer(s.str(), "G4_METHANE", thickness / N_Layers, - true); - - } -} - -int -make_GEM_station(string name, PHG4Reco* g4Reco, double zpos, double etamin, - double etamax, const int N_Sector = 8) -{ - -// cout -// << "make_GEM_station - GEM construction with PHG4SectorSubsystem - make_GEM_station_EdgeReadout of " -// << name << endl; - - double polar_angle = 0; - - if (zpos < 0) - { - zpos = -zpos; - polar_angle = TMath::Pi(); - - } - if (etamax < etamin) - { - double t = etamax; - etamax = etamin; - etamin = t; - } - - PHG4SectorSubsystem *gem; - gem = new PHG4SectorSubsystem(name.c_str()); - - gem->SuperDetector(name); - - gem->get_geometry().set_normal_polar_angle(polar_angle); - gem->get_geometry().set_normal_start( - zpos * PHG4Sector::Sector_Geometry::Unit_cm()); - gem->get_geometry().set_min_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamax)); - gem->get_geometry().set_max_polar_angle( - PHG4Sector::Sector_Geometry::eta_to_polar_angle(etamin)); - gem->get_geometry().set_max_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_min_polar_edge( - PHG4Sector::Sector_Geometry::FlatEdge()); - gem->get_geometry().set_N_Sector(N_Sector); - gem->get_geometry().set_material("G4_METHANE"); - gem->OverlapCheck(overlapcheck); - - AddLayers_MiniTPCDrift(gem); - gem->get_geometry().AddLayers_HBD_GEM(); - g4Reco->registerSubsystem(gem); - -} - -void FGEM_FastSim_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4TrackFastSim* kalman = new PHG4TrackFastSim("PHG4TrackFastSim"); - kalman->Verbosity(0); - - kalman->set_use_vertex_in_fitting(true); - kalman->set_vertex_xy_resolution(50E-4); - kalman->set_vertex_z_resolution(50E-4); - - kalman->set_detector_type(PHG4TrackFastSim::Vertical_Plane); // Vertical_Plane, Cylinder - kalman->set_phi_resolution(50E-4); - kalman->set_r_resolution(1.); - - kalman->set_mag_field_file_name("/phenix/upgrades/decadal/fieldmaps/fsPHENIX.2d.root"); - kalman->set_mag_field_re_scaling_factor(1.); - - kalman->set_pat_rec_hit_finding_eff(1.); - kalman->set_pat_rec_noise_prob(0.); - - std::string phg4hits_names[] = {"G4HIT_FGEM_0","G4HIT_FGEM_1","G4HIT_FGEM_2","G4HIT_FGEM_3","G4HIT_FGEM_4"}; - kalman->set_phg4hits_names(phg4hits_names, 5); - kalman->set_sub_top_node_name("SVTX"); - kalman->set_trackmap_out_name("SvtxTrackMap"); - - // Saved track states (projections) - std::string state_names[] = {"FEMC","FHCAL"}; - kalman->set_state_names(state_names, 2); - - kalman->set_fit_alg_name("KalmanFitterRefTrack");// - kalman->set_primary_assumption_pid(13); - kalman->set_do_evt_display(false); - - se->registerSubsystem(kalman); - -} - diff --git a/macros/g4simulations/G4_FHCAL.C b/macros/g4simulations/G4_FHCAL.C deleted file mode 100644 index aac6bf737..000000000 --- a/macros/g4simulations/G4_FHCAL.C +++ /dev/null @@ -1,135 +0,0 @@ -using namespace std; - -void -FHCALInit() -{ -} - -void FHCAL_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4ForwardCalCellReco *hc = new PHG4ForwardCalCellReco("FHCALCellReco"); - hc->Detector("FHCAL"); - se->registerSubsystem(hc); - - return; -} - -void -FHCALSetup(PHG4Reco* g4Reco, const int absorberactive = 0) -{ - - gSystem->Load("libg4detectors.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - /** Use dedicated FHCAL module */ - PHG4ForwardHcalSubsystem *hhcal = new PHG4ForwardHcalSubsystem("FHCAL"); - - ostringstream mapping_hhcal; - - /* path to central copy of calibrations repositry */ - mapping_hhcal << getenv("CALIBRATIONROOT") ; - mapping_hhcal << "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt"; - cout << mapping_hhcal.str() << endl; - //mapping_hhcal << "towerMap_FHCAL_latest.txt"; - - hhcal->SetTowerMappingFile( mapping_hhcal.str() ); - hhcal->OverlapCheck(overlapcheck); - - if (absorberactive) hhcal->SetAbsorberActive(); - - g4Reco->registerSubsystem( hhcal ); - -} - -void FHCAL_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - ostringstream mapping_fhcal; - mapping_fhcal << getenv("CALIBRATIONROOT") << - "/ForwardHcal/mapping/towerMap_FHCAL_v004.txt"; - //mapping_fhcal << "towerMap_FHCAL_latest.txt"; - - RawTowerBuilderByHitIndex* tower_FHCAL = new RawTowerBuilderByHitIndex("TowerBuilder_FHCAL"); - tower_FHCAL->Detector("FHCAL"); - tower_FHCAL->set_sim_tower_node_prefix("SIM"); - tower_FHCAL->GeometryTableFile( mapping_fhcal.str() ); - - se->registerSubsystem(tower_FHCAL); - - // const double FHCAL_photoelectron_per_GeV = 500; - - // RawTowerDigitizer *TowerDigitizer_FHCAL = new RawTowerDigitizer("FHCALRawTowerDigitizer"); - - // TowerDigitizer_FHCAL->Detector("FHCAL"); - // TowerDigitizer_FHCAL->Verbosity(verbosity); - // TowerDigitizer_FHCAL->set_raw_tower_node_prefix("RAW"); - // TowerDigitizer_FHCAL->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitization); - // TowerDigitizer_FHCAL->set_pedstal_central_ADC(0); - // TowerDigitizer_FHCAL->set_pedstal_width_ADC(8);// eRD1 test beam setting - // TowerDigitizer_FHCAL->set_photonelec_ADC(1);//not simulating ADC discretization error - // TowerDigitizer_FHCAL->set_photonelec_yield_visible_GeV( FHCAL_photoelectron_per_GeV ); - // TowerDigitizer_FHCAL->set_zero_suppression_ADC(16); // eRD1 test beam setting - - // se->registerSubsystem( TowerDigitizer_FHCAL ); - - // RawTowerCalibration *TowerCalibration_FHCAL = new RawTowerCalibration("FHCALRawTowerCalibration"); - // TowerCalibration_FHCAL->Detector("FHCAL"); - // TowerCalibration_FHCAL->Verbosity(verbosity); - // TowerCalibration_FHCAL->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - // TowerCalibration_FHCAL->set_calib_const_GeV_ADC( 1. / FHCAL_photoelectron_per_GeV ); - // TowerCalibration_FHCAL->set_pedstal_ADC( 0 ); - - // se->registerSubsystem( TowerCalibration_FHCAL ); - - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("FHCALRawTowerDigitizer"); - TowerDigitizer->Detector("FHCAL"); - TowerDigitizer->Verbosity(verbosity); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kNo_digitization); - se->registerSubsystem( TowerDigitizer ); - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("FHCALRawTowerCalibration"); - TowerCalibration->Detector("FHCAL"); - TowerCalibration->Verbosity(verbosity); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1./0.03898); // calibrated with muons - TowerCalibration->set_pedstal_ADC(0); - se->registerSubsystem( TowerCalibration ); - - -} - -void FHCAL_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilderFwd* ClusterBuilder = new RawClusterBuilderFwd("FHCALRawClusterBuilderFwd"); - ClusterBuilder->Detector("FHCAL"); - ClusterBuilder->Verbosity(verbosity); - ClusterBuilder->set_threshold_energy(0.100); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void FHCAL_Eval(std::string outputfile, int verbosity = 0) -{ - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator *eval = new CaloEvaluator("FHCALEVALUATOR", "FHCAL", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_FwdJets.C b/macros/g4simulations/G4_FwdJets.C deleted file mode 100644 index 4e9195e60..000000000 --- a/macros/g4simulations/G4_FwdJets.C +++ /dev/null @@ -1,60 +0,0 @@ - -void Jet_FwdReco(int verbosity = 0) { - - gSystem->Load("libg4jets.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - // truth particle level jets - JetReco *truthjetreco = new JetReco(); - truthjetreco->add_input(new TruthJetInput(Jet::PARTICLE)); - //truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Truth_r02"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Truth_r03"); - // truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Truth_r04"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Truth_r05"); - // truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Truth_r06"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Truth_r07"); - // truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Truth_r08"); - truthjetreco->set_algo_node("ANTIKT"); - truthjetreco->set_input_node("TRUTH"); - truthjetreco->Verbosity(verbosity); - se->registerSubsystem(truthjetreco); - - // tower jets - JetReco *towerjetreco = new JetReco(); - towerjetreco->add_input(new TowerJetInput(Jet::FEMC_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::FHCAL_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Tower_r02"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Tower_r03"); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Tower_r04"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Tower_r05"); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Tower_r06"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Tower_r07"); - // towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); - towerjetreco->set_algo_node("ANTIKT"); - towerjetreco->set_input_node("TOWER"); - towerjetreco->Verbosity(verbosity); - se->registerSubsystem(towerjetreco); - - return; -} - -void Jet_FwdEval(std::string outfilename = "g4fwdjets_eval.root", - int verbosity = 0) { - - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - JetEvaluator* eval = new JetEvaluator("JETEVALUATOR", - "AntiKt_Tower_r05", - "AntiKt_Truth_r05", - outfilename); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_Global.C b/macros/g4simulations/G4_Global.C deleted file mode 100644 index 0c512827c..000000000 --- a/macros/g4simulations/G4_Global.C +++ /dev/null @@ -1,46 +0,0 @@ - -void Global_Reco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4vertex.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - GlobalVertexReco* gblvertex = new GlobalVertexReco(); - se->registerSubsystem(gblvertex); - - return; -} - -void Global_FastSim(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4vertex.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - GlobalVertexFastSimReco* gblvertex = new GlobalVertexFastSimReco(); - gblvertex->set_x_smearing(0.0100); // 100 um - gblvertex->set_y_smearing(0.0100); // 100 um - gblvertex->set_z_smearing(0.0150); // 150 um - gblvertex->set_t_smearing(0.002); // 20 ps - se->registerSubsystem(gblvertex); - - return; -} diff --git a/macros/g4simulations/G4_HIJetReco.C b/macros/g4simulations/G4_HIJetReco.C deleted file mode 100644 index f15a0722d..000000000 --- a/macros/g4simulations/G4_HIJetReco.C +++ /dev/null @@ -1,43 +0,0 @@ -void HIJetReco(int verbosity = 0) { - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libjetbackground.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - RetowerCEMC *rcemc = new RetowerCEMC(); - rcemc->Verbosity( verbosity ); - se->registerSubsystem( rcemc ); - - DetermineTowerBackground *dtb = new DetermineTowerBackground(); - dtb->SetBackgroundOutputName("TowerBackground_Sub1"); - dtb->SetSeedType( 1 ); - dtb->Verbosity( verbosity ); - se->registerSubsystem( dtb ); - - SubtractTowers *st = new SubtractTowers(); - st->Verbosity( verbosity ); - se->registerSubsystem( st ); - - JetReco *towerjetreco = new JetReco(); - towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER_SUB1)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER_SUB1)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER_SUB1)); - towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT,0.2,verbosity),"AntiKt_Tower_r02_Sub1"); - towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT,0.3,verbosity),"AntiKt_Tower_r03_Sub1"); - towerjetreco->add_algo(new FastJetAlgoSub(Jet::ANTIKT,0.4,verbosity),"AntiKt_Tower_r04_Sub1"); - towerjetreco->set_algo_node("ANTIKT"); - towerjetreco->set_input_node("TOWER"); - towerjetreco->Verbosity( verbosity ); - se->registerSubsystem(towerjetreco); - - return; - -} diff --git a/macros/g4simulations/G4_HcalIn_ref.C b/macros/g4simulations/G4_HcalIn_ref.C deleted file mode 100644 index ae2ca3d0e..000000000 --- a/macros/g4simulations/G4_HcalIn_ref.C +++ /dev/null @@ -1,200 +0,0 @@ -//Inner HCal construction macro - -//Inner HCal absorber material selector: -//false - Default, absorber material is SS310 -//true - Choose if you want Aluminum -const bool inner_hcal_material_Al = false; - -// Init is called by G4Setup.C -void HCalInnerInit() {} - -double HCalInner(PHG4Reco* g4Reco, - double radius, - const int crossings, - const int absorberactive = 0, - int verbosity = 0) { - // all sizes are in cm! - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - - PHG4InnerHcalSubsystem *hcal = new PHG4InnerHcalSubsystem("HCALIN"); - // these are the parameters you can change with their default settings - // hcal->set_string_param("material","SS310"); - if(inner_hcal_material_Al) - { - cout <<"HCalInner - construct inner HCal absorber with G4_Al"<set_string_param("material","G4_Al"); - } - // hcal->set_int_param("ncross",4); - // hcal->set_int_param("n_scinti_tiles",12); - // hcal->set_int_param("light_scint_model",1); - // hcal->set_double_param("inner_radius",116); - // hcal->set_double_param("outer_radius",136); - // hcal->set_double_param("scinti_inner_gap",0.85); - // hcal->set_double_param("scinti_outer_gap",1.22); - // hcal->set_double_param("scinti_tile_thickness",0.7); - // hcal->set_double_param("scinti_gap_neighbor",0.1); - // the SetLightCorrection is a convenience method, no - // point in forcing users to set all 4 of them separately - // and maybe forgetting one - // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); - // hcal->set_double_param("place_x",0); - // hcal->set_double_param("place_y",0); - // hcal->set_double_param("place_z",0); - // hcal->set_double_param("rot_x",0); - // hcal->set_double_param("rot_y",0); - // hcal->set_double_param("rot_z",0); - // Flat plates with 4 scintillators per tower: - hcal->set_int_param("n_scinti_plates_per_tower",4); - hcal->set_double_param("scinti_outer_gap",1.22*(5.0/4.0)); - - hcal->SetActive(); - hcal->SuperDetector("HCALIN"); - if (absorberactive) - { - hcal->SetAbsorberActive(); - } - hcal->OverlapCheck(overlapcheck); - - g4Reco->registerSubsystem( hcal ); - - radius = hcal->get_double_param("outer_radius"); - - HCalInner_SupportRing(g4Reco,absorberactive); - - radius += no_overlapp; - return radius; -} - -//! A rough version of the inner HCal support ring, from Richie's CAD drawing. - Jin -void HCalInner_SupportRing(PHG4Reco* g4Reco, - const int absorberactive = 0) { - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - const double z_ring1 = (2025 + 2050) / 2. / 10.; - const double z_ring2 = (2150 + 2175) / 2. / 10.; - const double dz = 25. / 10.; - const double innerradius = 116.; - const double maxradius = 178.0 - 0.001; // avoid touching the outer HCal envelop volumne - - const double z_rings[] = - { -z_ring2, -z_ring1, z_ring1, z_ring2, 0, 0, 0, 0 }; - - PHG4CylinderSubsystem *cyl; - - for (int i = 0; i < 4; i++) - { - cyl = new PHG4CylinderSubsystem("HCALIN_SPT_N1", i); - cyl->set_double_param("place_z",z_rings[i]); - cyl->SuperDetector("HCALIN_SPT"); - cyl->set_double_param("radius",innerradius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",dz); - cyl->set_string_param("material","SS310"); - cyl->set_double_param("thickness",maxradius - innerradius); - if (absorberactive) - { - cyl->SetActive(); - } - g4Reco->registerSubsystem(cyl); - } - - return; -} - - -void HCALInner_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALIN_CELLRECO"); - hc->Detector("HCALIN"); - // hc->Verbosity(2); - // check for energy conservation - needs modified "infinite" timing cuts - // 0-999999999 - // hc->checkenergy(); - // timing cuts with their default settings - // hc->set_double_param("tmin",0.); - // hc->set_double_param("tmax",60.0); - // or all at once: - // hc->set_timing_window(0.0,60.0); - se->registerSubsystem(hc); - - return; -} - -void HCALInner_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - HcalRawTowerBuilder *TowerBuilder = new HcalRawTowerBuilder("HcalInRawTowerBuilder"); - TowerBuilder->Detector("HCALIN"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - TowerBuilder->Verbosity(verbosity); - se->registerSubsystem( TowerBuilder ); - - // From 2016 Test beam sim - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalInRawTowerDigitizer"); - TowerDigitizer->Detector("HCALIN"); -// TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(32. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); - TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - //Default sampling fraction for SS310 - double visible_sample_fraction_HCALIN = 0.0631283 ; //, /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV-0000.root_qa.rootQA_Draw_HCALIN_G4Hit.pdf - - if(inner_hcal_material_Al) visible_sample_fraction_HCALIN = 0.162166; //for "G4_Al", Abhisek Sen - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalInRawTowerCalibration"); - TowerCalibration->Detector("HCALIN"); -// TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); -// TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - return; -} - -void HCALInner_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalInRawClusterBuilder"); - ClusterBuilder->Detector("HCALIN"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void HCALInner_Eval(std::string outputfile, int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator* eval = new CaloEvaluator("HCALINEVALUATOR", "HCALIN", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_HcalOut_ref.C b/macros/g4simulations/G4_HcalOut_ref.C deleted file mode 100644 index 1ed5be01a..000000000 --- a/macros/g4simulations/G4_HcalOut_ref.C +++ /dev/null @@ -1,147 +0,0 @@ -// Init is called by G4Setup.C -void HCalOuterInit(){} - -double HCalOuter(PHG4Reco* g4Reco, - double radius, - const int crossings, - const int absorberactive = 0, - int verbosity = 0) { - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - PHG4OuterHcalSubsystem *hcal = new PHG4OuterHcalSubsystem("HCALOUT"); - // integer params: - // hcal->set_int_param("light_scint_model",1); - // hcal->set_int_param("magnet_cutout_first_scint",8); - // hcal->set_int_param("n_scinti_plates_per_tower",5); - // hcal->set_int_param("n_scinti_tiles",12); - // hcal->set_int_param("n_towers",64); - // hcal->set_int_param("ncross",-4); - // double params: - // hcal->set_double_param("inner_radius", 178); - // hcal->set_double_param("magnet_cutout", 12); - // hcal->set_double_param("outer_radius", 260); - // hcal->set_double_param("place_x", 0); - // hcal->set_double_param("place_y", 0); - // hcal->set_double_param("place_z", 0); - // hcal->set_double_param("rot_x", 0); - // hcal->set_double_param("rot_y", 0); - // hcal->set_double_param("rot_z", 0); - // hcal->set_double_param("scinti_eta_coverage", 1.1); - // hcal->set_double_param("scinti_gap", 0.85); - // hcal->set_double_param("scinti_gap_neighbor", 0.1); - // hcal->set_double_param("scinti_tile_thickness", 0.7); - // hcal->set_double_param("size_z", 609.82); - // hcal->set_double_param("steplimits", nan); - // angle is calculated from crossings - // hcal->set_double_param("tilt_angle",NAN); - // convenience method so we do not forget to set all of them - // hcal->SetLightCorrection(NAN,NAN,NAN,NAN); - // string params: - // hcal->set_string_param("material","Steel_1006"); - - hcal->SetActive(); - hcal->SuperDetector("HCALOUT"); - if (absorberactive) - { - hcal->SetAbsorberActive(); - } - hcal->OverlapCheck(overlapcheck); - g4Reco->registerSubsystem(hcal); - - radius = hcal->get_double_param("outer_radius"); - - radius += no_overlapp; - - return radius; -} - -void HCALOuter_Cells(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - PHG4HcalCellReco *hc = new PHG4HcalCellReco("HCALOUT_CELLRECO"); - hc->Detector("HCALOUT"); - // hc->Verbosity(2); - // check for energy conservation - needs modified "infinite" timing cuts - // 0-999999999 - // hc->checkenergy(); - // timing cuts with their default settings - // hc->set_double_param("tmin",0.); - // hc->set_double_param("tmax",60.0); - // or all at once: - // hc->set_timing_window(0.0,60.0); - se->registerSubsystem(hc); - - return; -} - -void HCALOuter_Towers(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - HcalRawTowerBuilder* TowerBuilder = new HcalRawTowerBuilder("HcalOutRawTowerBuilder"); - TowerBuilder->Detector("HCALOUT"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - TowerBuilder->Verbosity(verbosity); - se->registerSubsystem( TowerBuilder ); - - // From 2016 Test beam sim - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HcalOutRawTowerDigitizer"); - TowerDigitizer->Detector("HCALOUT"); -// TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(16. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); - TowerDigitizer->set_zero_suppression_ADC(-0); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - const double visible_sample_fraction_HCALOUT = 3.38021e-02; // /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf - - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HcalOutRawTowerCalibration"); - TowerCalibration->Detector("HCALOUT"); -// TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); -// TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - return; -} - -void HCALOuter_Clusters(int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - RawClusterBuilder* ClusterBuilder = new RawClusterBuilder("HcalOutRawClusterBuilder"); - ClusterBuilder->Detector("HCALOUT"); - ClusterBuilder->Verbosity(verbosity); - se->registerSubsystem( ClusterBuilder ); - - return; -} - -void HCALOuter_Eval(std::string outputfile, int verbosity = 0) { - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4eval.so"); - Fun4AllServer *se = Fun4AllServer::instance(); - - CaloEvaluator* eval = new CaloEvaluator("HCALOUTEVALUATOR", "HCALOUT", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_Jets.C b/macros/g4simulations/G4_Jets.C deleted file mode 100644 index f3bbcc844..000000000 --- a/macros/g4simulations/G4_Jets.C +++ /dev/null @@ -1,90 +0,0 @@ - -void Jet_Reco(int verbosity = 0) { - - gSystem->Load("libg4jets.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - // truth particle level jets - JetReco *truthjetreco = new JetReco(); - truthjetreco->add_input(new TruthJetInput(Jet::PARTICLE)); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Truth_r02"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Truth_r03"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Truth_r04"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Truth_r05"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Truth_r06"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Truth_r07"); - truthjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Truth_r08"); - truthjetreco->set_algo_node("ANTIKT"); - truthjetreco->set_input_node("TRUTH"); - truthjetreco->Verbosity(verbosity); - se->registerSubsystem(truthjetreco); - - // tower jets - JetReco *towerjetreco = new JetReco(); - towerjetreco->add_input(new TowerJetInput(Jet::CEMC_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALIN_TOWER)); - towerjetreco->add_input(new TowerJetInput(Jet::HCALOUT_TOWER)); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Tower_r02"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Tower_r03"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Tower_r04"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Tower_r05"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Tower_r06"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Tower_r07"); - towerjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Tower_r08"); - towerjetreco->set_algo_node("ANTIKT"); - towerjetreco->set_input_node("TOWER"); - towerjetreco->Verbosity(verbosity); - se->registerSubsystem(towerjetreco); - - // cluster jets - JetReco *clusterjetreco = new JetReco(); - clusterjetreco->add_input(new ClusterJetInput(Jet::CEMC_CLUSTER)); - clusterjetreco->add_input(new ClusterJetInput(Jet::HCALIN_CLUSTER)); - clusterjetreco->add_input(new ClusterJetInput(Jet::HCALOUT_CLUSTER)); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Cluster_r02"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Cluster_r03"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Cluster_r04"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Cluster_r05"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Cluster_r06"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Cluster_r07"); - clusterjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Cluster_r08"); - clusterjetreco->set_algo_node("ANTIKT"); - clusterjetreco->set_input_node("CLUSTER"); - clusterjetreco->Verbosity(verbosity); - se->registerSubsystem(clusterjetreco); - - // track jets - JetReco *trackjetreco = new JetReco(); - trackjetreco->add_input(new TrackJetInput(Jet::TRACK)); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.2),"AntiKt_Track_r02"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.3),"AntiKt_Track_r03"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.4),"AntiKt_Track_r04"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.5),"AntiKt_Track_r05"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.6),"AntiKt_Track_r06"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.7),"AntiKt_Track_r07"); - trackjetreco->add_algo(new FastJetAlgo(Jet::ANTIKT,0.8),"AntiKt_Track_r08"); - trackjetreco->set_algo_node("ANTIKT"); - trackjetreco->set_input_node("TRACK"); - trackjetreco->Verbosity(verbosity); - se->registerSubsystem(trackjetreco); - - return; -} - -void Jet_Eval(std::string outfilename = "g4jets_eval.root", - int verbosity = 0) { - - gSystem->Load("libg4eval.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - - JetEvaluator* eval = new JetEvaluator("JETEVALUATOR", - "AntiKt_Tower_r03", - "AntiKt_Truth_r03", - outfilename); - eval->Verbosity(verbosity); - se->registerSubsystem(eval); - - return; -} diff --git a/macros/g4simulations/G4_Magnet.C b/macros/g4simulations/G4_Magnet.C deleted file mode 100644 index f0c84f3e2..000000000 --- a/macros/g4simulations/G4_Magnet.C +++ /dev/null @@ -1,72 +0,0 @@ - -void MagnetInit() {} - -double Magnet(PHG4Reco* g4Reco, - double radius, - const int crossings = 0, - const int absorberactive = 0, - int verbosity = 0) { - - double magnet_inner_cryostat_wall_radius = 142; - double magnet_inner_cryostat_wall_thickness = 1; - double magnet_outer_cryostat_wall_radius = 174.5; - double magnet_outer_cryostat_wall_thickness = 2.5; - double magnet_coil_radius = 150.8; - double magnet_coil_thickness = 9.38; - double magnet_length = 379.; - double coil_length = 361.5; - if (radius > magnet_inner_cryostat_wall_radius) { - cout << "inconsistency: radius: " << radius - << " larger than Magnet inner radius: " << magnet_inner_cryostat_wall_radius << endl; - gSystem->Exit(-1); - } - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - radius = magnet_inner_cryostat_wall_radius; - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("MAGNET", 0); - cyl->set_double_param("radius",magnet_inner_cryostat_wall_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",magnet_length); -cyl->set_double_param("thickness",magnet_inner_cryostat_wall_thickness); -cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness - cyl->SuperDetector("MAGNET"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("MAGNET", 1); - cyl->set_double_param("radius",magnet_coil_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",coil_length); - cyl->set_double_param("thickness",magnet_coil_thickness); - cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness - cyl->SuperDetector("MAGNET"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("MAGNET", 2); - cyl->set_double_param("radius",magnet_outer_cryostat_wall_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",magnet_length); - cyl->set_double_param("thickness",magnet_outer_cryostat_wall_thickness); - cyl->set_string_param("material","Al5083"); // use 1 radiation length Al for magnet thickness - cyl->SuperDetector("MAGNET"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - radius = magnet_outer_cryostat_wall_radius + magnet_outer_cryostat_wall_thickness; // outside of magnet - - if (verbosity > 0) { - cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl; - cout << " MAGNET Material Description:" << endl; - cout << " inner radius = " << magnet_inner_cryostat_wall_radius << " cm" << endl; - cout << " outer radius = " << magnet_outer_cryostat_wall_radius + magnet_outer_cryostat_wall_thickness << " cm" << endl; - cout << " length = " << magnet_length << " cm" << endl; - cout << "===========================================================================" << endl; - } - - radius += no_overlapp; - - return radius; -} diff --git a/macros/g4simulations/G4_PSTOF.C b/macros/g4simulations/G4_PSTOF.C deleted file mode 100644 index d7f9acd06..000000000 --- a/macros/g4simulations/G4_PSTOF.C +++ /dev/null @@ -1,27 +0,0 @@ -// $Id$ - -/*! - * \file ${file_name} - * \brief Macro setting up the barrel mRPC psTOF - * \author Mickey Chiu - * \version $Revision$ - * \date $Date$ - */ - -void PSTOFInit() -{} - -double PSTOF(PHG4Reco* g4Reco, double radius, const int absorberactive = 0) -{ - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - - PHG4PSTOFSubsystem *pstof = new PHG4PSTOFSubsystem( "PSTOF" ); - pstof->SuperDetector("PSTOF"); -// pstof->SetActive(-1,1); // set all modules active - g4Reco->registerSubsystem( pstof ); - -// returns the outer radius to check for overlaps with next detector - return 90.; -} diff --git a/macros/g4simulations/G4_Pipe.C b/macros/g4simulations/G4_Pipe.C deleted file mode 100644 index 195902057..000000000 --- a/macros/g4simulations/G4_Pipe.C +++ /dev/null @@ -1,108 +0,0 @@ - -void PipeInit() {} - -double Pipe(PHG4Reco* g4Reco, - double radius, - const int absorberactive = 0, - int verbosity = 0) { - - double be_pipe_radius = 2.0005; // 4.001 cm inner diameter from spec sheet - double be_pipe_thickness = 0.0760; // 760 um based on spec sheet - double be_pipe_length = 80.0; // +/- 40 cm - - double al_pipe_radius = 2.0005; // same as Be pipe - double al_pipe_thickness = 0.1600; // 1.6 mm based on spec - double al_pipe_length = 88.3; // extension beyond +/- 40 cm - - if (radius > be_pipe_radius) { - cout << "inconsistency: radius: " << radius - << " larger than pipe inner radius: " << be_pipe_radius << endl; - gSystem->Exit(-1); - } - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - // mid-rapidity beryillium pipe - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", 0); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",be_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",be_pipe_radius); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem("BE_PIPE", 1); - cyl->set_double_param("radius",be_pipe_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",be_pipe_length); - cyl->set_string_param("material","G4_Be"); - cyl->set_double_param("thickness",be_pipe_thickness); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - // north aluminum pipe - cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", 2); - cyl->set_double_param("place_z",0.5*be_pipe_length+0.5*al_pipe_length+no_overlapp); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",al_pipe_radius); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("N_AL_PIPE", 3); - cyl->set_double_param("place_z",0.5*be_pipe_length+0.5*al_pipe_length+no_overlapp); - cyl->set_double_param("radius",al_pipe_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",al_pipe_thickness); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - // south aluminum pipe - cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", 4); - cyl->set_double_param("place_z",-0.5*be_pipe_length-0.5*al_pipe_length-no_overlapp); - cyl->set_double_param("radius",0.0); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Galactic"); - cyl->set_double_param("thickness",al_pipe_radius); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - cyl = new PHG4CylinderSubsystem("S_AL_PIPE", 5); - cyl->set_double_param("place_z",-0.5*be_pipe_length-0.5*al_pipe_length-no_overlapp); - cyl->set_double_param("radius",al_pipe_radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",al_pipe_length); - cyl->set_string_param("material","G4_Al"); - cyl->set_double_param("thickness",al_pipe_thickness); - cyl->SuperDetector("PIPE"); - if (absorberactive) cyl->SetActive(); - g4Reco->registerSubsystem( cyl ); - - radius = be_pipe_radius + be_pipe_thickness; - - if (verbosity > 0) { - cout << "=========================== G4_Pipe.C::Pipe() =============================" << endl; - cout << " PIPE Material Description:" << endl; - cout << " inner radius = " << be_pipe_radius << " cm" << endl; - cout << " thickness = " << be_pipe_thickness << " cm" << endl; - cout << " outer radius = " << be_pipe_radius + be_pipe_thickness << " cm" << endl; - cout << " length = " << be_pipe_length << " cm" << endl; - cout << "===========================================================================" << endl; - } - - radius += no_overlapp; - - return radius; -} diff --git a/macros/g4simulations/G4_RICH.C b/macros/g4simulations/G4_RICH.C deleted file mode 100644 index 87da615a1..000000000 --- a/macros/g4simulations/G4_RICH.C +++ /dev/null @@ -1,51 +0,0 @@ -// $Id: G4_RICH.C,v 1.2 2013/10/09 01:08:17 jinhuang Exp $ - -/*! - * \file G4_RICH.C - * \brief Setup the gas RICH detector as designed in ePHENIX LOI - * \author Jin Huang - * \version $Revision: 1.2 $ - * \date $Date: 2013/10/09 01:08:17 $ - */ - -using namespace std; - -// global macro parameters - -void -RICHInit() -{ -} - -//! ePHENIX Gas RICH. Ref to Geometry parameter defined in ePHENIXRICH::RICH_Geometry -//! \param[in] N_RICH_Sector number of RICH sectors -//! \param[in] min_eta minimal eta coverage -//! \param[in] R_mirror_ref Radius for the reflection layer of the mirror -void -RICHSetup(PHG4Reco* g4Reco, // - const int N_RICH_Sector = 8, // - const double min_eta = 1.45, // - const double R_mirror_ref = 195, //cm - const double z_shift = 75, // cm - const double R_shift = 18.5 // cm - ) -{ - - /* Use dedicated RICH subsystem */ - PHG4RICHSubsystem *rich = new PHG4RICHSubsystem("RICH"); - rich->get_RICH_geometry().set_N_RICH_Sector(N_RICH_Sector); - rich->get_RICH_geometry().set_min_eta(min_eta); - - // rich->get_RICH_geometry().set_R_shift(10 * ePHENIXRICH::RICH_Geometry::Unit_cm()); // For compact RICH of 2get_RICH_geometry().set_R_mirror_ref(R_mirror_ref * ePHENIXRICH::RICH_Geometry::Unit_cm()); - - rich->get_RICH_geometry().set_z_shift(z_shift * ePHENIXRICH::RICH_Geometry::Unit_cm()); - rich->get_RICH_geometry().set_R_shift(R_shift * ePHENIXRICH::RICH_Geometry::Unit_cm()); - - /* Register RICH module */ - rich->OverlapCheck( overlapcheck ); - - g4Reco->registerSubsystem( rich ); - -} diff --git a/macros/g4simulations/G4_Svtx.C b/macros/g4simulations/G4_Svtx.C deleted file mode 100644 index 5aaa8381b..000000000 --- a/macros/g4simulations/G4_Svtx.C +++ /dev/null @@ -1,350 +0,0 @@ -// reference SVTX macro used for MIE projections - -int Min_si_layer = 0; -int Max_si_layer = 6; - -void SvtxInit(int verbosity = 0) -{ - Min_si_layer = 0; - Max_si_layer = 6; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { - - float svtx_inner_radius = 2.71; - - if (radius > svtx_inner_radius) { - cout << "inconsistency: radius: " << radius - << " larger than SVTX inner radius: " << svtx_inner_radius << endl; - gSystem->Exit(-1); - } - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4testbench.so"); - - PHG4CylinderSubsystem *cyl; - - //====================================================================================================== - // The thicknesses from Yasuyuki on June 12, 2014 are as follows: - // For Si 1mm = 1.07% X_0 - // For Cu 1mm = 6.96% X_0 - // The thickness of the tracking layers is: - // Pixels: 1.3% X_0 (0.21% sensor + 1.07% support) sensor = 200 mc Si, support = 154 mc Cu - // Stripixel: 5% X_0 (0.67% sensor + 4.3% support) sensor = 624 mc Si, support = 618 mc Cu - // Outer strips: 2% X_0 (conservative) (0.34% sensor + 1.66% support) sensor = 320 mc Si, support = 238 mc Cu - //======================================================================================================= - - double si_thickness[7] = {0.02, 0.02, 0.032, 0.032, 0.032, 0.032, 0.032}; - double svxrad[7] = {svtx_inner_radius, 4.63, 9.5, 10.5, 44.5, 45.5, 80.0}; // provides 98 MeV Upsilon resolution - // Thicknesses (in % X_0) of 1.3,1.3,2.7/2,2.7/2,2.0/2,2.0/2,2.0 - YA's most conservative case - double support_thickness[7] = {0.0154, 0.0154, 0.0338/2.0, 0.0338/2.0, 0.0238/2.0, 0.0238/2.0, 0.0238}; - double length[7] = {20., 20., -1, -1., - 1., - 1., -1}; // -1 use eta coverage to determine length - - // here is our silicon: - double inner_radius = radius; - for (int ilayer = Min_si_layer; ilayer <= Max_si_layer; ilayer++) - { - cyl = new PHG4CylinderSubsystem("SVTX", ilayer); - radius = svxrad[ilayer]; - // protect against installing layer with radius < inner radius from argument - if (radius < inner_radius) - { - cout << "current radius " << radius << " smaller than inner radius " - << inner_radius << endl; - gSystem->Exit(-1); - } - cyl->set_double_param("radius",radius); - if (length[ilayer] > 0) - { - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length[ilayer]); - } - else - { - cyl->set_int_param("lengthviarapidity",1); - } - cyl->set_string_param("material","G4_Si"); - cyl->set_double_param("thickness",si_thickness[ilayer]); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += si_thickness[ilayer] + no_overlapp; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", ilayer); - cyl->set_double_param("radius",radius); - if (length[ilayer] > 0) - { - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",length[ilayer]); - } - else - { - cyl->set_int_param("lengthviarapidity",1); - } - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",support_thickness[ilayer]); - if (absorberactive) cyl->SetActive(); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - } - if (ilayer != (Max_si_layer+1)) // coming out of the loop, layer is layer+1 - { - cout << "layer number mismatch for Max_si_layer, Max_si_layer " - << Max_si_layer << " should be " << ilayer << endl; - gSystem->Exit(-1); - } - radius += support_thickness[Max_si_layer] + no_overlapp; - - if (verbosity > 0) { - cout << "============================ G4_Svtx.C::Svtx() ============================" << endl; - cout << " SVTX Material Description:" << endl; - for (int ilayer = Min_si_layer; ilayer <= Max_si_layer; ilayer++) { - cout << " layer " << ilayer - << " radius " << svxrad[ilayer] - << " zlength " << length[ilayer] - << " thickness (Si) " << si_thickness[ilayer] - << " support thickness (Cu) " << support_thickness[ilayer] - << endl; - } - cout << "===========================================================================" << endl; - } - return radius; -} - -void Svtx_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //----------- - // SVTX cells - //----------- - - // The pattern recognition layers (4 & 6) are set at 2 mm in Z and 240 microns - // pitch to make the area the same as the long strips - // Layers 3, 5 and 7 are long strips parallel to the beam line - - // 60 micron X strips, 240 micron pattern reco strips - double svxcellsizex[7] = {0.0050, 0.0050, 0.0060, 0.0240, 0.0060, 0.0240, 0.0060}; - - // 8 mm tracking strips, 2 mm pattern reco strips - double svxcellsizey[7] = {0.0425, 0.0425, 0.8000, 0.2000, 0.8000, 0.2000, 0.8000}; - - PHG4CylinderCellReco *svtx_cells = new PHG4CylinderCellReco(); - svtx_cells->Detector("SVTX"); - svtx_cells->Verbosity(verbosity); - int idx = 0; - for (int i = Min_si_layer; i <= Max_si_layer; ++i) { - svtx_cells->cellsize(i, svxcellsizex[idx], svxcellsizey[idx]); - ++idx; - } - se->registerSubsystem(svtx_cells); - - return; -} - -void Svtx_Reco(int verbosity = 0) -{ - // reconstructs the MIE Svtx v2 detector (7 layers) - - // requires Svtx setup and Svtx cell routines - // prefers calorimeter reconstruction prior (once projections are working) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- - // defaults to 8-bit ADC with MIP at 0.25% dynamic range - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(verbosity); - digi->set_adc_scale(0, 255, 1.0e-6); // 1.0 keV / bit - digi->set_adc_scale(1, 255, 1.0e-6); // 1.0 keV / bit - digi->set_adc_scale(2, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(3, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(4, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(5, 255, 1.6e-6); // 1.6 keV / bit - digi->set_adc_scale(6, 255, 1.6e-6); // 1.6 keV / bit - se->registerSubsystem( digi ); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - //------------------------------------- - // defaults to 1.0 (fully active) - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - deadarea->Verbosity(verbosity); - // deadarea->set_hit_efficiency(0,0.90); - // deadarea->set_hit_efficiency(1,0.90); - // deadarea->set_hit_efficiency(2,0.98); - // deadarea->set_hit_efficiency(3,0.98); - // deadarea->set_hit_efficiency(4,0.98); - // deadarea->set_hit_efficiency(5,0.98); - // deadarea->set_hit_efficiency(6,0.98); - se->registerSubsystem( deadarea ); - - //----------------------------- - // Apply MIP thresholds to Hits - //----------------------------- - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); - thresholds->set_threshold(0,0.33); - thresholds->set_threshold(1,0.33); - thresholds->set_threshold(2,0.33); - thresholds->set_threshold(3,0.33); - thresholds->set_threshold(4,0.33); - thresholds->set_threshold(5,0.33); - thresholds->set_threshold(6,0.33); - thresholds->set_use_thickness_mip(0, true); - se->registerSubsystem( thresholds ); - - //------------- - // Cluster Hits - //------------- - // needs to have clusters hold hit ids not cell ids - // will require changes to evaluation - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer(); - clusterizer->Verbosity(verbosity); - clusterizer->set_threshold(0.33); - clusterizer->set_z_clustering(2, false); - clusterizer->set_z_clustering(3, false); - clusterizer->set_z_clustering(4, false); - clusterizer->set_z_clustering(5, false); - clusterizer->set_z_clustering(6, false); - // clusterizer->set_energy_weighting(2, true); - // clusterizer->set_energy_weighting(3, true); - // clusterizer->set_energy_weighting(4, true); - // clusterizer->set_energy_weighting(5, true); - // clusterizer->set_energy_weighting(6, true); - se->registerSubsystem( clusterizer ); - - //--------------------- - // Track reconstruction - //--------------------- - PHG4HoughTransform* hough = new PHG4HoughTransform(7,7); - hough->Verbosity(verbosity); - hough->set_mag_field(1.4); - hough->set_material(0, 0.013); - hough->set_material(1, 0.013); - hough->set_material(2, 0.013); - hough->set_material(3, 0.013); - hough->set_material(4, 0.010); - hough->set_material(5, 0.010); - hough->set_material(6, 0.020); - hough->setPtRescaleFactor(0.9972); - hough->set_chi2_cut_init(3.0); - hough->set_chi2_cut_full(3.0); - hough->set_ca_chi2_cut(3.0); - hough->setCutOnDCA(true); - hough->setDCACut(0.1); - hough->setDCAZCut(0.1); - hough->setRejectGhosts(false); - hough->setRemoveHits(false); - se->registerSubsystem( hough ); - - //--------------------- - // Ghost rejection - //--------------------- - // needs updates to merge split tracks when possible - PHG4TrackGhostRejection* rejection = new PHG4TrackGhostRejection(7); - rejection->Verbosity(verbosity); - rejection->set_max_shared_hits(3); - se->registerSubsystem( rejection ); - - //------------------------ - // Final Track Refitting - //------------------------ - // PHG4TrackKalmanFitter *kalman = new PHG4TrackKalmanFitter - // we need a module to redo the Kalman fit with G4 material and real mag field - // to update the track container - - //------------------------ - // Primary Track Refitting - //------------------------ - // PHG4TrackKalmanFitter *kalman = new PHG4TrackKalmanFitter - // we need a module to redo the Kalman fit including the vertex position - // and create a separate stream of output tracks - - //------------------ - // Track Projections - //------------------ - PHG4SvtxTrackProjection* projection = new PHG4SvtxTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem( projection ); - - //---------------------- - // Beam Spot Calculation - //---------------------- - PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); - beamspot->Verbosity(verbosity); - se->registerSubsystem( beamspot ); - - return; -} - -void G4_Svtx_Reco() -{ - cout << "\033[31;1m" - << "Warning: G4_Svtx_Reco() was moved to G4_Svtx.C and renamed to Svtx_Reco(), please update macros" - << "\033[0m" << endl; - Svtx_Reco(); - - return; -} - -void Svtx_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libg4eval.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // SVTX evaluation - //---------------- - - SubsysReco* eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_Svtx_MAPScyl_ITTcyl_TPC.C b/macros/g4simulations/G4_Svtx_MAPScyl_ITTcyl_TPC.C deleted file mode 100644 index 0942d8e4c..000000000 --- a/macros/g4simulations/G4_Svtx_MAPScyl_ITTcyl_TPC.C +++ /dev/null @@ -1,339 +0,0 @@ -#include "G4_TPC.C" - -const int n_ib_layer = 3; // number of maps inner barrel layers -const int n_intt_layer = 4; // number of int. tracker layers. Make this number 0 to use MAPS + TPC only. -const int n_gas_layer = 40; // number of TPC layers - -int Min_si_layer = 0; -int Max_si_layer = n_ib_layer + n_intt_layer + n_gas_layer; - -void SvtxInit(int verbosity = 0) -{ - Min_si_layer = 0; - Max_si_layer = n_ib_layer + n_intt_layer + n_gas_layer; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { - - float svtx_inner_radius = 2.3; - - if (radius > svtx_inner_radius) { - cout << "inconsistency: radius: " << radius - << " larger than SVTX inner radius: " << svtx_inner_radius << endl; - gSystem->Exit(-1); - } - - PHG4CylinderSubsystem *cyl; - - // silicon layers ------------------------------------------------------------ - - // inner barrel - - double ib_si_thickness[3] = {0.0050, 0.0050, 0.0050}; - double ib_rad[3] = {svtx_inner_radius, 3.2, 3.9}; - double ib_support_thickness[3] = {0.0036, 0.0036, 0.0036}; - double ib_length[3] = {27.0, 27.0, 27.0}; - - for (int ilayer=0;ilayerVerbosity(verbosity); - radius = ib_rad[ilayer]; - cyl->set_double_param("radius",radius); - //cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",ib_length[ilayer]); - cyl->set_string_param("material","G4_Si"); - cyl->set_double_param("thickness",ib_si_thickness[ilayer]); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += ib_si_thickness[ilayer] + no_overlapp; - - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", ilayer); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - //cyl->set_int_param("lengthviarapidity",1); - cyl->set_double_param("length",ib_length[ilayer]); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",ib_support_thickness[ilayer]); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - cout << "Added inner barrel layer with radius " << ib_rad[ilayer] - << " si thickness " << ib_si_thickness[ilayer] - << " support thickness " << ib_support_thickness[ilayer] - << " length " << ib_length[ilayer] - << endl; - } - - // intermediate tracker - // parameters from RIKEN - double intt_si_thickness[4] = {0.0120, 0.0120, 0.0120,0.0120}; - double intt_rad[4] = { 6.0, 8.0, 10.0, 12.0}; - // 120 microns of silicon is 0.13% of X_0, so to get 1% total we need 0.87% more in the Cu - double multiplier = 0.87; // how many times 1% do you want? - double apercent = 0.0144; // Cu thickness in cm corresponding to 1% X_0 - double intt_support_thickness[4] = {apercent*multiplier, apercent*multiplier, apercent*multiplier, apercent*multiplier}; - double intt_length[4] = {50.0, 50.0, 50.0, 50.0}; - - for (int ilayer=n_ib_layer;ilayerVerbosity(verbosity); - radius = intt_rad[ilayer-n_ib_layer]; - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",1); - //cyl->set_double_param("length",intt_length[ilayer-n_ib_layer]); - cyl->set_string_param("material","G4_Si"); - cyl->set_double_param("thickness",intt_si_thickness[ilayer-n_ib_layer]); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += intt_si_thickness[ilayer-n_ib_layer] + no_overlapp; - - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", ilayer); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",1); - //cyl->set_double_param("length", intt_length[ilayer-n_ib_layer]); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",intt_support_thickness[ilayer-n_ib_layer]); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - cout << "Added intermediate tracker layer with radius " << intt_rad[ilayer-n_ib_layer] - << " si thickness " << intt_si_thickness[ilayer-n_ib_layer] - << " support thickness " << intt_support_thickness[ilayer-n_ib_layer] - << " length " << intt_length[ilayer-n_ib_layer] - << endl; - } - - //TPC - radius = AddTPC2G4Geo(g4Reco,radius,0); - - return radius; -} - -void Svtx_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //----------- - // cells - //----------- - - // inner barrel - double svxcellsizex[3] = {0.0020, 0.0020, 0.0020}; - double svxcellsizey[3] = {0.0020, 0.0020, 0.0020}; - - // intermediate tracker - double intt_cellsizex[4] = { 0.0080, 0.0080, 0.0080, 0.0080}; // cm - double intt_cellsizey[4] = { 1.2, 1.2, 1.2, 1.2}; // cm - - PHG4CylinderCellTPCReco *svtx_cells = new PHG4CylinderCellTPCReco(n_ib_layer+n_intt_layer); - svtx_cells->Verbosity(1); - svtx_cells->Detector("SVTX"); - - for (int i=0;icellsize(i, svxcellsizex[i], svxcellsizey[i]); - svtx_cells->set_timing_window(i, -2000.0, +2000.0); - } - for (int i=n_ib_layer;icellsize(i, intt_cellsizex[i-n_ib_layer], intt_cellsizey[i-n_ib_layer]); - svtx_cells->set_timing_window(i, -50.0, +50.0); - } - - // TPC - AddTPC2CellReco(svtx_cells); - - se->registerSubsystem(svtx_cells); - return; -} - -void Svtx_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(0); - for (int i=0;iset_adc_scale(i, 255, 1.0e-6); - } - se->registerSubsystem( digi ); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - //------------------------------------- - // defaults to 1.0 (fully active) - - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - deadarea->Verbosity(verbosity); - for(int i=0;iset_hit_efficiency(i,0.99); - - for(int i=n_ib_layer;iset_hit_efficiency(i-n_ib_layer,0.99); - - se->registerSubsystem( deadarea ); - - //----------------------------- - // Apply MIP thresholds to Hits - //----------------------------- - - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); - for(int i=0;iset_threshold(i,0.25); // reduce to 0.1 for increased efficiency - - for(int i=n_ib_layer;iset_threshold(i,0.25); - - se->registerSubsystem( thresholds ); - - //------------- - // Cluster Hits - //------------- - - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer",Min_si_layer,n_ib_layer+n_intt_layer-1); - clusterizer->set_threshold(0.25); // reduced from 0.5, should be same as cell threshold, since many hits are single cell - se->registerSubsystem( clusterizer ); - - //--------------------- - // Track reconstruction - //--------------------- - PHG4HoughTransformTPC* hough = new PHG4HoughTransformTPC(Max_si_layer,Max_si_layer-30); - hough->set_mag_field(1.4); - hough->setPtRescaleFactor(1.00/0.993892); - hough->set_use_vertex(true); - hough->setRemoveHits(true); - hough->setRejectGhosts(true); - hough->set_min_pT(0.2); - hough->set_chi2_cut_full( 2.0 ); - hough->set_chi2_cut_init( 2.0 ); - - hough->setBinScale(1.0); - hough->setZBinScale(1.0); - - hough->Verbosity(verbosity); - - double mat_scale = 1.0; - // maps inner barrel, total of 0.3% of X_0 per layer - for(int i=0;iset_material(i, mat_scale*0.003); - // intermediate tracker, total 1% of X_0 pair layer - for(int i=n_ib_layer;iset_material(i-n_ib_layer, mat_scale*0.010); - - // silicon - for (int i=0;isetVoteErrorScale(i, 1.0); - } - for (int i=0;isetFitErrorScale(i, 1./sqrt(12.)); - } - - //TPC - AddTPC2Reco(digi,hough); - - se->registerSubsystem( hough ); - - //----------------------- - // Momentum Recalibration - //----------------------- - TF1 *corr = new TF1("corr","1.0/(1+0.00908642+5.91337e-05*x+-1.87201e-05*x*x+-3.31928e-06*x*x*x+1.03004e-07*x*x*x*x+-1.05111e-09*x*x*x*x*x)",0.0,40.0); - PHG4SvtxMomentumRecal* recal = new PHG4SvtxMomentumRecal("PHG4SvtxMomentumRecal",corr); - se->registerSubsystem(recal); - - //------------------ - // Track Projections - //------------------ - PHG4SvtxTrackProjection* projection = new PHG4SvtxTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem( projection ); - - //---------------------- - // Beam Spot Calculation - //---------------------- - PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); - beamspot->Verbosity(verbosity); - se->registerSubsystem( beamspot ); - - return; -} - -void G4_Svtx_Reco() -{ - cout << "\033[31;1m" - << "Warning: G4_Svtx_Reco() was moved to G4_Svtx.C and renamed to Svtx_Reco(), please update macros" - << "\033[0m" << endl; - Svtx_Reco(); - - return; -} - -void Svtx_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libg4eval.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // SVTX evaluation - //---------------- - - SvtxEvaluator* eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - eval->do_cluster_eval(true); // make cluster ntuple - eval->do_g4hit_eval(false); // make g4hit ntuple - eval->do_hit_eval(false); // make hit ntuple - eval->do_gpoint_eval(false); - //eval->scan_for_embedded(true); // evaluator will only collect embedded tracks - it will also ignore decay tracks from embedded particles! - eval->scan_for_embedded(false); // evaluator takes all tracks - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); - // se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C b/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C deleted file mode 100644 index 527ec13d6..000000000 --- a/macros/g4simulations/G4_Svtx_maps_ladders+intt_ladders+tpc_KalmanPatRec.C +++ /dev/null @@ -1,567 +0,0 @@ -#include - -// if true, refit tracks with primary vertex included in track fit - good for analysis of prompt tracks only -// Adds second node to node tree, keeps original track node undisturbed -// Adds second evaluator to process refitted tracks and outputs separate ntuples -bool use_primary_vertex = false; - -const int n_maps_layer = 3; // must be 0-3, setting it to zero removes MVTX completely, n < 3 gives the first n layers -const int n_intt_layer = 4; // must be 0-4, setting this to zero will remove the INTT completely, n < 4 gives you the first n layers -int n_gas_layer = 40; - -double inner_cage_radius = 20.; - -// TPC readout shaping time and ADC clock parameters -//======================================= - -double TPCDriftVelocity = 3.0 / 1000.0; // cm/ns -double TPCShapingRMSLead = 32.0; // ns, rising RMS equivalent of shaping amplifier for 80 ns SAMPA -double TPCShapingRMSTail = 48.0; // ns, falling RMS equivalent of shaping amplifier for 80 ns SAMPA -double TPCADCClock = 53.0; // ns, corresponds to an ADC clock rate of 18.8 MHz - -double tpc_cell_x = 0.15; // bin size for pads in rphi -double tpc_cell_y = TPCADCClock * TPCDriftVelocity; // cm - -int Max_si_layer; - -void SvtxInit(int n_TPC_layers = 40, int verbosity = 0) -{ - n_gas_layer = n_TPC_layers; - Max_si_layer = n_maps_layer + n_intt_layer + n_gas_layer; -} - -double Svtx(PHG4Reco* g4Reco, double radius, - const int absorberactive = 0, - int verbosity = 0) { - - if(n_maps_layer > 0) - { - bool maps_overlapcheck = false; // set to true if you want to check for overlaps - - /* - The numbers used in the macro below are from the xml file dump of ITS.gdml - As a sanity check, I got numbers from Walt Sondheim's drawings, sent by email June 20, 2017: - OD of Be beam pipe is 41.53 mm, ID is 40 mm - Layer 0: radius 23.44 mm to sensor center, tilt from normal to radial vector: 17.37 degrees (0.303 rad), spacing btw sensor centers: 30 deg, arc spacing 12.27 mm - Layer 1: radius 31.54 mm to sensor center, ttilt from normal to radial vector: 17.53 degrees (0.306 rad), spacing btw sensor centers: 22.5 deg, arc spacing 12.38 mm - Layer 2: radius 39.29 to sensor center, tilt from normal to radial vector: 17.02 degrees (0.297 rad), spacing btw sensor centers: 18.0 deg, arc spacing 12.34 mm - These are in reasonable agreement with the numbers I extracted from the gdml file, which are what we use below. - These use a spacing in arc length of 12.37 mm and a tilt of 0.304 for all of the first three layers - */ - - // MAPS inner barrel layers - //====================================================== - - double maps_layer_radius[3] = {23.4, 31.5, 39.3}; // mm - precise numbers from ITS.gdml - //double maps_layer_radius[3] = {24.9, 33.0, 40.8}; // mm - precise numbers from ITS.gdml + 1.5 mm for greater clearance from beam pipe - - // type 1 = inner barrel stave, 2 = middle barrel stave, 3 = outer barrel stave - // we use only type 0 here - int stave_type[3] = {0, 0, 0}; - int staves_in_layer[3] = {12, 16, 20}; // Number of staves per layer in sPHENIX MVTX - double phi_tilt[3] = {0.304, 0.304, 0.304}; // radians, from the gdml file, 0.304 radians is 17.4 degrees - - for (int ilayer = 0; ilayer < n_maps_layer; ilayer++) - { - if (verbosity) - cout << "Create Maps layer " << ilayer << " with radius " << maps_layer_radius[ilayer] << " mm, stave type " << stave_type[ilayer] - << " pixel size 30 x 30 microns " << " active pixel thickness 0.0018 microns" << endl; - - PHG4MapsSubsystem *lyr = new PHG4MapsSubsystem("MAPS", ilayer, stave_type[ilayer]); - lyr->Verbosity(verbosity); - - lyr->set_double_param("layer_nominal_radius",maps_layer_radius[ilayer]);// thickness in cm - lyr->set_int_param("N_staves", staves_in_layer[ilayer]); // uses fixed number of staves regardless of radius, if set. Otherwise, calculates optimum number of staves - - // The cell size is used only during pixilization of sensor hits, but it is convemient to set it now because the geometry object needs it - lyr->set_double_param("pixel_x",0.0030);// pitch in cm - lyr->set_double_param("pixel_z",0.0030);// length in cm - lyr->set_double_param("pixel_thickness",0.0018);// thickness in cm - lyr->set_double_param("phitilt", phi_tilt[ilayer]); - - lyr->set_int_param("active",1); - lyr->OverlapCheck(maps_overlapcheck); - - lyr->set_string_param("stave_geometry_file", - string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/ALICE_ITS_tgeo.gdml")); - - g4Reco->registerSubsystem( lyr ); - - radius = maps_layer_radius[ilayer]; - } - } - - if(n_intt_layer > 0) - { - //------------------- - // INTT ladders - //------------------- - - bool intt_overlapcheck = false; // set to true if you want to check for overlaps - - // instantiate the Silicon tracker subsystem and register it - // We make one instance of PHG4TrackerSubsystem for all four layers of tracker - // dimensions are in mm, angles are in radians - - // PHG4SiliconTrackerSubsystem creates the detetor layer using PHG4SiliconTrackerDetector - // and instantiates the appropriate PHG4SteppingAction - const double intt_radius_max = 140.; // including stagger radius (mm) - - // The length of vpair is used to determine the number of layers - std::vector> vpair; // (sphxlayer, inttlayer) - for(int i=0;iVerbosity(verbosity); - sitrack->SetActive(1); - sitrack->OverlapCheck(intt_overlapcheck); - g4Reco->registerSubsystem( sitrack); - - // outer radius marker (translation back to cm) - radius = intt_radius_max*0.1; - } - - // time projection chamber layers -------------------------------------------- - - PHG4CylinderSubsystem *cyl; - - radius = inner_cage_radius; - - double cage_length = 211.0; // From TPC group, gives eta = 1.1 at 78 cm - double n_rad_length_cage = 1.13e-02; - double cage_thickness = 28.6 * n_rad_length_cage; // Kapton X_0 = 28.6 cm // mocks up Kapton + carbon fiber structure - - // inner field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material","G4_KAPTON"); - cyl->set_double_param("thickness",cage_thickness ); - cyl->SuperDetector("SVTXSUPPORT"); - cyl->Verbosity(0); - g4Reco->registerSubsystem( cyl ); - - radius += cage_thickness; - - double inner_readout_radius = 30.; - if (inner_readout_radius 0) { - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + 1); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material",tpcgas.c_str()); - cyl->set_double_param("thickness", inner_readout_radius - radius); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - } - - radius = inner_readout_radius; - - double outer_radius = 78.; - int npoints = Max_si_layer - n_maps_layer - n_intt_layer; - double delta_radius = ( outer_radius - inner_readout_radius )/( (double)npoints ); - - for(int ilayer=n_maps_layer + n_intt_layer;ilayer<(n_maps_layer + n_intt_layer + npoints);++ilayer) { - - if (verbosity) - cout << "Create TPC gas layer " << ilayer << " with radius " << radius << " cm " - << " thickness " << delta_radius - 0.01 << " length " << cage_length << endl; - - cyl = new PHG4CylinderSubsystem("SVTX", ilayer); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material",tpcgas.c_str()); - cyl->set_double_param("thickness", delta_radius - 0.01 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - - radius += delta_radius; - } - - // outer field cage - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", n_maps_layer + n_intt_layer + npoints); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",cage_length); - cyl->set_string_param("material","G4_KAPTON"); - cyl->set_double_param("thickness",cage_thickness ); // Kapton X_0 = 28.6 cm - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += cage_thickness; - - return radius; -} - -void Svtx_Cells(int verbosity = 0) -{ - // runs the cellularization of the energy deposits (g4hits) - // into detector hits (g4cells) - - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //----------- - // SVTX cells - //----------- - - if(n_maps_layer > 0) - { - // MAPS cells - PHG4MapsCellReco *maps_cells = new PHG4MapsCellReco("MAPS"); - maps_cells->Verbosity(verbosity); - for(int ilayer = 0;ilayer < n_maps_layer;ilayer++) - { - maps_cells->set_timing_window(ilayer,-2000,2000); - } - se->registerSubsystem(maps_cells); - } - - if(n_intt_layer > 0) - { - // INTT cells - PHG4SiliconTrackerCellReco *reco = new PHG4SiliconTrackerCellReco("SILICON_TRACKER"); - // The timing windows are hard-coded in the INTT ladder model - reco->Verbosity(verbosity); - se->registerSubsystem(reco); - } - - // TPC cell sizes are defined at top of macro, this is for backward compatibility with old hits files - if(n_gas_layer == 60) - { - TPCDriftVelocity = 6.0 / 1000.0; // cm/ns - tpc_cell_x = 0.12; - tpc_cell_y = 0.17; - } - - // Main switch for TPC distortion - const bool do_tpc_distortion = true; - PHG4TPCSpaceChargeDistortion* tpc_distortion = NULL; - if (do_tpc_distortion) { - if (inner_cage_radius != 20. && inner_cage_radius != 30.) { - cout << "Svtx_Cells - Fatal Error - TPC distortion required that " - "inner_cage_radius is either 20 or 30 cm." - << endl; - exit(3); - } - - - string TPC_distortion_file = - string(getenv("CALIBRATIONROOT")) + - Form("/Tracking/TPC/SpaceChargeDistortion/TPCCAGE_20_78_211_2.root"); - PHG4TPCSpaceChargeDistortion* tpc_distortion = - new PHG4TPCSpaceChargeDistortion(TPC_distortion_file); - //tpc_distortion -> setAccuracy(0); // option to over write default factors - //tpc_distortion -> setPrecision(0.001); // option to over write default factors // default is 0.001 - } - - PHG4CylinderCellTPCReco *svtx_cells = new PHG4CylinderCellTPCReco(n_maps_layer+n_intt_layer); - svtx_cells->Detector("SVTX"); - svtx_cells->setDistortion(tpc_distortion); - if(n_gas_layer == 40) - { - svtx_cells->setDiffusionT(0.0130); - svtx_cells->setDiffusionL(0.0130); - svtx_cells->setShapingRMSLead(TPCShapingRMSLead * TPCDriftVelocity); - svtx_cells->setShapingRMSTail(TPCShapingRMSTail * TPCDriftVelocity); - // Expected cluster resolutions: - // r-phi: diffusion + GEM smearing = 750 microns, assume resolution is 20% of that => 150 microns - // Z: amplifier shaping time (RMS 32 ns, 48 ns) and drift vel of 3 cm/microsec gives smearing of 3 x (32+48/2 = 1.2 mm, assume resolution is 20% of that => 240 microns - svtx_cells->setSmearRPhi(0.10); // additional random displacement of cloud positions wrt hits to give expected cluster resolution of 150 microns for charge at membrane - svtx_cells->setSmearZ(0.15); // additional random displacement of cloud positions wrt hits to give expected cluster rsolution of 240 microns for charge at membrane - } - else - { - // 60 layer tune - svtx_cells->setDiffusionT(0.0120); - svtx_cells->setDiffusionL(0.0120); - svtx_cells->setSmearRPhi(0.09); // additional smearing of cluster positions - svtx_cells->setSmearZ(0.06); // additional smearing of cluster positions - } - svtx_cells->set_drift_velocity(TPCDriftVelocity); - svtx_cells->setHalfLength( 105.5 ); - svtx_cells->setElectronsPerKeV(28); - svtx_cells->Verbosity(0); - - // The maps cell size is set when the detector is constructed because it is needed by the geometry object - // The INTT ladder cell size is set in the detector construction code - // set cylinder cell TPC cell sizes - for (int i=n_maps_layer + n_intt_layer;icellsize(i, tpc_cell_x, tpc_cell_y); - svtx_cells->set_timing_window(i, -14000.0, +14000.0); - } - - se->registerSubsystem(svtx_cells); - - return; -} - -void Svtx_Reco(int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4hough.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------------------------- - // Digitize the cell energy into ADC - //---------------------------------- - PHG4SvtxDigitizer* digi = new PHG4SvtxDigitizer(); - digi->Verbosity(0); - for (int i=0;iset_adc_scale(i, 255, 0.4e-6); // reduced by a factor of 2.5 when going from maps thickess of 50 microns to 18 microns - } - - if(n_intt_layer > 0) - { - // INTT - std::vector userrange; // 3-bit ADC threshold relative to the mip_e at each layer. - // these should be used for the INTT - userrange.push_back(0.05); - userrange.push_back(0.10); - userrange.push_back(0.15); - userrange.push_back(0.20); - userrange.push_back(0.25); - userrange.push_back(0.30); - userrange.push_back(0.35); - userrange.push_back(0.40); - - PHG4SiliconTrackerDigitizer* digiintt = new PHG4SiliconTrackerDigitizer(); - digiintt->Verbosity(verbosity); - for(int i=0;iset_adc_scale(n_maps_layer+i, userrange); - } - se->registerSubsystem( digiintt ); - } - - // TPC layers - for (int i=n_maps_layer+n_intt_layer;iset_adc_scale(i, 30000, 1.0); - } - se->registerSubsystem( digi ); - - //------------------------------------- - // Apply Live Area Inefficiency to Hits - //------------------------------------- - // defaults to 1.0 (fully active) - - PHG4SvtxDeadArea* deadarea = new PHG4SvtxDeadArea(); - - for(int i = 0;iVerbosity(verbosity); - //deadarea->set_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i,1.0); - } - for(int i=n_maps_layer;iset_hit_efficiency(i,0.99); - deadarea->set_hit_efficiency(i,1.0); - } - se->registerSubsystem( deadarea ); - - //----------------------------- - // Apply MIP thresholds to Hits - //----------------------------- - - PHG4SvtxThresholds* thresholds = new PHG4SvtxThresholds(); - thresholds->Verbosity(verbosity); - - // maps - for(int i = 0;iset_threshold(i,0.1); - } - // INTT - for(int i=n_maps_layer;iset_threshold(i,0.1); - thresholds->set_use_thickness_mip(i, true); - - } - - se->registerSubsystem( thresholds ); - - //------------- - // Cluster Hits - //------------- - - PHG4SvtxClusterizer* clusterizer = new PHG4SvtxClusterizer("PHG4SvtxClusterizer",0, n_maps_layer + n_intt_layer-1); - clusterizer->Verbosity(verbosity); - // Reduced by 2 relative to the cylinder cell maps macro. I found this necessary to get full efficiency - // Many hits in the present simulation are single cell hits, so it is not clear why the cluster threshold should be higher than the cell threshold - clusterizer->set_threshold(0.1); // fraction of a mip - // no Z clustering for INTT layers (only) - for(int i=n_maps_layer;iset_z_clustering(i, false); - } - - se->registerSubsystem( clusterizer ); - - PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer(); - tpcclusterizer->Verbosity(0); - tpcclusterizer->setRangeLayers(n_maps_layer+n_intt_layer,Max_si_layer); - if(n_gas_layer == 40) - { - tpcclusterizer->setEnergyCut(12/*15 adc*/); - tpcclusterizer->setFitWindowSigmas(0.0160,0.0160); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(4/*rphibins*/,6/*zbins*/); - tpcclusterizer->setFitEnergyThreshold( 0.05 /*fraction*/ ); - } - else - { - // 60 layer tune - tpcclusterizer->setEnergyCut(15/*adc*/); - tpcclusterizer->setFitWindowSigmas(0.0150,0.0160); // should be changed when TPC cluster resolution changes - tpcclusterizer->setFitWindowMax(4/*rphibins*/,3/*zbins*/); - tpcclusterizer->setFitEnergyThreshold( 0.05 /*fraction*/ ); - } - se->registerSubsystem( tpcclusterizer ); - - // This should be true for everything except testing! - const bool use_kalman_pat_rec = true; - if (use_kalman_pat_rec) { - //--------------------- - // PHG4KalmanPatRec - //--------------------- - - PHG4KalmanPatRec* kalman_pat_rec = new PHG4KalmanPatRec("PHG4KalmanPatRec", n_maps_layer, n_intt_layer, n_gas_layer); - kalman_pat_rec->Verbosity(0); - se->registerSubsystem(kalman_pat_rec); - - } else { - //--------------------- - // Truth Pattern Recognition - //--------------------- - PHG4TruthPatRec* pat_rec = new PHG4TruthPatRec(); - se->registerSubsystem(pat_rec); - - } - - //--------------------- - // Kalman Filter - //--------------------- - - PHG4TrackKalmanFitter* kalman = new PHG4TrackKalmanFitter(); - kalman->Verbosity(0); - if(use_primary_vertex) - kalman->set_fit_primary_tracks(true); // include primary vertex in track fit if true - se->registerSubsystem(kalman); - - - //------------------ - // Track Projections - //------------------ - PHG4SvtxTrackProjection* projection = new PHG4SvtxTrackProjection(); - projection->Verbosity(verbosity); - se->registerSubsystem( projection ); - - /* - //---------------------- - // Beam Spot Calculation - //---------------------- - PHG4SvtxBeamSpotReco* beamspot = new PHG4SvtxBeamSpotReco(); - beamspot->Verbosity(verbosity); - se->registerSubsystem( beamspot ); - */ - - return; -} - -void G4_Svtx_Reco() -{ - cout << "\033[31;1m" - << "Warning: G4_Svtx_Reco() was moved to G4_Svtx.C and renamed to Svtx_Reco(), please update macros" - << "\033[0m" << endl; - Svtx_Reco(); - - return; -} - -void Svtx_Eval(std::string outputfile, int verbosity = 0) -{ - //--------------- - // Load libraries - //--------------- - - gSystem->Load("libfun4all.so"); - gSystem->Load("libg4detectors.so"); - gSystem->Load("libg4hough.so"); - gSystem->Load("libg4eval.so"); - - //--------------- - // Fun4All server - //--------------- - - Fun4AllServer *se = Fun4AllServer::instance(); - - //---------------- - // SVTX evaluation - //---------------- - - SvtxEvaluator* eval; - eval = new SvtxEvaluator("SVTXEVALUATOR", outputfile.c_str()); - eval->do_cluster_eval(true); - eval->do_g4hit_eval(true); - eval->do_hit_eval(false); - eval->do_gpoint_eval(false); - eval->scan_for_embedded(false); // take all tracks if false - take only embedded tracks if true - eval->Verbosity(verbosity); - se->registerSubsystem( eval ); - - - if(use_primary_vertex) - { - // make a second evaluator that records tracks fitted with primary vertex included - // good for analysis of prompt tracks, particularly if MVTX is not present - SvtxEvaluator* evalp; - evalp = new SvtxEvaluator("SVTXEVALUATOR", string(outputfile.c_str()) + "_primary_eval.root", "PrimaryTrackMap"); - evalp->do_cluster_eval(true); - evalp->do_g4hit_eval(true); - evalp->do_hit_eval(false); - evalp->do_gpoint_eval(false); - evalp->scan_for_embedded(true); // take all tracks if false - take only embedded tracks if true - evalp->Verbosity(0); - se->registerSubsystem( evalp ); - } - - // MomentumEvaluator* eval = new MomentumEvaluator(outputfile.c_str(),0.2,0.4,Max_si_layer,2,Max_si_layer-4,10.,80.); - // se->registerSubsystem( eval ); - - return; -} diff --git a/macros/g4simulations/G4_TPC.C b/macros/g4simulations/G4_TPC.C deleted file mode 100644 index 352645bee..000000000 --- a/macros/g4simulations/G4_TPC.C +++ /dev/null @@ -1,247 +0,0 @@ -//Three radial modules |-||-||-| -//Sixteen layers per module -//Choosing Readable Radius => 23.1 cm to 75cm => module size is 17.3 -//OPTION 1: -//R1: 6 cards/R1 * 12 R1/end * 2 end/TPC = 144 cards/TPC -//R2: 8 cards/R2 * 12 R2/end * 2 end/TPC = 192 cards/TPC -//R3: 12 cards/R3 * 12 R3/end * 2 end/TPC = 288 cards/TPC -//TOTAL = 624 cards/TPC * 8 SAMPA/card = 4992 SAMPA/TPC * 32 channels/SAMPA = 159,744 channels/TPC - -const double TPC_CAGE_LENGTH = 211.; -const double TPC_CAGE_IR = 20.; -const double TPC_CAGE_OR = 78.; -const int TPC_MOD_NLAY = 16; -const int TPC_MOD_CH[3] = {1152,1536,2304}; -const int TPC_GAS_LAYERS = TPC_MOD_NLAY*5/2; -const int previous_active_layers = 3/*maps*/ + 4/*itt*/; -double TPC_RI[TPC_GAS_LAYERS]; - -double AddTPC2G4Geo(PHG4Reco* g4Reco, double radius, int verbosity) { - cout << "TPC::AddTPC2G4Geo called" << endl; - if(radius > TPC_CAGE_IR) { - cout << "ConstructDetector_TPC: No space for TPC" << endl; - exit(0); - } - - int previous_support_layers = 3/*maps*/ + 4/*itt*/; - - PHG4CylinderSubsystem *cyl; - - radius = TPC_CAGE_IR; - - double n_rad_length_cage = 1.0e-02; - double cage_thickness = 1.436 * n_rad_length_cage; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++ ); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",cage_thickness ); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += cage_thickness; - - TString tpcgas = "G4_Ar"; - double st_mod = 23.1; - const double TPC_MOD_DR = 17.3; - const double TPC_MOD_WL = 0.3; - const double lay_dr = (TPC_MOD_DR - TPC_MOD_WL*2)/double(TPC_MOD_NLAY); - - //=== GAS UNTIL FIRST READOUT - double delta = TPC_MOD_DR/2 + st_mod - radius; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += delta; - - //=== ACTIVE FIRST HALF MODULE - delta = lay_dr; - for(int ilayer=0; ilayerVerbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta-0.0038 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - radius += delta; - } - - //=== GAS UNTIL SECOND READOUT - double delta = 0.6; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += delta; - - //=== ACTIVE SECOND MODULE - delta = lay_dr; - for(int ilayer=TPC_MOD_NLAY/2; ilayerVerbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta-0.0038 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - radius += delta; - } - - //=== GAS UNTIL THIRD READOUT - double delta = 0.6; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius += delta; - - //=== ACTIVE THIRD MODULE - delta = lay_dr; - for(int ilayer=TPC_MOD_NLAY*3/2; ilayerVerbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness", delta-0.0038 ); - cyl->SetActive(); - cyl->SuperDetector("SVTX"); - g4Reco->registerSubsystem( cyl ); - radius += delta; - } - - //=== GAS UNTIL OUTER CAGE - delta = TPC_CAGE_OR-cage_thickness - radius; - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material",tpcgas.Data()); - cyl->set_double_param("thickness",delta); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius = TPC_CAGE_OR-cage_thickness; - - //=== OUTER CAGE - cyl = new PHG4CylinderSubsystem("SVTXSUPPORT", previous_support_layers++); - cyl->Verbosity(verbosity); - cyl->set_double_param("radius",radius); - cyl->set_int_param("lengthviarapidity",0); - cyl->set_double_param("length",TPC_CAGE_LENGTH); - cyl->set_string_param("material","G4_Cu"); - cyl->set_double_param("thickness",cage_thickness ); - cyl->SuperDetector("SVTXSUPPORT"); - g4Reco->registerSubsystem( cyl ); - - radius = TPC_CAGE_OR; - - return radius; -} - -void AddTPC2CellReco(PHG4CylinderCellTPCReco *svtx_cells, int verbosity=0) { - cout << "TPC::AddTPC2CellReco called" << endl; - const bool do_tpc_distoration = false;//true; - const double diffusion = 0.0057; - const double electrons_per_kev = 38.; - - PHG4TPCSpaceChargeDistortion* tpc_distortion = NULL; - if(do_tpc_distoration) { - if(TPC_CAGE_IR != 20. && TPC_CAGE_IR != 30.) { - cout << "Svtx_Cells - Fatal Error - TPC distoration required that " - "TPC_CAGE_IR is either 20 or 30 cm." - << endl; - exit(3); - } - string TPC_distroation_file = string(getenv("CALIBRATIONROOT")) + Form("/Tracking/TPC/SpaceChargeDistortion/sPHENIX%.0f.root",TPC_CAGE_IR); - PHG4TPCSpaceChargeDistortion* tpc_distortion = new PHG4TPCSpaceChargeDistortion(TPC_distroation_file); - // tpc_distortion -> setAccuracy(0); // option to overwrite default - // tpc_distortion -> setPrecision(1); // option to overwrite default - } - svtx_cells->setDistortion(tpc_distortion); // apply TPC distrotion if tpc_distortion is not NULL - svtx_cells->setDiffusion(diffusion); - svtx_cells->setElectronsPerKeV(electrons_per_kev); - - if(verbosity>0) { - for(int i=0; i!=TPC_GAS_LAYERS; ++i) - cout << "Added TPC layer " << i << " starting at " << TPC_RI[i] << " cm." << endl; - } - - const double tpc_dt = 0.17; - //=== FIRST MODULE - for(int i=0; icellsize(previous_active_layers+i, tpc_rdphi, tpc_dt); - svtx_cells->set_timing_window(previous_active_layers+i, -14000.0, +14000.0); - } - //=== SECOND MODULE - for(int i=TPC_MOD_NLAY/2; icellsize(previous_active_layers+i, tpc_rdphi, tpc_dt); - svtx_cells->set_timing_window(previous_active_layers+i, -14000.0, +14000.0); - } - //=== THIRD MODULE - for(int i=TPC_MOD_NLAY*3/2; icellsize(previous_active_layers+i, tpc_rdphi, tpc_dt); - svtx_cells->set_timing_window(previous_active_layers+i, -14000.0, +14000.0); - } - return; -} - -void AddTPC2Reco(PHG4SvtxDigitizer* digi, PHG4HoughTransformTPC* hough) { - cout << "TPC::AddTPC2Reco called" << endl; - Fun4AllServer *se = Fun4AllServer::instance(); - - //clusterizer - PHG4TPCClusterizer* tpcclusterizer = new PHG4TPCClusterizer("PHG4TPCClusterizer",3,4,previous_active_layers,previous_active_layers+TPC_GAS_LAYERS); - tpcclusterizer->setEnergyCut(20.0*45.0/TPC_GAS_LAYERS); - se->registerSubsystem( tpcclusterizer ); - //digitizer - for(int i=previous_active_layers;iset_adc_scale(i, 10000, 1.0); - } - //hough - hough->setUseCellSize(true); - double mat_scale = 1.0; - for(int i=previous_active_layers;iset_material(i, mat_scale*0.06/TPC_GAS_LAYERS); - hough->setFitErrorScale(i, 1./sqrt(12.)); - hough->setVoteErrorScale(i, 1.0); - } - hough->set_material(previous_active_layers, mat_scale*0.010); // TPC inner field cage wall, 1% of X_0 - return; -} diff --git a/macros/prototype2/DisplayOn.C b/macros/prototype2/DisplayOn.C deleted file mode 100644 index 4197f6143..000000000 --- a/macros/prototype2/DisplayOn.C +++ /dev/null @@ -1,34 +0,0 @@ -// stupid macro to turn on the geant4 display -// we ask Fun4All for a pointer to PHG4Reco -// using the ApplyCommand will start up the -// G4 cmd interpreter and graphics system -// the vis.mac contains the necessary commands to -// start up the visualization, the next event will -// be displayed. Do not execute this macro -// before PHG4Reco was registered with Fun4All -PHG4Reco * DisplayOn(const char *mac = "vis_prototype2.mac") -{ - char cmd[100]; - Fun4AllServer *se = Fun4AllServer::instance(); - PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO"); - g4->InitRun(se->topNode()); - sprintf(cmd, "/control/execute %s", mac); - g4->ApplyCommand(cmd); - return g4; -} -// print out the commands I always forget -void displaycmd() -{ - cout << "draw axis: " << endl; - cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl; - cout << "zoom" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl; - cout << "viewpoint:" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl; - cout << "panTo:" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl; - cout << "print to eps:" << endl; - cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl; - cout << "set background color:" << endl; - cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl; -} diff --git a/macros/prototype2/Fun4All_G4_Prototype2.C b/macros/prototype2/Fun4All_G4_Prototype2.C deleted file mode 100644 index d2217c76d..000000000 --- a/macros/prototype2/Fun4All_G4_Prototype2.C +++ /dev/null @@ -1,529 +0,0 @@ -int Fun4All_G4_Prototype2(int nEvents = 1) -{ - - gSystem->Load("libfun4all"); - gSystem->Load("libg4detectors"); - gSystem->Load("libg4testbench"); - gSystem->Load("libg4histos"); - gSystem->Load("libg4eval.so"); - gSystem->Load("libqa_modules"); - - bool cemc_on = true; - bool cemc_cell = cemc_on && true; - bool cemc_twr = cemc_cell && true; - bool cemc_digi = cemc_twr && true; - bool cemc_twrcal = cemc_digi && true; - - bool ihcal_on = true; - bool ihcal_cell = ihcal_on && true; - bool ihcal_twr = ihcal_cell && true; - bool ihcal_digi = ihcal_twr && true; - bool ihcal_twrcal = ihcal_digi && true; - - bool ohcal_on = true; - bool ohcal_cell = ohcal_on && true; - bool ohcal_twr = ohcal_cell && true; - bool ohcal_digi = ohcal_twr && true; - bool ohcal_twrcal = ohcal_digi && true; - - bool cryo_on = true; - bool bh_on = true; - bool hit_ntuple = false; - bool dstreader = true; - bool dstoutput = false; - - /////////////////////////////////////////// - // Make the Server - ////////////////////////////////////////// - Fun4AllServer *se = Fun4AllServer::instance(); - // se->Verbosity(1); - recoConsts *rc = recoConsts::instance(); - // only set this if you want a fixed random seed to make - // results reproducible for testing - // rc->set_IntFlag("RANDOMSEED",12345); - - // Test beam generator - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("pi-", 1); // mu-,e-,anti_proton,pi- - gen->set_vertex_distribution_mean(0.0, 0.0, 0); - gen->set_vertex_distribution_width(0.0, .7, .7); // Rough beam profile size @ 16 GeV measured by Abhisek - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Gaus, - PHG4SimpleEventGenerator::Gaus, PHG4SimpleEventGenerator::Gaus); // Gauss beam profile - gen->set_eta_range(-.001, .001); // 1mrad angular divergence - gen->set_phi_range(-.001, .001); // 1mrad angular divergence - const double momentum = 32; - gen->set_p_range(momentum,momentum, momentum*2e-2); // 2% momentum smearing - se->registerSubsystem(gen); - - // Simple single particle generator - PHG4ParticleGun *gun = new PHG4ParticleGun(); - // gun->set_name("anti_proton"); - // gun->set_name("geantino"); - gun->set_name("proton"); - gun->set_vtx(0, 0, 0); - gun->set_mom(120, 0, 0); - // gun->AddParticle("geantino",1.7776,-0.4335,0.); - // gun->AddParticle("geantino",1.7709,-0.4598,0.); - // gun->AddParticle("geantino",2.5621,0.60964,0.); - // gun->AddParticle("geantino",1.8121,0.253,0.); - // se->registerSubsystem(gun); - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_field(0); - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); // uncomment this line to enable the high-precision neutron simulation physics list, QGSP_BERT_HP - - //---------------------------------------- - // EMCal G4 - //---------------------------------------- - if (cemc_on) - { - PHG4SpacalPrototypeSubsystem *cemc; - cemc = new PHG4SpacalPrototypeSubsystem("CEMC"); - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - cemc->SetAbsorberActive(); - cemc->OverlapCheck(true); - cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); - cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Geometry/") ); - // cemc->set_double_param("z_rotation_degree", 15); // rotation around CG - cemc->set_double_param("xpos", (116.77 + 137.0)*.5 - 26.5 - 10.2); // location in cm of EMCal CG. Updated with final positioning of EMCal - cemc->set_double_param("ypos", 4); // put it some where in UIUC blocks - cemc->set_double_param("zpos", 4); // put it some where in UIUC blocks - g4Reco->registerSubsystem(cemc); - } - //---------------------------------------- - // HCal G4 - //---------------------------------------- - if (ihcal_on) - { - PHG4Prototype2InnerHcalSubsystem *innerhcal = new PHG4Prototype2InnerHcalSubsystem("HCalIn"); - innerhcal->SetActive(); - innerhcal->SetAbsorberActive(); - innerhcal->SetAbsorberTruth(1); - innerhcal->OverlapCheck(true); - innerhcal->SuperDetector("HCALIN"); - g4Reco->registerSubsystem(innerhcal); - } - if (ohcal_on) - { - PHG4Prototype2OuterHcalSubsystem *outerhcal = new PHG4Prototype2OuterHcalSubsystem("HCalOut"); - outerhcal->SetActive(); - outerhcal->SetAbsorberActive(); - outerhcal->SetAbsorberTruth(1); - outerhcal->OverlapCheck(true); - outerhcal->SuperDetector("HCALOUT"); - g4Reco->registerSubsystem(outerhcal); - } - // Cryostat from engineering drawing - if (cryo_on) - { - PHG4BlockSubsystem *cryo1 = new PHG4BlockSubsystem("cryo1",1); - cryo1->set_double_param("size_x",0.95); - cryo1->set_double_param("size_y",60.96); - cryo1->set_double_param("size_z",60.96); - cryo1->set_double_param("place_x",141.96+0.95/2.); - cryo1->set_string_param("material","G4_Al"); - cryo1->SetActive(); // it is an active volume - save G4Hits - cryo1->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo1); - - PHG4BlockSubsystem *cryo2 = new PHG4BlockSubsystem("cryo2",2); - cryo2->set_double_param("size_x",8.89); - cryo2->set_double_param("size_y",60.96); - cryo2->set_double_param("size_z",60.96); - cryo2->set_double_param("place_x",150.72+8.89/2.); - cryo2->set_string_param("material","G4_Al"); - cryo2->SetActive(); // it is an active volume - save G4Hits - cryo2->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo2); - - PHG4BlockSubsystem *cryo3 = new PHG4BlockSubsystem("cryo3",3); - cryo3->set_double_param("size_x",2.54); - cryo3->set_double_param("size_y",60.96); - cryo3->set_double_param("size_z",60.96); - cryo3->set_double_param("place_x",173.93+2.54/2.); - cryo3->set_string_param("material","G4_Al"); - cryo3->SetActive(); // it is an active volume - save G4Hits - cryo3->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo3); - } - // BLACKHOLE, box surrounding the prototype to check for leakage - if (bh_on) - { - PHG4BlockSubsystem *bh[5]; - // surrounding outer hcal - // top - bh[0] = new PHG4BlockSubsystem("bh1",1); - bh[0]->set_double_param("size_x",270.); - bh[0]->set_double_param("size_y",0.01); - bh[0]->set_double_param("size_z",165.); - bh[0]->set_double_param("place_x",270./2.); - bh[0]->set_double_param("place_y",125./2.); - // bottom - bh[1] = new PHG4BlockSubsystem("bh2",2); - bh[1]->set_double_param("size_x",270.); - bh[1]->set_double_param("size_y",0.01); - bh[1]->set_double_param("size_z",165.); - bh[1]->set_double_param("place_x",270./2.); - bh[1]->set_double_param("place_y",-125./2.); - // right side - bh[2] = new PHG4BlockSubsystem("bh3",3); - bh[2]->set_double_param("size_x",270.); - bh[2]->set_double_param("size_y",125.); - bh[2]->set_double_param("size_z",0.01); - bh[2]->set_double_param("place_x",270./2.); - bh[2]->set_double_param("place_z",165./2.); - // left side - bh[3] = new PHG4BlockSubsystem("bh4",4); - bh[3]->set_double_param("size_x",270.); - bh[3]->set_double_param("size_y",125.); - bh[3]->set_double_param("size_z",0.01); - bh[3]->set_double_param("place_x",270./2.); - bh[3]->set_double_param("place_z",-165./2.); - // back - bh[4] = new PHG4BlockSubsystem("bh5",5); - bh[4]->set_double_param("size_x",0.01); - bh[4]->set_double_param("size_y",125.); - bh[4]->set_double_param("size_z",165.); - bh[4]->set_double_param("place_x",270.); - for (int i=0; i<5; i++) - { - bh[i]->BlackHole(); - bh[i]->SetActive(); - bh[i]->SuperDetector("BlackHole"); - bh[i]->OverlapCheck(true); - g4Reco->registerSubsystem(bh[i]); - } - } - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - - se->registerSubsystem( g4Reco ); - //---------------------------------------- - // EMCal digitization - //---------------------------------------- - - if (cemc_cell) - { - PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->set_timing_window(0.,60.); - cemc_cells->get_light_collection_model().load_data_file( - string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype2Module.xml"), - "data_grid_light_guide_efficiency","data_grid_fiber_trans"); - - se->registerSubsystem(cemc_cells); - } - if (cemc_twr) - { - RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - TowerBuilder->Detector("CEMC"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(TowerBuilder); - } - - if (cemc_digi) - { - const double sampling_fraction = 0.0233369; // +/- 8.22211e-05 from 15 Degree indenting 8 GeV electron showers - const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - const double ADC_per_photoelectron_HG = 3.8; // From Sean Stoll, Mar 29 - const double ADC_per_photoelectron_LG = 0.24; // From Sean Stoll, Mar 29 - - // low gains - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerLG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_LG); - TowerDigitizer->set_photonelec_yield_visible_GeV( - photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - // high gains - TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerHG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(15); // From John Haggerty, Mar 29 - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_HG); - TowerDigitizer->set_photonelec_yield_visible_GeV( - photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (cemc_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationLG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_LG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationHG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_HG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - - //---------------------------------------- - // HCal towering - //---------------------------------------- - if (ihcal_cell) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALinCellReco"); - hccell->Detector("HCALIN"); - se->registerSubsystem(hccell); - } - - if (ohcal_cell) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); - hccell->Detector("HCALOUT"); - se->registerSubsystem(hccell); - } - if (ihcal_twr) - { - Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALinRawTowerBuilder"); - hcaltwr->Detector("HCALIN"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - if (ohcal_twr) - { - Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); - hcaltwr->Detector("HCALOUT"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - - //---------------------------------------- - // HCal digitization - //---------------------------------------- - // From: Abhisek Sen [mailto:sen.abhisek@gmail.com] - // Sent: Tuesday, April 19, 2016 10:55 PM - // To: Huang, Jin ; Haggerty, John - - // HCALIN: - // 1/5 pixel / HG ADC channel - // 32/5 pixel / LG ADC channel - // 0.4 MeV/ LG ADC - // 0.4/32 MeV/ HG ADC - - // HCALOUT: - // 1/5 pixel / HG ADC channel - // 16/5 pixel / LG ADC channel - // 0.2 MeV/ LG ADC - // 0.2/16 MeV/ HG ADC - - if (ihcal_digi) - { - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerLG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(32. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerHG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.4e-3 / 32)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (ohcal_digi) - { - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerLG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(16. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerHG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.2e-3 / 16)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - //---------------------------------------- - // HCal calibration - //---------------------------------------- - // 32 GeV Pi+ scan - const double visible_sample_fraction_HCALIN = 7.19505e-02 ; // 1.34152e-02 - const double visible_sample_fraction_HCALOUT = 0.0313466 ; // +/- 0.0067744 - - if (ihcal_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / 32 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - if (ohcal_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / 16 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - //---------------------- - // QA Histograms - //---------------------- - if (cemc_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("CEMC",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ihcal_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("HCALIN",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ohcal_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("HCALOUT",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - //---------------------- - // G4HitNtuple - //---------------------- - if (hit_ntuple) - { - G4HitNtuple *hit = new G4HitNtuple("G4HitNtuple","g4hitntuple.root"); - hit->AddNode("HCALIN", 0); - hit->AddNode("HCALOUT", 1); - hit->AddNode("CRYO", 2); - hit->AddNode("BlackHole", 3); - hit->AddNode("ABSORBER_HCALIN", 10); - hit->AddNode("ABSORBER_HCALOUT", 11); - se->registerSubsystem(hit); - } - //---------------------- - // save a comprehensive evaluation file - //---------------------- - if (dstreader) - { - PHG4DSTReader* ana = new PHG4DSTReader( - string("DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(false); - ana->set_save_vertex(true); - ana->set_tower_zero_sup(-1000); // no zero suppression - - // ana->AddNode("CEMC"); - // if (absorberactive) - // { - // ana->AddNode("ABSORBER_CEMC"); - // } - ana->AddTower("SIM_CEMC"); - ana->AddTower("RAW_LG_CEMC"); - ana->AddTower("CALIB_LG_CEMC");// Low gain CEMC - ana->AddTower("RAW_HG_CEMC"); - ana->AddTower("CALIB_HG_CEMC");// High gain CEMC - - ana->AddTower("SIM_HCALOUT"); - ana->AddTower("SIM_HCALIN"); - - ana->AddTower("RAW_LG_HCALIN"); - ana->AddTower("RAW_HG_HCALIN"); - ana->AddTower("RAW_LG_HCALOUT"); - ana->AddTower("RAW_HG_HCALOUT"); - - ana->AddTower("CALIB_LG_HCALIN"); - ana->AddTower("CALIB_HG_HCALIN"); - ana->AddTower("CALIB_LG_HCALOUT"); - ana->AddTower("CALIB_HG_HCALOUT"); - - ana->AddNode("BlackHole");// add a G4Hit node - - se->registerSubsystem(ana); - } - if (dstoutput) - { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","G4Prototype2New.root"); - se->registerOutputManager(out); - } - - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - if (nEvents <= 0) - { - return 0; - } - se->run(nEvents); - - se->End(); - - QAHistManagerDef::saveQARootFile("G4Prototype2_qa.root"); - - - // std::cout << "All done" << std::endl; - delete se; - // return 0; - gSystem->Exit(0); - -} - diff --git a/macros/prototype2/Fun4All_TestBeam.C b/macros/prototype2/Fun4All_TestBeam.C deleted file mode 100644 index c4d8657e4..000000000 --- a/macros/prototype2/Fun4All_TestBeam.C +++ /dev/null @@ -1,290 +0,0 @@ -#include - -using namespace std; - -void -Fun4All_TestBeam(int nEvents = 100, - const char *input_file = - "/gpfs/mnt/gpfs02/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00002609-0000.prdf", - const char *output_file = "data/beam_00002609.root") -{ - gSystem->Load("libfun4all"); - gSystem->Load("libPrototype2.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(Fun4AllServer::VERBOSITY_SOME); - - recoConsts *rc = recoConsts::instance(); - //rc->set_IntFlag("RUNNUMBER",0); - - // ------------------- Run info -> RUN node ------------------- - RunInfoUnpackPRDF *unpack_run = new RunInfoUnpackPRDF(); -// unpack_run->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - - int i_offset = 0; - - // rcdaq_client create_device device_filenumbers_delete 9 911 "$HOME/beam_values.txt" - // S:MTNRG = 120 GeV - // F:MT6SC1 = 11127 Cnts - // F:MT6SC2 = 10585 Cnts - // F:MT6SC3 = 10442 Cnts - // F:MT6SC4 = 0 Cnts - // F:MT6SC5 = 20251 Cnts - // E:2CH = 981.9 mm - // E:2CV = 93.17 mm - // E:2CMT6T = 76.11 F - // E:2CMT6H = 18.09 %Hum - // F:MT5CP2 = .0301 Psia - // F:MT6CP2 = .6905 Psia - i_offset = 0; - unpack_run->add_channel("beam_MTNRG_GeV", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC1_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC2_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC3_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC4_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC5_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CH_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CV_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6T_F", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6H_RH", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT5CP2_Psia", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6CP2_Psia", 911, i_offset++, 1e-4); - -// rcdaq_client create_device device_filenumbers_delete 9 984 "$HOME/DB_LOGGER_EMCAL_A0_values.txt" - unpack_run->add_channel("EMCAL_A0_HighGain", 984, 0, 1); // 1: pre-amp high gain, 0: nominal gain - - // rcdaq_client create_device device_filenumbers_delete 9 983 "$HOME/DB_LOGGER_EMCAL_GR0.txt" - unpack_run->add_channel("EMCAL_GR0_BiasOffset_Tower21", 983, 21-1, 1); // bias offset in mV for tower 21 - - // rcdaq_client create_device device_filenumbers_delete 9 982 "$HOME/DB_LOGGER_EMCAL_T0_values.txt" - unpack_run->add_channel("EMCAL_T0_Tower21", 982, 21-1, 1e-3); // temperature reading in C for tower 21 - - se->registerSubsystem(unpack_run); - - // ------------------- Temperature output ------------------- - TempInfoUnpackPRDF *unpack_temp = new TempInfoUnpackPRDF(); - unpack_temp->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - se->registerSubsystem(unpack_temp); - - // ------------------- HCal and EMcal ------------------- - SubsysReco *unpack = new CaloUnpackPRDF(); -// unpack->Verbosity(1); - se->registerSubsystem(unpack); - - CaloCalibration * calib = NULL; - - calib = new CaloCalibration("CEMC"); - calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalin_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalin_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalout_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalout_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/")); // calibration database - se->registerSubsystem(calib); - - // ------------------- Hodoscpes ------------------- - - const int first_packet_id = PROTOTYPE2_FEM::PACKET_ID; // 21101 - const int second_packet_id = 21102; - - GenericUnpackPRDF *gunpack = NULL; - - const int N_hodo = 8; - - gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 104 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - gunpack = new GenericUnpackPRDF("HODO_HORIZONTAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 96 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HODO_VERTICAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - calib = new CaloCalibration("HODO_HORIZONTAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - // ------------------- Other detectors ------------------- - - gunpack = new GenericUnpackPRDF("C1"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 24, 0); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C1"); - se->registerSubsystem(calib); - - // more info see https://wiki.bnl.gov/sPHENIX/index.php/T-1044#Cerenkov_Counters - gunpack = new GenericUnpackPRDF("C2"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 25, 0); //25 Cerenkov 2 Inner - gunpack->add_channel(second_packet_id, 26, 1); //26 Cerenkov 2 Outer - gunpack->add_channel(second_packet_id, 22, 10); //Channel 22 C2inner earlier copy added before run 2210 - gunpack->add_channel(second_packet_id, 23, 11); //Channel 23 C2outer earlier copy added before run 2210 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C2"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", +1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row10", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row11", +1); - se->registerSubsystem(calib); - -// John H. : should be 19, 20, 21 and the other channels are a litle permuted from what I thought - gunpack = new GenericUnpackPRDF("HCAL_SCINT"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 19, 1); - gunpack->add_channel(second_packet_id, 20, 2); - gunpack->add_channel(second_packet_id, 21, 3); - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HCAL_SCINT"); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("PbGL"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 0, 0); // 0 PbGL Only inserted in beam for testing - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("PbGL"); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("TRIGGER_VETO"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 28, 0); // 28 Bottom trigger veto - gunpack->add_channel(second_packet_id, 29, 1); // 29 Top trigger veto - gunpack->add_channel(second_packet_id, 30, 2); // 30 Left trigger veto - gunpack->add_channel(second_packet_id, 31, 3); // 31 Right trigger veto - se->registerSubsystem(gunpack); - - // Calibrate the MIP peak to an relative energy of +1.0 - calib = new CaloCalibration("TRIGGER_VETO"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", -1./29.4155); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", +1./91); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", -1./31.3981); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", +1./1.43839e+02); - se->registerSubsystem(calib); - - const int N_TileMapper = 16; - - gunpack = new GenericUnpackPRDF("TILE_MAPPER"); - for (int i = 0; i < N_TileMapper; ++i) - gunpack->add_channel(second_packet_id, 32 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("TILE_MAPPER"); - se->registerSubsystem(calib); - - // ------------------- Output ------------------- - //main DST output - Fun4AllDstOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT", - output_file); - se->registerOutputManager(out_Manager); - - //alternatively, fast check on DST using DST Reader: - Prototype2DSTReader *reader = new Prototype2DSTReader( - string(output_file) + string("_DSTReader.root")); - - reader->AddRunInfo("beam_MTNRG_GeV"); - reader->AddRunInfo("beam_2CH_mm"); - reader->AddRunInfo("beam_2CV_mm"); - reader->AddRunInfo("EMCAL_A0_HighGain"); - reader->AddRunInfo("EMCAL_GR0_BiasOffset_Tower21"); - reader->AddRunInfo("EMCAL_T0_Tower21"); - - reader->AddTower("RAW_LG_HCALIN"); - reader->AddTower("RAW_HG_HCALIN"); - reader->AddTower("RAW_LG_HCALOUT"); - reader->AddTower("RAW_HG_HCALOUT"); - - reader->AddTower("CALIB_LG_HCALIN"); - reader->AddTower("CALIB_HG_HCALIN"); - reader->AddTower("CALIB_LG_HCALOUT"); - reader->AddTower("CALIB_HG_HCALOUT"); - - reader->AddTower("RAW_CEMC"); - reader->AddTower("CALIB_CEMC"); - - reader->AddTower("RAW_HODO_VERTICAL"); - reader->AddTower("RAW_HODO_HORIZONTAL"); - reader->AddTower("CALIB_HODO_VERTICAL"); - reader->AddTower("CALIB_HODO_HORIZONTAL"); - - reader->AddTower("RAW_C1"); - reader->AddTower("CALIB_C1"); - - reader->AddTower("RAW_C2"); - reader->AddTower("CALIB_C2"); - - reader->AddTower("RAW_HCAL_SCINT"); - reader->AddTower("CALIB_HCAL_SCINT"); - - reader->AddTower("RAW_PbGL"); - reader->AddTower("CALIB_PbGL"); - - reader->AddTower("RAW_TRIGGER_VETO"); - reader->AddTower("CALIB_TRIGGER_VETO"); - - reader->AddTower("RAW_TILE_MAPPER"); - reader->AddTower("CALIB_TILE_MAPPER"); - - reader->AddTowerTemperature("HCALIN"); - reader->AddTowerTemperature("HCALIN"); - reader->AddTowerTemperature("HCALOUT"); - - se->registerSubsystem(reader); - - Fun4AllInputManager *in = new Fun4AllPrdfInputManager("PRDFin"); - in->fileopen(input_file); - se->registerInputManager(in); - - se->run(nEvents); - - se->End(); - -} diff --git a/macros/prototype2/vis_prototype2.mac b/macros/prototype2/vis_prototype2.mac deleted file mode 100644 index 3767f8b49..000000000 --- a/macros/prototype2/vis_prototype2.mac +++ /dev/null @@ -1,80 +0,0 @@ -# $Id: vis.mac,v 1.4 2010/04/14 18:32:59 lindenle Exp $ -# -# Macro file for the initialization phase of "exampleN03.cc" -# when running in interactive mode -# -# Sets some default verbose -# -/control/verbose 2 -/control/saveHistory -/run/verbose 2 -# -# create empty scene -# -/vis/scene/create -# -# Create a scene handler for a specific graphics system -# (Edit the next line(s) to choose another graphic system) -# -# Use this open statement to get an .eps and .prim files -# suitable for viewing in DAWN. -###/vis/open DAWNFILE -# -# Use this open statement instead for OpenGL in immediate mode. -# OGLIX works on the desktops in 1008 while OGLSX terminates -# the X server. I've heard similar stories about OGLIX on other -# machines. You might have to play with it. GEANT prints out a -# list of available graphics systems at some point. -#/vis/open OGLIX -/vis/open OGLSX 1200x900-0+0 -/vis/viewer/set/viewpointThetaPhi 0 0 -# /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0 -# our world is 4x4 meters, the detector is about 1m across -# zooming by 4 makes it fill the display -/vis/viewer/zoom 1.5 -# -# Use this open statement instead to get a HepRep version 1 file -# suitable for viewing in WIRED. -#/vis/open HepRepFile -# -# Use this open statement instead to get a HepRep version 2 file -# suitable for viewing in WIRED. -#/vis/open HepRepXML -# -# Output an empty detector -# /vis/viewer/flush -# -# Draw trajectories at end of event, showing trajectory points as -# markers of size 2 pixels -/vis/scene/add/trajectories smooth -/vis/modeling/trajectories/create/drawByCharge -/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true -/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 -# (if too many tracks cause core dump => /tracking/storeTrajectory 0) -# -# To draw gammas only -#/vis/filtering/trajectories/create/particleFilter -#/vis/filtering/trajectories/particleFilter-0/add gamma -# -# To draw charged particles only -#/vis/filtering/trajectories/particleFilter-0/invert true -# -# Many other options available with /vis/modeling and /vis/filtering. -# For example, select colour by particle ID -#/vis/modeling/trajectories/create/drawByParticleID -#/vis/modeling/trajectories/drawByParticleID-0/set e- red -# remove low energy stuff -/vis/filtering/trajectories/create/attributeFilter -/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag -/vis/filtering/trajectories/attributeFilter-0/addInterval 50 MeV 1000 GeV -# -/vis/scene/endOfEventAction accumulate -# -# At end of each run, an automatic flush causes graphical output. -#/run/beamOn 1 -# When you exit Geant4, you will find a file called scene-0.heprep.zip. -# Unzipping this will give you three separate HepRep files suitable for -# viewing in WIRED. -# The first file will contain just detector geometry. -# The second file will contain the detector plus one event. -# The third file will contain the detector plus ten events. diff --git a/macros/prototype3/Fun4All_G4_Prototype3.C b/macros/prototype3/Fun4All_G4_Prototype3.C deleted file mode 100644 index 850af560b..000000000 --- a/macros/prototype3/Fun4All_G4_Prototype3.C +++ /dev/null @@ -1,586 +0,0 @@ -int Fun4All_G4_Prototype3(int nEvents = 1) -{ - - gSystem->Load("libfun4all"); - gSystem->Load("libg4detectors"); - gSystem->Load("libg4testbench"); - gSystem->Load("libg4histos"); - gSystem->Load("libg4eval.so"); - gSystem->Load("libqa_modules"); - - bool cemc_on = true; - bool cemc_cell = cemc_on && true; - bool cemc_twr = cemc_cell && true; - bool cemc_digi = cemc_twr && true; - bool cemc_twrcal = cemc_digi && true; - bool ihcal_on = true; - bool ihcal_cell = ihcal_on && false; - bool ihcal_twr = ihcal_cell && false; - bool ihcal_digi = ihcal_twr && false; - bool ihcal_twrcal = ihcal_digi && false; - bool ohcal_on = true; - bool ohcal_cell = ohcal_on && false; - bool ohcal_twr = ohcal_cell && false; - bool ohcal_digi = ohcal_twr && false; - bool ohcal_twrcal = ohcal_digi && false; - bool cryo_on = true; - bool bh_on = false; // the surrounding boxes need some further thinking - bool dstreader = true; - bool hit_ntuple = false; - bool dstoutput = false; - - /////////////////////////////////////////// - // Make the Server - ////////////////////////////////////////// - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(1); - recoConsts *rc = recoConsts::instance(); - // only set this if you want a fixed random seed to make - // results reproducible for testing -// rc->set_IntFlag("RANDOMSEED",12345678); - - // simulated setup sits at eta=1, theta=40.395 degrees - double theta = 90-46.4; - // shift in x with respect to midrapidity setup - double add_place_x = 183.-173.93+2.54/2.; - // Test beam generator - PHG4SimpleEventGenerator *gen = new PHG4SimpleEventGenerator(); - gen->add_particles("e-", 1); // mu-,e-,anti_proton,pi- - gen->set_vertex_distribution_mean(0.0, 0.0, 0); - gen->set_vertex_distribution_width(0.0, .7, .7); // Rough beam profile size @ 16 GeV measured by Abhisek - gen->set_vertex_distribution_function(PHG4SimpleEventGenerator::Gaus, - PHG4SimpleEventGenerator::Gaus, - PHG4SimpleEventGenerator::Gaus); // Gauss beam profile - double angle = theta*TMath::Pi()/180.; - double eta = -1.*TMath::Log(TMath::Tan(angle/2.)); - gen->set_eta_range(eta-0.001,eta+0.001); // 1mrad angular divergence - gen->set_phi_range(-0.001, 0.001); // 1mrad angular divergence - const double momentum = 32; - gen->set_p_range(momentum,momentum, momentum*2e-2); // 2% momentum smearing - se->registerSubsystem(gen); - - PHG4ParticleGenerator *pgen = new PHG4ParticleGenerator(); - pgen->set_name("geantino"); - //pgen->set_name(particle); - pgen->set_vtx(0, 0, 0); - //pgen->set_vtx(0, ypos, 0); - double angle = theta*TMath::Pi()/180.; - double eta = -1.*TMath::Log(TMath::Tan(angle/2.)); - pgen->set_eta_range(0.2*eta, 1.8*eta); - //pgen->set_phi_range(-0.001, 0.001); // 1mrad angular diverpgence - //pgen->set_phi_range(-0.5/180.*TMath::Pi(), 0.5/180.*TMath::Pi()); - //pgen->set_eta_range(-1., 1.); - //pgen->set_phi_range(-0./180.*TMath::Pi(), 0./180.*TMath::Pi()); - pgen->set_phi_range(-20/180.*TMath::Pi(), 20/180.*TMath::Pi()); - pgen->set_mom_range(1, 1); - // se->registerSubsystem(pgen); - - // Simple single particle generator - PHG4ParticleGun *gun = new PHG4ParticleGun(); - gun->set_name("geantino"); - // gun->set_name("proton"); - gun->set_vtx(0, 0, 0); - double angle = theta*TMath::Pi()/180.; - gun->set_mom(sin(angle),0.,cos(angle)); -// se->registerSubsystem(gun); - - - PHG4Reco* g4Reco = new PHG4Reco(); - g4Reco->set_field(0); - // g4Reco->SetPhysicsList("QGSP_BERT_HP"); // uncomment this line to enable the high-precision neutron simulation physics list, QGSP_BERT_HP - - //---------------------------------------- - // EMCal G4 - //---------------------------------------- - if (cemc_on) - { - PHG4SpacalPrototypeSubsystem *cemc; - cemc = new PHG4SpacalPrototypeSubsystem("CEMC"); - cemc->SetActive(); - cemc->SuperDetector("CEMC"); - cemc->SetAbsorberActive(); - cemc->OverlapCheck(true); -// cemc->Verbosity(2); -// cemc->set_int_param("construction_verbose",2); - cemc->UseCalibFiles(PHG4DetectorSubsystem::xml); - cemc->SetCalibrationFileDir(string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Geometry/") ); -// cemc->SetCalibrationFileDir("./test_geom/" ); - // cemc->set_double_param("z_rotation_degree", 15); // rotation around CG -// cemc->set_double_param("xpos", (116.77 + 137.0)*.5 - 26.5 - 10.2); // location in cm of EMCal CG. Updated with final positioning of EMCal -// cemc->set_double_param("ypos", 4); // put it some where in UIUC blocks -// cemc->set_double_param("zpos", 4); // put it some where in UIUC blocks - g4Reco->registerSubsystem(cemc); - } - //---------------------------------------- - // HCal G4 - //---------------------------------------- - if (ihcal_on) - { - PHG4Prototype2InnerHcalSubsystem *innerhcal = new PHG4Prototype2InnerHcalSubsystem("HCalIn"); - innerhcal->set_int_param("hi_eta",1); - innerhcal->set_double_param("place_x",add_place_x); - innerhcal->set_double_param("place_z",144); - innerhcal->SetActive(); - innerhcal->SetAbsorberActive(); - innerhcal->SetAbsorberTruth(1); - innerhcal->OverlapCheck(true); - innerhcal->SuperDetector("HCALIN"); - g4Reco->registerSubsystem(innerhcal); - } - if (ohcal_on) - { - PHG4Prototype2OuterHcalSubsystem *outerhcal = new PHG4Prototype2OuterHcalSubsystem("HCalOut"); - outerhcal->set_int_param("hi_eta",1); - outerhcal->set_double_param("place_x",add_place_x); - outerhcal->set_double_param("place_z",229.5); - outerhcal->SetActive(); - outerhcal->SetAbsorberActive(); - outerhcal->SetAbsorberTruth(1); - outerhcal->OverlapCheck(true); - outerhcal->SuperDetector("HCALOUT"); - g4Reco->registerSubsystem(outerhcal); - } - if (cryo_on) - { - double place_z = 175.; - // Cryostat from engineering drawing - PHG4BlockSubsystem *cryo1 = new PHG4BlockSubsystem("cryo1",1); - cryo1->set_double_param("size_x",0.95); - cryo1->set_double_param("size_y",60.96); - cryo1->set_double_param("size_z",60.96); - cryo1->set_double_param("place_x",141.96+0.95/2.+add_place_x); - cryo1->set_double_param("place_z",place_z); - cryo1->set_string_param("material","G4_Al"); - cryo1->SetActive(); // it is an active volume - save G4Hits - cryo1->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo1); - - PHG4BlockSubsystem *cryo2 = new PHG4BlockSubsystem("cryo2",2); - cryo2->set_double_param("size_x",8.89); - cryo2->set_double_param("size_y",60.96); - cryo2->set_double_param("size_z",60.96); - cryo2->set_double_param("place_x",150.72+8.89/2.+add_place_x); - cryo2->set_double_param("place_z",place_z); - cryo2->set_string_param("material","G4_Al"); - cryo2->SetActive(); // it is an active volume - save G4Hits - cryo2->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo2); - - PHG4BlockSubsystem *cryo3 = new PHG4BlockSubsystem("cryo3",3); - cryo3->set_double_param("size_x",2.54); - cryo3->set_double_param("size_y",60.96); - cryo3->set_double_param("size_z",60.96); - cryo3->set_double_param("place_x",173.93+2.54/2.+add_place_x); - cryo3->set_double_param("place_z",place_z); - cryo3->set_string_param("material","G4_Al"); - cryo3->SetActive(); // it is an active volume - save G4Hits - cryo3->SuperDetector("CRYO"); - g4Reco->registerSubsystem(cryo3); - } - if (bh_on) - { - // BLACKHOLE, box surrounding the prototype to check for leakage - PHG4BlockSubsystem *bh[5]; - // surrounding outer hcal - // top - bh[0] = new PHG4BlockSubsystem("bh1",1); - bh[0]->set_double_param("size_x",270.); - bh[0]->set_double_param("size_y",0.01); - bh[0]->set_double_param("size_z",165.); - bh[0]->set_double_param("place_x",270./2.); - bh[0]->set_double_param("place_y",125./2.); - // bottom - bh[1] = new PHG4BlockSubsystem("bh2",2); - bh[1]->set_double_param("size_x",270.); - bh[1]->set_double_param("size_y",0.01); - bh[1]->set_double_param("size_z",165.); - bh[1]->set_double_param("place_x",270./2.); - bh[1]->set_double_param("place_y",-125./2.); - // right side - bh[2] = new PHG4BlockSubsystem("bh3",3); - bh[2]->set_double_param("size_x",200.); - bh[2]->set_double_param("size_y",125.); - bh[2]->set_double_param("size_z",0.01); - bh[2]->set_double_param("place_x",200./2.); - bh[2]->set_double_param("place_z",165./2.); - // left side - bh[3] = new PHG4BlockSubsystem("bh4",4); - bh[3]->set_double_param("size_x",270.); - bh[3]->set_double_param("size_y",125.); - bh[3]->set_double_param("size_z",0.01); - bh[3]->set_double_param("place_x",270./2.); - bh[3]->set_double_param("place_z",-165./2.); - // back - bh[4] = new PHG4BlockSubsystem("bh5",5); - bh[4]->set_double_param("size_x",0.01); - bh[4]->set_double_param("size_y",125.); - bh[4]->set_double_param("size_z",165.); - bh[4]->set_double_param("place_x",270.); - for (int i=0; i<5; i++) - { - bh[i]->BlackHole(); - bh[i]->SetActive(); - bh[i]->SuperDetector("BlackHole"); - bh[i]->OverlapCheck(true); - g4Reco->registerSubsystem(bh[i]); - } - } - PHG4TruthSubsystem *truth = new PHG4TruthSubsystem(); - g4Reco->registerSubsystem(truth); - - se->registerSubsystem( g4Reco ); - //---------------------------------------- - // EMCal digitization - //---------------------------------------- - if (cemc_cell) - { - PHG4FullProjSpacalCellReco *cemc_cells = new PHG4FullProjSpacalCellReco("CEMCCYLCELLRECO"); - cemc_cells->Detector("CEMC"); - cemc_cells->set_timing_window(0.,60.); - cemc_cells->get_light_collection_model().load_data_file(string(getenv("CALIBRATIONROOT")) + string("/CEMC/LightCollection/Prototype2Module.xml"),"data_grid_light_guide_efficiency","data_grid_fiber_trans"); - - se->registerSubsystem(cemc_cells); - } - if (cemc_twr) - { - RawTowerBuilder *TowerBuilder = new RawTowerBuilder("EmcRawTowerBuilder"); - TowerBuilder->Detector("CEMC"); - TowerBuilder->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(TowerBuilder); - } - const double sampling_fraction = 0.0190134; // +/- 0.000224984 from 0 Degree indenting 32 GeV electron showers - const double photoelectron_per_GeV = 500; //500 photon per total GeV deposition - const double ADC_per_photoelectron_HG = 3.8; // From Sean Stoll, Mar 29 - const double ADC_per_photoelectron_LG = 0.24; // From Sean Stoll, Mar 29 - - // low gains - if (cemc_digi) - { - RawTowerDigitizer *TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerLG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_LG); - TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - // high gains - TowerDigitizer = new RawTowerDigitizer("EmcRawTowerDigitizerHG"); - TowerDigitizer->Detector("CEMC"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm( - RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(15); // From John Haggerty, Mar 29 - TowerDigitizer->set_photonelec_ADC(1. / ADC_per_photoelectron_HG); - TowerDigitizer->set_photonelec_yield_visible_GeV(photoelectron_per_GeV / sampling_fraction); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (cemc_twrcal) - { - RawTowerCalibration *TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationLG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_LG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - - TowerCalibration = new RawTowerCalibration("EmcRawTowerCalibrationHG"); - TowerCalibration->Detector("CEMC"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm( - RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(1. / ADC_per_photoelectron_HG / photoelectron_per_GeV); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - - //---------------------------------------- - // HCal towering - //---------------------------------------- - if (ihcal_cell) - { - PHG4Prototype2HcalCellReco *hccell = new PHG4Prototype2HcalCellReco("HCALinCellReco"); - hccell->Detector("HCALIN"); - se->registerSubsystem(hccell); - } - if (ihcal_twr) - { - Prototype2RawTowerBuilder *hcaltwr = new Prototype2RawTowerBuilder("HCALinRawTowerBuilder"); - hcaltwr->Detector("HCALIN"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - - - if (ohcal_cell) - { - hccell = new PHG4Prototype2HcalCellReco("HCALoutCellReco"); - hccell->Detector("HCALOUT"); - se->registerSubsystem(hccell); - } - if (ohcal_twr) - { - hcaltwr = new Prototype2RawTowerBuilder("HCALoutRawTowerBuilder"); - hcaltwr->Detector("HCALOUT"); - hcaltwr->set_sim_tower_node_prefix("SIM"); - se->registerSubsystem(hcaltwr); - } - - //---------------------------------------- - // HCal digitization - //---------------------------------------- - // From: Abhisek Sen [mailto:sen.abhisek@gmail.com] - // Sent: Tuesday, April 19, 2016 10:55 PM - // To: Huang, Jin ; Haggerty, John - - // HCALIN: - // 1/5 pixel / HG ADC channel - // 32/5 pixel / LG ADC channel - // 0.4 MeV/ LG ADC - // 0.4/32 MeV/ HG ADC - - // HCALOUT: - // 1/5 pixel / HG ADC channel - // 16/5 pixel / LG ADC channel - // 0.2 MeV/ LG ADC - // 0.2/16 MeV/ HG ADC - RawTowerDigitizer *TowerDigitizer = NULL; - if (ihcal_digi) - { - TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerLG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(32. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(32. / 5 / (0.4e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALinTowerDigitizerHG"); - TowerDigitizer->Detector("HCALIN"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.4e-3 / 32)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - if (ohcal_digi) - { - TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerLG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_LG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(16. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(16. / 5 / (0.2e-3)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - - TowerDigitizer = new RawTowerDigitizer("HCALoutTowerDigitizerHG"); - TowerDigitizer->Detector("HCALOUT"); - TowerDigitizer->set_raw_tower_node_prefix("RAW_HG"); - TowerDigitizer->set_digi_algorithm(RawTowerDigitizer::kSimple_photon_digitalization); - TowerDigitizer->set_pedstal_central_ADC(0); - TowerDigitizer->set_pedstal_width_ADC(1); // From Jin's guess. No EMCal High Gain data yet! TODO: update - TowerDigitizer->set_photonelec_ADC(1. / 5.); - TowerDigitizer->set_photonelec_yield_visible_GeV(1. / 5 / (0.2e-3 / 16)); - TowerDigitizer->set_zero_suppression_ADC(-1000); // no-zero suppression - se->registerSubsystem(TowerDigitizer); - } - //---------------------------------------- - // HCal calibration - //---------------------------------------- - // 32 GeV Pi+ scan - const double visible_sample_fraction_HCALIN = 7.19505e-02 ; // 1.34152e-02 - const double visible_sample_fraction_HCALOUT = 0.0313466 ; // +/- 0.0067744 - RawTowerCalibration *TowerCalibration = NULL; - if (ihcal_twrcal) - { - TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALinRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALIN"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.4e-3 / 32 / visible_sample_fraction_HCALIN); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - if (ohcal_twrcal) - { - TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationLG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_LG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_LG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - - TowerCalibration = new RawTowerCalibration("HCALoutRawTowerCalibrationHG"); - TowerCalibration->Detector("HCALOUT"); - TowerCalibration->set_raw_tower_node_prefix("RAW_HG"); - TowerCalibration->set_calib_tower_node_prefix("CALIB_HG"); - TowerCalibration->set_calib_algorithm(RawTowerCalibration::kSimple_linear_calibration); - TowerCalibration->set_calib_const_GeV_ADC(0.2e-3 / 16 / visible_sample_fraction_HCALOUT); - TowerCalibration->set_pedstal_ADC(0); - TowerCalibration->set_zero_suppression_GeV(-1); // no-zero suppression - se->registerSubsystem(TowerCalibration); - } - //---------------------- - // QA Histograms - //---------------------- - if (cemc_on) - { - se->registerSubsystem(new QAG4SimulationCalorimeter("CEMC",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ihcal_on) - { - // TODO: disable QA for HCal right now as there is a hit->particle truth association error at the moment - // se->registerSubsystem(new QAG4SimulationCalorimeter("HCALIN",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - if (ohcal_on) - { - // se->registerSubsystem(new QAG4SimulationCalorimeter("HCALOUT",QAG4SimulationCalorimeter::kProcessG4Hit)); - } - //---------------------- - // G4HitNtuple - //---------------------- - if (hit_ntuple) - { - G4HitNtuple *hit = new G4HitNtuple("G4HitNtuple","g4hitntuple.root"); - hit->AddNode("HCALIN", 0); - hit->AddNode("HCALOUT", 1); - hit->AddNode("CRYO", 2); - hit->AddNode("BlackHole", 3); - hit->AddNode("ABSORBER_HCALIN", 10); - hit->AddNode("ABSORBER_HCALOUT", 11); - se->registerSubsystem(hit); - } - // G4ScintillatorSlatTTree *scintcell = new G4ScintillatorSlatTTree("inslat"); - // scintcell->Detector("HCALIN"); - // se->registerSubsystem(scintcell); - - // scintcell = new G4ScintillatorSlatTTree("outslat"); - // scintcell->Detector("HCALOUT"); - // se->registerSubsystem(scintcell); - - - //---------------------- - // save a comprehensive evaluation file - //---------------------- - if (dstreader) - { - PHG4DSTReader* ana = new PHG4DSTReader(string("DSTReader.root")); - ana->set_save_particle(true); - ana->set_load_all_particle(false); - ana->set_load_active_particle(false); - ana->set_save_vertex(true); - ana->set_tower_zero_sup(-1000); // no zero suppression - - // ana->AddNode("CEMC"); - // if (absorberactive) - // { - // ana->AddNode("ABSORBER_CEMC"); - // } - - if (cemc_twr) - ana->AddTower("SIM_CEMC"); - if (cemc_digi) - ana->AddTower("RAW_LG_CEMC"); - if (cemc_twrcal) - ana->AddTower("CALIB_LG_CEMC"); // Low gain CEMC - if (cemc_digi) - ana->AddTower("RAW_HG_CEMC"); - if (cemc_twrcal) - ana->AddTower("CALIB_HG_CEMC"); // High gain CEMC - - if (ohcal_twr) - ana->AddTower("SIM_HCALOUT"); - if (ihcal_twr) - ana->AddTower("SIM_HCALIN"); - - if (ihcal_digi) - ana->AddTower("RAW_LG_HCALIN"); - if (ihcal_digi) - ana->AddTower("RAW_HG_HCALIN"); - if (ohcal_digi) - ana->AddTower("RAW_LG_HCALOUT"); - if (ohcal_digi) - ana->AddTower("RAW_HG_HCALOUT"); - - if (ihcal_twrcal) - ana->AddTower("CALIB_LG_HCALIN"); - if (ihcal_twrcal) - ana->AddTower("CALIB_HG_HCALIN"); - if (ohcal_twrcal) - ana->AddTower("CALIB_LG_HCALOUT"); - if (ohcal_twrcal) - ana->AddTower("CALIB_HG_HCALOUT"); - - if (bh_on) - ana->AddNode("BlackHole"); // add a G4Hit node - - se->registerSubsystem(ana); - } - - // Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","/phenix/scratch/pinkenbu/G4Prototype2Hcalin.root"); - // out->AddNode("G4RootScintillatorSlat_HCALIN"); - // se->registerOutputManager(out); - - // out = new Fun4AllDstOutputManager("DSTHCOUT","/phenix/scratch/pinkenbu/G4Prototype2Hcalout.root"); - // out->AddNode("G4RootScintillatorSlat_HCALOUT"); - // se->registerOutputManager(out); - - if (dstoutput) - { - Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT","G4Prototype3New.root"); - se->registerOutputManager(out); - } - - Fun4AllInputManager *in = new Fun4AllDummyInputManager( "JADE"); - se->registerInputManager( in ); - if (nEvents <= 0) - { - return 0; - } - se->run(nEvents); - - se->End(); - - QAHistManagerDef::saveQARootFile("G4Prototype2_qa.root"); - - - // std::cout << "All done" << std::endl; - delete se; - // return 0; - gSystem->Exit(0); - -} diff --git a/macros/prototype3/Fun4All_TestBeam.C b/macros/prototype3/Fun4All_TestBeam.C deleted file mode 100644 index 42c069ead..000000000 --- a/macros/prototype3/Fun4All_TestBeam.C +++ /dev/null @@ -1,334 +0,0 @@ -#include - -using namespace std; - -void -Fun4All_TestBeam(int nEvents = 1000, - const char *input_file = - "/gpfs/mnt/gpfs02/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00003310-0000.prdf", - const char *output_file = "data/beam_00003310.root") -{ - gSystem->Load("libfun4all"); - gSystem->Load("libPrototype3.so"); - - Fun4AllServer *se = Fun4AllServer::instance(); - se->Verbosity(Fun4AllServer::VERBOSITY_SOME); - - recoConsts *rc = recoConsts::instance(); - //rc->set_IntFlag("RUNNUMBER",0); - - // ------------------- Run info -> RUN node ------------------- - RunInfoUnpackPRDF *unpack_run = new RunInfoUnpackPRDF(); -// unpack_run->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - - int i_offset = 0; - - // rcdaq_client create_device device_filenumbers_delete 9 911 "$HOME/beam_values.txt" - // S:MTNRG = 120 GeV - // F:MT6SC1 = 11127 Cnts - // F:MT6SC2 = 10585 Cnts - // F:MT6SC3 = 10442 Cnts - // F:MT6SC4 = 0 Cnts - // F:MT6SC5 = 20251 Cnts - // E:2CH = 981.9 mm - // E:2CV = 93.17 mm - // E:2CMT6T = 76.11 F - // E:2CMT6H = 18.09 %Hum - // F:MT5CP2 = .0301 Psia - // F:MT6CP2 = .6905 Psia - i_offset = 0; - unpack_run->add_channel("beam_MTNRG_GeV", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC1_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC2_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC3_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC4_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6SC5_Cnts", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CH_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CV_mm", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6T_F", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_2CMT6H_RH", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT5CP2_Psia", 911, i_offset++, 1e-4); - unpack_run->add_channel("beam_MT6CP2_Psia", 911, i_offset++, 1e-4); - -// rcdaq_client create_device device_filenumbers_delete 9 984 "$HOME/DB_LOGGER_EMCAL_A0_values.txt" - unpack_run->add_channel("EMCAL_A0_HighGain", 984, 0, 1); // 1: pre-amp high gain, 0: nominal gain - - // rcdaq_client create_device device_filenumbers_delete 9 983 "$HOME/DB_LOGGER_EMCAL_GR0.txt" - unpack_run->add_channel("EMCAL_GR0_BiasOffset_Tower21", 983, 21-1, 1); // bias offset in mV for tower 21 - - // rcdaq_client create_device device_filenumbers_delete 9 982 "$HOME/DB_LOGGER_EMCAL_T0_values.txt" - unpack_run->add_channel("EMCAL_T0_Tower21", 982, 21-1, 1e-3); // temperature reading in C for tower 21 - - se->registerSubsystem(unpack_run); - - // ------------------- Temperature output ------------------- - TempInfoUnpackPRDF *unpack_temp = new TempInfoUnpackPRDF(); - unpack_temp->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME); - se->registerSubsystem(unpack_temp); - - // ------------------- HCal and EMcal ------------------- - SubsysReco *unpack = new CaloUnpackPRDF(); -// unpack->Verbosity(1); - se->registerSubsystem(unpack); - - CaloCalibration * calib = NULL; - - calib = new CaloCalibration("CEMC"); - calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalin_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALIN"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalin_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalin_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_LG"); - calib->set_raw_tower_node_prefix("RAW_LG"); - calib->GetCalibrationParameters().set_name("hcalout_lg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - calib = new CaloCalibration("HCALOUT"); - calib->set_calib_tower_node_prefix("CALIB_HG"); - calib->set_raw_tower_node_prefix("RAW_HG"); - calib->GetCalibrationParameters().set_name("hcalout_hg"); - calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml",0,0, - string(getenv("CALIBRATIONROOT")) + string("/Prototype3/Calibration/")); // calibration database - se->registerSubsystem(calib); - - // ------------------- Hodoscpes ------------------- - - const int first_packet_id = PROTOTYPE3_FEM::PACKET_ID; // 21101 - const int second_packet_id = 21102; - - GenericUnpackPRDF *gunpack = NULL; - - const int N_hodo = 8; - - gunpack = new GenericUnpackPRDF("HODO_VERTICAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 104 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - gunpack = new GenericUnpackPRDF("HODO_HORIZONTAL"); - for (int i = 0; i < N_hodo; ++i) - gunpack->add_channel(first_packet_id, 96 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HODO_VERTICAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - calib = new CaloCalibration("HODO_HORIZONTAL"); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - // Martin find that even channel has negative polarity and odd channel has positive polarity - for (int i = 0; i < N_hodo; ++i) - calib->GetCalibrationParameters().set_double_param( - Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1)); - se->registerSubsystem(calib); - - // ------------------- Other detectors ------------------- - - gunpack = new GenericUnpackPRDF("C1"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 24, 0); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C1"); - se->registerSubsystem(calib); - - // more info see https://wiki.bnl.gov/sPHENIX/index.php/T-1044#Cerenkov_Counters - gunpack = new GenericUnpackPRDF("C2"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 25, 0); //25 Cerenkov 2 Inner - gunpack->add_channel(second_packet_id, 26, 1); //26 Cerenkov 2 Outer - gunpack->add_channel(second_packet_id, 22, 10); //Channel 22 C2inner earlier copy added before run 2210 - gunpack->add_channel(second_packet_id, 23, 11); //Channel 23 C2outer earlier copy added before run 2210 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("C2"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", +1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row10", -1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row11", +1); - se->registerSubsystem(calib); - -// John H. : should be 19, 20, 21 and the other channels are a litle permuted from what I thought - gunpack = new GenericUnpackPRDF("HCAL_SCINT"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 19, 1); - gunpack->add_channel(second_packet_id, 20, 2); - gunpack->add_channel(second_packet_id, 21, 3); - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("HCAL_SCINT"); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("PbGL"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 27, 0); // 27 PbGl From channel 2 of adjacent 612AM amplifier - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("PbGL"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("TRIGGER_VETO"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 28, 0); // 28 Bottom trigger veto - gunpack->add_channel(second_packet_id, 29, 1); // 29 Top trigger veto - gunpack->add_channel(second_packet_id, 30, 2); // 30 Left trigger veto - gunpack->add_channel(second_packet_id, 31, 3); // 31 Right trigger veto - se->registerSubsystem(gunpack); - - // Calibrate the MIP peak to an relative energy of +1.0 - calib = new CaloCalibration("TRIGGER_VETO"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", -1./29.4155); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", +1./91); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", -1./31.3981); - calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", +1./1.43839e+02); - se->registerSubsystem(calib); - - const int N_TileMapper = 16; - - gunpack = new GenericUnpackPRDF("TILE_MAPPER"); - for (int i = 0; i < N_TileMapper; ++i) - gunpack->add_channel(second_packet_id, 32 + i, i); // 24 Cerenkov 1 - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("TILE_MAPPER"); - se->registerSubsystem(calib); - - // https://wiki.bnl.gov/sPHENIX/index.php/2017_calorimeter_beam_test#Facility_Detector_ADC_Map - gunpack = new GenericUnpackPRDF("SC3"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 17, 0); // 17 SC3 From channel 3 of adjacent 612AM amplifier - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("SC3"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("SC_MWPC4"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 18, 0); // 18 SC behind MWPC4 From channel 4 of adjacent 612AM amplifier - se->registerSubsystem(gunpack); - - calib = new CaloCalibration("SC_MWPC4"); - calib->GetCalibrationParameters().set_double_param("calib_const_scale", -1); - se->registerSubsystem(calib); - - gunpack = new GenericUnpackPRDF("SPILL_WARBLER"); -// unpack->Verbosity(1); - gunpack->add_channel(second_packet_id, 16, 0); // Short Meritec cable 0 16 Spill warbler - se->registerSubsystem(gunpack); - - // ------------------- Event summary ------------------- - - se->registerSubsystem(new EventInfoSummary()); - - // ------------------- Output ------------------- - //main DST output - Fun4AllDstOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT", - output_file); - se->registerOutputManager(out_Manager); - - //alternatively, fast check on DST using DST Reader: - Prototype3DSTReader *reader = new Prototype3DSTReader( - string(output_file) + string("_DSTReader.root")); - - reader->AddRunInfo("beam_MTNRG_GeV"); - reader->AddRunInfo("beam_2CH_mm"); - reader->AddRunInfo("beam_2CV_mm"); - reader->AddRunInfo("EMCAL_A0_HighGain"); - reader->AddRunInfo("EMCAL_GR0_BiasOffset_Tower21"); - reader->AddRunInfo("EMCAL_T0_Tower21"); - reader->AddRunInfo("EMCAL_Is_HighEta"); - - reader->AddEventInfo("beam_Is_In_Spill"); - reader->AddEventInfo("beam_SPILL_WARBLER_RMS"); - reader->AddEventInfo("CALIB_CEMC_Sum"); - reader->AddEventInfo("CALIB_LG_HCALIN_Sum"); - reader->AddEventInfo("CALIB_LG_HCALOUT_Sum"); - - reader->AddTower("RAW_LG_HCALIN"); - reader->AddTower("RAW_HG_HCALIN"); - reader->AddTower("RAW_LG_HCALOUT"); - reader->AddTower("RAW_HG_HCALOUT"); - - reader->AddTower("CALIB_LG_HCALIN"); - reader->AddTower("CALIB_HG_HCALIN"); - reader->AddTower("CALIB_LG_HCALOUT"); - reader->AddTower("CALIB_HG_HCALOUT"); - - reader->AddTower("RAW_CEMC"); - reader->AddTower("CALIB_CEMC"); - - reader->AddTower("RAW_HODO_VERTICAL"); - reader->AddTower("RAW_HODO_HORIZONTAL"); - reader->AddTower("CALIB_HODO_VERTICAL"); - reader->AddTower("CALIB_HODO_HORIZONTAL"); - - reader->AddTower("RAW_C1"); - reader->AddTower("CALIB_C1"); - - reader->AddTower("RAW_C2"); - reader->AddTower("CALIB_C2"); - - reader->AddTower("RAW_HCAL_SCINT"); - reader->AddTower("CALIB_HCAL_SCINT"); - - reader->AddTower("RAW_PbGL"); - reader->AddTower("CALIB_PbGL"); - - reader->AddTower("RAW_TRIGGER_VETO"); - reader->AddTower("CALIB_TRIGGER_VETO"); - - reader->AddTower("RAW_TILE_MAPPER"); - reader->AddTower("CALIB_TILE_MAPPER"); - - reader->AddTower("RAW_SC3"); - reader->AddTower("CALIB_SC3"); - - reader->AddTower("RAW_SC_MWPC4"); - reader->AddTower("CALIB_SC_MWPC4"); - - reader->AddTower("RAW_SPILL_WARBLER"); - -// reader->AddTowerTemperature("EMCAL"); -// reader->AddTowerTemperature("HCALIN"); -// reader->AddTowerTemperature("HCALOUT"); - - se->registerSubsystem(reader); - - Fun4AllInputManager *in = new Fun4AllPrdfInputManager("PRDFin"); - in->fileopen(input_file); - se->registerInputManager(in); - - se->run(nEvents); - - se->End(); - -} diff --git a/macros/prototype3/vis_prototype3.mac b/macros/prototype3/vis_prototype3.mac deleted file mode 100644 index 12adcc651..000000000 --- a/macros/prototype3/vis_prototype3.mac +++ /dev/null @@ -1,82 +0,0 @@ -# $Id: vis.mac,v 1.4 2010/04/14 18:32:59 lindenle Exp $ -# -# Macro file for the initialization phase of "exampleN03.cc" -# when running in interactive mode -# -# Sets some default verbose -# -/control/verbose 2 -/control/saveHistory -/run/verbose 2 -# -# create empty scene -# -/vis/scene/create -# -# Create a scene handler for a specific graphics system -# (Edit the next line(s) to choose another graphic system) -# -# Use this open statement to get an .eps and .prim files -# suitable for viewing in DAWN. -###/vis/open DAWNFILE -# -# Use this open statement instead for OpenGL in immediate mode. -# OGLIX works on the desktops in 1008 while OGLSX terminates -# the X server. I've heard similar stories about OGLIX on other -# machines. You might have to play with it. GEANT prints out a -# list of available graphics systems at some point. -#/vis/open OGLIX -/vis/open OGLSX 1200x900-0+0 -/vis/viewer/set/viewpointThetaPhi 90 90 -/vis/viewer/set/upThetaPhi 90 0 -# /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0 -# our world is 4x4 meters, the detector is about 1m across -# zooming by 4 makes it fill the display -/vis/viewer/zoom 1.5 -#/vis/viewer/panTo 0 30 cm -# -# Use this open statement instead to get a HepRep version 1 file -# suitable for viewing in WIRED. -#/vis/open HepRepFile -# -# Use this open statement instead to get a HepRep version 2 file -# suitable for viewing in WIRED. -#/vis/open HepRepXML -# -# Output an empty detector -# /vis/viewer/flush -# -# Draw trajectories at end of event, showing trajectory points as -# markers of size 2 pixels -/vis/scene/add/trajectories smooth -/vis/modeling/trajectories/create/drawByCharge -/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true -/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 -# (if too many tracks cause core dump => /tracking/storeTrajectory 0) -# -# To draw gammas only -#/vis/filtering/trajectories/create/particleFilter -#/vis/filtering/trajectories/particleFilter-0/add gamma -# -# To draw charged particles only -#/vis/filtering/trajectories/particleFilter-0/invert true -# -# Many other options available with /vis/modeling and /vis/filtering. -# For example, select colour by particle ID -#/vis/modeling/trajectories/create/drawByParticleID -#/vis/modeling/trajectories/drawByParticleID-0/set e- red -# remove low energy stuff -/vis/filtering/trajectories/create/attributeFilter -/vis/filtering/trajectories/attributeFilter-0/setAttribute IMag -/vis/filtering/trajectories/attributeFilter-0/addInterval 50 MeV 1000 GeV -# -/vis/scene/endOfEventAction accumulate -# -# At end of each run, an automatic flush causes graphical output. -#/run/beamOn 1 -# When you exit Geant4, you will find a file called scene-0.heprep.zip. -# Unzipping this will give you three separate HepRep files suitable for -# viewing in WIRED. -# The first file will contain just detector geometry. -# The second file will contain the detector plus one event. -# The third file will contain the detector plus ten events. diff --git a/macros/sPHENIXStyle/README.md b/macros/sPHENIXStyle/README.md index 0bb6c73d6..5ed757cb1 100644 --- a/macros/sPHENIXStyle/README.md +++ b/macros/sPHENIXStyle/README.md @@ -23,3 +23,10 @@ and you're good to go (even better, add this all into your ```.rootlogon.C``` fi * "MC" predictions should be filled, with distinguishable colors * Data or pseudodata should always be histograms or graphs with error bars * Elements should never overlap, with each other or with the axis + +# For sPHENIXplots.C (added May 30, 2023) + +This macros is simply a template that uses sPhenixStyle.C and sPhenixStyle.h to create a style recently requested after the first sPHENIX approval plots. +The additions are: + 1. Make a square canvas + 2. Change the default tick spacing diff --git a/macros/sPHENIXStyle/sPHENIXplots.C b/macros/sPHENIXStyle/sPHENIXplots.C new file mode 100644 index 000000000..3a53f5537 --- /dev/null +++ b/macros/sPHENIXStyle/sPHENIXplots.C @@ -0,0 +1,34 @@ +//provisional macro to standardize plotting scheme for approved sPHENIX plots +//May 30 2023 + +#include "sPhenixStyle.h" +#include "sPhenixStyle.C" + +void sPHENIXplots() +{ + SetsPhenixStyle(); + + TCanvas *c = new TCanvas("c", "c", 685, 630); + gPad->SetLogz(); + gPad->SetRightMargin(0.15); + + TLegend *leg = new TLegend(.12,.78,.4,.9); + leg->SetFillStyle(0); + leg->AddEntry("","#it{#bf{sPHENIX}} Preliminary",""); + leg->AddEntry("","Au+Au #sqrt{s_{NN}} = 200 GeV",""); + + TH2D *h = new TH2D("", "", 100, 0, 1, 100, 0, 1); + h->GetYaxis()->SetNdivisions(405); + h->GetXaxis()->SetNdivisions(405); + h->SetXTitle("x-axis title [arb. units]"); + h->SetYTitle("y-axis title [arb. units]"); + h->Draw("col z"); + leg->Draw("same"); + TLatex l; + l.SetNDC(); + l.SetTextFont(43); + l.SetTextSize(25); + l.DrawLatex(0.7, 0.965, "#it{7/21/2023}"); + + c->Print("plot1.pdf"); +} diff --git a/macros/sPHENIXStyle/sPhenixStyle.C b/macros/sPHENIXStyle/sPhenixStyle.C index 53669235d..935f5ef76 100644 --- a/macros/sPHENIXStyle/sPhenixStyle.C +++ b/macros/sPHENIXStyle/sPhenixStyle.C @@ -2,11 +2,13 @@ // sPHENIX Style, based on a style file from BaBar, v0.1 // -#include #include "sPhenixStyle.h" -#include "TROOT.h" +#include +#include + +#include void SetsPhenixStyle () { diff --git a/macros/sPHENIXStyle/sPhenixStyle.h b/macros/sPHENIXStyle/sPhenixStyle.h index 79bfd6c99..859eb2fa1 100644 --- a/macros/sPHENIXStyle/sPhenixStyle.h +++ b/macros/sPHENIXStyle/sPhenixStyle.h @@ -13,7 +13,7 @@ #ifndef __SPHENIXSTYLE_H #define __SPHENIXSTYLE_H -#include "TStyle.h" +#include //! \brief sPHENIX Style, based on a style file from ATLAS by Peter Steinberg /* diff --git a/macros/sPHENIXStyle/test_style.C b/macros/sPHENIXStyle/test_style.C index 6bee38d9a..fbd16283b 100644 --- a/macros/sPHENIXStyle/test_style.C +++ b/macros/sPHENIXStyle/test_style.C @@ -12,7 +12,7 @@ h1.Draw("e1same"); TLegend leg(.55,.70,.85,.93); - leg.AddEntry("","#it{#bf{sPHENIX}} Preliminary",""); + leg.AddEntry("","#it{#bf{sPHENIX}} Simulation",""); leg.AddEntry("","Au+Au #sqrt{s_{NN}}=200 GeV",""); leg.AddEntry(&h1,"Data","LP"); leg.AddEntry(&h2,"MC","F"); diff --git a/validation/calo/figmaker.C b/validation/calo/figmaker.C new file mode 100644 index 000000000..3e200ecdf --- /dev/null +++ b/validation/calo/figmaker.C @@ -0,0 +1,456 @@ + +#include "sPhenixStyle.C" + +void myText(Double_t x,Double_t y,Color_t color, const char *text, Double_t tsize=0.04) { + + TLatex l; l.SetTextAlign(12); l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextColor(color); + l.DrawLatex(x,y,text); +} + +TH1F* proj(TH2F* h2); + +TH1F* FBratio(TH1F* h){ + + const int Nbin = h->GetXaxis()->GetNbins(); + TH1F* hfb = new TH1F("temp32","",Nbin/2,0,Nbin/2); + + for(int i=0; iGetBinContent(b1)/h->GetBinContent(b2); + float err = sqrt( pow(h->GetBinError(b1)/h->GetBinContent(b1),2)+ pow(h->GetBinError(b2)/h->GetBinContent(b2),2))*pow(ratio,2); + hfb->SetBinContent(i,ratio); + hfb->SetBinError(i,err); + } + return hfb; +} + + + +void figmaker(){ + + + SetsPhenixStyle(); + + int totalEvents = 0; + + std::ifstream infile("../condor/runList.txt"); + if (!infile) { std::cerr << "Error: Unable to open the file\n"; return 1;} + std::vector runList; + int num; + while (infile >> num) runList.push_back(num); + + int Nruns= runList.size(); + + for (int ir=0; irGet("h_emcal_mbd_correlation" ); + TH2F* h_ihcal_mbd_correlation = (TH2F*) fin->Get("h_ihcal_mbd_correlation" ); + TH2F* h_ohcal_mbd_correlation = (TH2F*) fin->Get("h_ohcal_mbd_correlation" ); + TH2F* h_emcal_hcal_correlation = (TH2F*) fin->Get("h_emcal_hcal_correlation"); + TH1F* h_InvMass = (TH1F*) fin->Get("h_InvMass" ); + TH2F* h_cemc_etaphi = (TH2F*) fin->Get("h_cemc_etaphi_wQA" ); + TH2F* h_ihcal_etaphi = (TH2F*) fin->Get("h_ihcal_etaphi_wQA" ); + TH2F* h_ohcal_etaphi = (TH2F*) fin->Get("h_ohcal_etaphi_wQA" ); + TH2F* h_zdc_emcal_correlation = (TH2F*) fin->Get("h_zdc_emcal_correlation"); + TH1F* hzdcNorthcalib = (TH1F*) fin->Get("hzdcNorthcalib"); + TH1F* hzdcSouthcalib = (TH1F*) fin->Get("hzdcSouthcalib"); + TH2F* h_etaphi_clus = (TH2F*) fin->Get("h_etaphi_clus" ); + TH1F* hvtx_z_raw = (TH1F*) fin->Get("hvtx_z_raw"); + TProfile2D* h_cemc_etaphi_time = (TProfile2D*) fin->Get("h_cemc_etaphi_time"); + TProfile2D* h_ihcal_etaphi_time = (TProfile2D*) fin->Get("h_ihcal_etaphi_time"); + TProfile2D* h_ohcal_etaphi_time = (TProfile2D*) fin->Get("h_ohcal_etaphi_time"); + + TH2F* h_cemc_e_chi2 = (TH2F*) fin->Get("h_cemc_e_chi2"); + TH2F* h_ohcal_e_chi2 = (TH2F*) fin->Get("h_ohcal_e_chi2"); + TH2F* h_ihcal_e_chi2 = (TH2F*) fin->Get("h_ihcal_e_chi2"); + + TCanvas* c1 = new TCanvas("c1", "c1", 400, 400); + h_emcal_mbd_correlation ->Draw("COLZ"); + h_emcal_mbd_correlation ->SetXTitle("#Sigma #it{E}^{EMCal} [Arb]"); + h_emcal_mbd_correlation ->SetYTitle("#Sigma #it{E}^{MBD} [Arb]"); + h_emcal_mbd_correlation->GetXaxis()->SetNdivisions(505); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + gPad->SetRightMargin(0.15); + gPad->SetLogz(); + + c1->SaveAs(Form("../plots/emcal_mbd_correlation_%d.pdf",run)); + + + TCanvas* c2 = new TCanvas("c2", "c2", 400, 400); + h_ihcal_mbd_correlation ->Draw("COLZ"); + h_ihcal_mbd_correlation ->SetXTitle("#Sigma #it{E}^{ihcal} [Arb]"); + h_ihcal_mbd_correlation ->SetYTitle("#Sigma #it{E}^{MBD} [Arb]"); + h_ihcal_mbd_correlation->GetXaxis()->SetNdivisions(505); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + gPad->SetRightMargin(0.15); + gPad->SetLogz(); + + c2->SaveAs(Form("../plots/ihcal_mbd_correlation_%d.pdf",run)); + + TCanvas* c3 = new TCanvas("c3", "c3", 400, 400); + h_ohcal_mbd_correlation ->Draw("COLZ"); + h_ohcal_mbd_correlation ->SetXTitle("#Sigma #it{E}^{ohcal} [Arb]"); + h_ohcal_mbd_correlation ->SetYTitle("#Sigma #it{E}^{MBD} [Arb]"); + h_ohcal_mbd_correlation->GetXaxis()->SetNdivisions(505); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + gPad->SetRightMargin(0.15); + gPad->SetLogz(); + + c3->SaveAs(Form("../plots/ohcal_mbd_correlation_%d.pdf",run)); + + + TCanvas* c4 = new TCanvas("c4", "c4", 400, 400); + h_emcal_hcal_correlation->Draw("COLZ"); + h_emcal_hcal_correlation->SetXTitle("#Sigma #it{E}^{EMCal} [Arb]"); + h_emcal_hcal_correlation->SetYTitle("#Sigma #it{E}^{HCal} [Arb]"); + h_emcal_hcal_correlation->GetXaxis()->SetNdivisions(505); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + gPad->SetRightMargin(0.15); + gPad->SetLogz(); + + c4->SaveAs(Form("../plots/emcal_hcal_correlation_%d.pdf",run)); + + + TCanvas* c5 = new TCanvas("c5", "c5", 400, 400); + h_InvMass ->Draw(""); + h_InvMass ->SetXTitle("#it{M}_{#gamma#gamma}"); + h_InvMass ->SetYTitle("counts"); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + + c5->SaveAs(Form("../plots/InvMass_%d.pdf",run)); + + + TCanvas* c6 = new TCanvas("c6", "c6", 400, 400); + h_cemc_etaphi ->Draw("COLZ"); + h_cemc_etaphi ->SetXTitle("#it{#eta}_{i} EMCal"); + h_cemc_etaphi ->SetYTitle("#it{#phi}_{i} EMCal"); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80,1,"EMCal"); + gPad->SetRightMargin(0.15); + + c6->SaveAs(Form("../plots/cemc_etaphi_%d.pdf",run)); + + + + + TCanvas* c7 = new TCanvas("c7", "c7", 400, 400); + h_ihcal_etaphi ->Draw("COLZ"); + h_ihcal_etaphi ->SetXTitle("#it{#eta}_{i} iHcal"); + h_ihcal_etaphi ->SetYTitle("#it{#phi}_{i} iHcal"); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80,1,"iHCal"); + gPad->SetRightMargin(0.15); + + c7->SaveAs(Form("../plots/ihcal_etaphi_%d.pdf",run)); + + + TCanvas* c8 = new TCanvas("c8", "c8", 400, 400); + h_ohcal_etaphi ->Draw("COLZ"); + h_ohcal_etaphi ->SetXTitle("#it{#eta}_{i} oHcal"); + h_ohcal_etaphi ->SetYTitle("#it{#phi}_{i} oHcal"); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80,1,"oHCal"); + gPad->SetRightMargin(0.15); + + c8->SaveAs(Form("../plots/ohcal_etaphi_%d.pdf",run)); + + + TH1F* h_emcal_proj = (TH1F*) proj(h_cemc_etaphi)->Clone("h_emcal_proj"); + + TCanvas* c9 = new TCanvas("c9", "c9", 400, 400); + h_emcal_proj->Draw("hist"); + h_emcal_proj->SetYTitle("N^{twr}(E_{T} > 1 GeV)"); + + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80,1,"EMCal"); + + c9->SaveAs(Form("../plots/cemc_proj_%d.pdf",run)); + + + TH1F* h_ohcal_proj = (TH1F*) proj(h_ohcal_etaphi)->Clone("h_ohcal_proj"); + + TCanvas* c10 = new TCanvas("c10", "c10", 400, 400); + h_ohcal_proj->Draw("hist"); + h_ohcal_proj->SetYTitle("N^{twr}(E_{T} > 1 GeV)"); + h_ohcal_proj->GetYaxis()->SetRangeUser(0, h_ohcal_proj->GetMaximum()*1.05); + + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80,1,"oHCal"); + + c10->SaveAs(Form("../plots/ohcal_proj_%d.pdf",run)); + + + TH1F* h_ihcal_proj = (TH1F*) proj(h_ihcal_etaphi)->Clone("h_ihcal_proj"); + + TCanvas* c11 = new TCanvas("c11", "c10", 400, 400); + h_ihcal_proj->Draw("hist"); + h_ihcal_proj->SetYTitle("N^{twr}(E_{T} > 1 GeV)"); + h_ihcal_proj->SetXTitle("#eta_{i}"); + + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80,1,"iHCal"); + + c11->SaveAs(Form("../plots/ihcal_proj_%d.pdf",run)); + + + TH1F* h_fb_ratio_emcal = FBratio(h_emcal_proj); + TH1F* h_fb_ratio_ihcal = FBratio(h_ihcal_proj); + TH1F* h_fb_ratio_ohcal = FBratio(h_ohcal_proj); + + TCanvas* c12 = new TCanvas("c12", "c12", 400, 400); + h_fb_ratio_emcal->Draw("ex0"); + h_fb_ratio_emcal->SetYTitle("N^{twr}(#eta_{i})/N^{twr}(#eta_{N-i})"); + h_fb_ratio_emcal->SetXTitle("#eta_{i}"); + h_fb_ratio_emcal->GetYaxis()->SetRangeUser(0.1,2); + + h_fb_ratio_ohcal->Draw("ex0 same"); + h_fb_ratio_ohcal->SetLineColor(kBlue); + h_fb_ratio_ohcal->SetMarkerColor(kBlue); + h_fb_ratio_ohcal->SetMarkerStyle(22); + + h_fb_ratio_ihcal->Draw("ex0 same"); + h_fb_ratio_ihcal->SetLineColor(kRed); + h_fb_ratio_ihcal->SetMarkerColor(kRed); + h_fb_ratio_ihcal->SetMarkerStyle(33); + + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80,1,"EMCal"); + myText(0.32,0.80,kBlue,"oHCal"); + myText(0.42,0.80,kRed,"iHCal"); + + c12->SaveAs(Form("../plots/h_fb_ratio_emcal_%d.pdf",run)); + + + TCanvas* c13 = new TCanvas("c13", "c13", 400, 400); + h_zdc_emcal_correlation->Draw("COLZ"); + h_zdc_emcal_correlation->SetXTitle("#Sigma #it{E}^{EMCal} [Arb]"); + h_zdc_emcal_correlation->SetYTitle("#Sigma #it{E}^{ZDC} [Arb]"); + h_zdc_emcal_correlation->GetXaxis()->SetNdivisions(505); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + gPad->SetRightMargin(0.15); + gPad->SetLogz(); + + c13->SaveAs(Form("../plots/zdc_emcal_correlation_%d.pdf",run)); + + + TCanvas* c14 = new TCanvas("c14", "c14", 400, 400); + hzdcNorthcalib->Draw(); + hzdcNorthcalib->SetLineColor(kBlue); + hzdcNorthcalib->GetXaxis()->SetRangeUser(0.0,12000); + hzdcNorthcalib->SetXTitle("#Sigma #it{E}^{ZDC Side}"); + hzdcNorthcalib->SetYTitle("Events"); + hzdcNorthcalib->GetXaxis()->SetNdivisions(505); + + hzdcSouthcalib->Draw("same"); + hzdcSouthcalib->SetLineColor(kRed); + gPad->SetLogy(); + + myText(0.7, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.7, 0.85, 1, Form("run %d", run)); + myText(0.75, 0.80, kBlue,"North"); + myText(0.65, 0.80, kRed,"South"); + + c14->SaveAs(Form("../plots/zdc_e_northSouth_%d.pdf",run)); + + + + + TCanvas* c15 = new TCanvas("c15", "c15", 400, 400); + h_etaphi_clus ->Draw("COLZ"); + h_etaphi_clus ->SetXTitle("#it{#eta}_{i} EMCal Clusters"); + h_etaphi_clus ->SetYTitle("#it{#phi}_{i} EMCal Clusters"); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + gPad->SetRightMargin(0.15); + + c15->SaveAs(Form("../plots/etaphi_clus_%d.pdf",run)); + + totalEvents += hvtx_z_raw->GetEntries(); + int events = hvtx_z_raw->GetEntries(); + + TCanvas* c16 = new TCanvas("c16", "c16", 400, 400); + hvtx_z_raw ->Draw("COLZ"); + hvtx_z_raw ->SetXTitle("MBD Vertex #it{z} [cm]"); + hvtx_z_raw ->SetYTitle("Events"); + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80, 1, Form("events %d", events)); + + c16->SaveAs(Form("../plots/vtx_z_%d.pdf",run)); + + + TCanvas* c17 = new TCanvas("c17", "c17", 400, 400); + hzdcNorthcalib->Draw(); + hzdcNorthcalib->SetLineColor(kBlue); + hzdcNorthcalib->GetXaxis()->SetRangeUser(10,300); + hzdcNorthcalib->SetXTitle("#Sigma #it{E}^{ZDC Side}"); + hzdcNorthcalib->SetYTitle("Events"); + + TGraph* gr_1n = new TGraph(); + gr_1n->SetPoint(0,100,0); + gr_1n->SetPoint(1,100,1e7); + gr_1n->SetLineStyle(7); + gr_1n->Draw("l"); + + hzdcSouthcalib->Draw("same"); + hzdcSouthcalib->SetLineColor(kRed); + gPad->SetLogy(); + + myText(0.7, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.7, 0.85, 1, Form("run %d", run)); + myText(0.75, 0.80, kBlue,"North"); + myText(0.65, 0.80, kRed,"South"); + + c17->SaveAs(Form("../plots/zdc_e_northSouth_1n_%d.pdf",run)); + + + TCanvas* c18 = new TCanvas("c18", "c18", 400, 400); + h_cemc_etaphi_time->Draw("COLZ"); + h_cemc_etaphi_time->SetXTitle("#it{#eta}_{i} EMCal"); + h_cemc_etaphi_time->SetYTitle("#it{#phi}_{i} EMCal"); + h_cemc_etaphi_time->GetXaxis()->SetNdivisions(505); + + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80, 1, "mean hit peak time EMCal"); + gPad->SetRightMargin(0.15); + + c18->SaveAs(Form("../plots/cemc_etaphi_time%d.pdf",run)); + + TCanvas* c19 = new TCanvas("c19", "c19", 400, 400); + h_ohcal_etaphi_time->Draw("COLZ"); + h_ohcal_etaphi_time->SetXTitle("#it{#eta}_{i} oHcal"); + h_ohcal_etaphi_time->SetYTitle("#it{#phi}_{i} oHcal"); + h_ohcal_etaphi_time->GetXaxis()->SetNdivisions(505); + + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80, 1, "mean hit peak time Outter HCal"); + gPad->SetRightMargin(0.15); + + c19->SaveAs(Form("../plots/ohcal_etaphi_time%d.pdf",run)); + + + TCanvas* c20 = new TCanvas("c20", "c20", 400, 400); + h_ihcal_etaphi_time->Draw("COLZ"); + h_ihcal_etaphi_time->SetXTitle("#it{#eta}_{i} iHcal"); + h_ihcal_etaphi_time->SetYTitle("#it{#phi}_{i} iHcal"); + h_ihcal_etaphi_time->GetXaxis()->SetNdivisions(505); + + myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.22, 0.85, 1, Form("run %d", run)); + myText(0.22, 0.80, 1, "mean hit peak time Inner HCal"); + gPad->SetRightMargin(0.15); + + c20->SaveAs(Form("../plots/ihcal_etaphi_time%d.pdf",run)); + + TCanvas* c21 = new TCanvas("c21", "c21", 400, 400); + h_ihcal_e_chi2->Draw("COLZ"); + h_ihcal_e_chi2->SetXTitle("#i{E} [GeV] iHcal"); + h_ihcal_e_chi2->SetYTitle("chi2 iHcal"); + h_ihcal_e_chi2->GetXaxis()->SetNdivisions(505); + h_ihcal_e_chi2->GetXaxis()->SetRangeUser(-1,2); + gPad->SetLogy(); + gPad->SetLogz(); + + myText(0.52, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.52, 0.85, 1, Form("run %d", run)); + myText(0.52, 0.80, 1, "Inner HCal"); + gPad->SetRightMargin(0.15); + + c21->SaveAs(Form("../plots/ihcal_e_chi2%d.pdf",run)); + + + TCanvas* c22 = new TCanvas("c22", "c22", 400, 400); + h_ohcal_e_chi2->Draw("COLZ"); + h_ohcal_e_chi2->SetXTitle("#i{E} [GeV] oHcal"); + h_ohcal_e_chi2->SetYTitle("chi2 oHcal"); + h_ohcal_e_chi2->GetXaxis()->SetNdivisions(505); + h_ohcal_e_chi2->GetXaxis()->SetRangeUser(-1,7); + gPad->SetLogy(); + gPad->SetLogz(); + + myText(0.52, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.52, 0.85, 1, Form("run %d", run)); + myText(0.52, 0.80, 1, "Outer HCal"); + gPad->SetRightMargin(0.15); + + c22->SaveAs(Form("../plots/ohcal_e_chi2%d.pdf",run)); + + + TCanvas* c23 = new TCanvas("c23", "c23", 400, 400); + h_cemc_e_chi2->Draw("COLZ"); + h_cemc_e_chi2->SetXTitle("#i{E} [GeV] EMCal "); + h_cemc_e_chi2->SetYTitle("chi2 EMCal"); + h_cemc_e_chi2->GetXaxis()->SetNdivisions(505); + h_cemc_e_chi2->GetXaxis()->SetRangeUser(-1,15); + gPad->SetLogy(); + gPad->SetLogz(); + + myText(0.52, 0.9, 1, "#it{#bf{sPHENIX}} Internal"); + myText(0.52, 0.85, 1, Form("run %d", run)); + myText(0.52, 0.80, 1, "EMCal"); + gPad->SetRightMargin(0.15); + + c23->SaveAs(Form("../plots/cemc_e_chi2%d.pdf",run)); + + } + + for (int ir=0; irReset(); + for (int ix=1; ixGetBinContent(ix,iy); + if (bc==0) cc+=1; + sum += bc; + } + if (cc==y) continue; + float sum_cor = sum*y/(y-cc); + h->SetBinContent(ix,sum_cor); + h->SetBinError(ix,sqrt(sum_cor)); + } + + + return h; +} +