Skip to content

Commit

Permalink
removed some local paths and generalised
Browse files Browse the repository at this point in the history
  • Loading branch information
simonge committed May 16, 2024
1 parent 8569cbe commit 29374e0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
5 changes: 1 addition & 4 deletions benchmarks/LOWQ2/analysis/LOWQ2Benchmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ using RVecI = ROOT::VecOps::RVec<int>;

std::map<TString,std::tuple<std::map<TString,H1ResultPtr>,std::map<TString,H2ResultPtr>,std::map<TString,H3ResultPtr>>> histMap;



//---------------------------------------------------------------------------------------------
// Create dataframe from input file(s)
//---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -228,8 +226,7 @@ void writePlots( TString outName ){
//---------------------------------------------------------------------------------------------
// Create the benchmark plots
//---------------------------------------------------------------------------------------------
void LOWQ2Benchmarks( string inName = "/scratch/EIC/G4out/qr_18x275_new.edm4hep*.root",
TString outName = "LOWQ2QRRates.root", dd4hep::Detector& detector=dd4hep::Detector::getInstance(), double eventRate=0.0 ){
void LOWQ2Benchmarks( string inName, TString outName, dd4hep::Detector& detector, double eventRate ){

auto node = initialise( inName );

Expand Down
4 changes: 1 addition & 3 deletions benchmarks/LOWQ2/analysis/LOWQ2hits.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ std::tuple<std::map<TString,H1ResultPtr>,std::map<TString,H2ResultPtr>,std::map<
.Define(yHalfChipName,"yHalfChipID[LayerFilter&&ModuleFilter]")
.Define(xColumnName,"xColumnID[LayerFilter&&ModuleFilter]")
.Define(layerSizeName,[](RVecI lay){return lay.size();},layerSizeInput);




hHists1D[moduleTag+"/"+layerTag+"/"+xHistName] = d4.Histo1D({xHistName, xHistName+";x pixel column;Rate [Hz]", xRange, xMin, xMax }, xName, "eventWeight");

hHists1D[moduleTag+"/"+layerTag+"/"+yHistName] = d4.Histo1D({yHistName, yHistName+";y pixel column;Rate [Hz]", yRange, yMin, yMax }, yName, "eventWeight");
Expand All @@ -123,7 +122,6 @@ std::tuple<std::map<TString,H1ResultPtr>,std::map<TString,H2ResultPtr>,std::map<
}
}


return {hHists1D,hHists2D,hHists3D};

}
37 changes: 21 additions & 16 deletions benchmarks/LOWQ2/analysis/RunLOWQ2.C
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
#include "LOWQ2Benchmarks.h"
#include <cstdlib>

void RunLOWQ2(std::string inputFileName="Brems_input.root", std::string outputFileName="plots/LOWQ2BremsRecon3.root",
double eventCrossSection=0, std::string compactName="/opt/detector/epic-nightly/share/epic/epic.xml") {
void RunLOWQ2( std::string inputFileName = "Brems_input.root",
std::string outputFileName = "plots/LOWQ2QRRecon3.root",
std::string compactName = "/opt/detector/epic-nightly/share/epic/epic.xml",
bool inputIsTimeBased = false, // true if the event sample is time-based, false if it is event-based
double timeWindow = 10.15*1e-9, //[s]
double eventCrossSection = 0.0551, // [mb]
double luminosity = 1e34, // [cm^-2 s^-1]
) {

//Set implicit multi-threading
ROOT::EnableImplicitMT();

// Output script running conditions
std::cout << "Running LOWQ2 benchmarks with the following parameters:" << std::endl;
std::cout << " - input file: " << inputFileName << std::endl;
std::cout << " - output file: " << outputFileName << std::endl;
std::cout << " - xml file: " << compactName << std::endl;
std::cout << " - input is time-based: " << inputIsTimeBased << std::endl;
std::cout << " - time window: " << timeWindow << " s" << std::endl;
std::cout << " - event cross section: " << eventCrossSection << " mb" << std::endl;
std::cout << " - luminosity: " << luminosity << " cm^-2 s^-1" << std::endl;

dd4hep::Detector& detector = dd4hep::Detector::getInstance();
detector.fromCompact(compactName);

double luminosity = 1e34; // [cm^-2 s^-1]
double eBeamEnergy = 18.0; // [GeV]
double pBeamEnergy = 275.0; // [GeV]
double eventCrossSectionQR = 0.0551; // [mb]
double eventCrossSectionBrems = 171.3; // [mb]
double bunchSpacing = 10.15*1e-9; // [s]

double eventRateQR = luminosity * eventCrossSectionQR * 1e-27; // [Hz]
double eventRateBrems = luminosity * eventCrossSectionBrems * 1e-27; // [Hz]
double bunchRate = 1.0 / bunchSpacing; // [Hz]
// eventCrossSectionBrems = 171.3; [mb]
// eventCrossSectionQR = 0.0551; [mb]

double eventRate = luminosity * eventCrossSection * 1e-27; // [Hz]

//LOWQ2Benchmarks("/scratch/EIC/ReconOut/QR_new.root","plots/LOWQ2QRRecon2.root",detector,eventRateQR);
LOWQ2Benchmarks("/scratch/EIC/ReconOut/Brems_new.root","plots/LOWQ2BremsRecon2.root",detector,eventRateBrems);
LOWQ2Benchmarks("/scratch/EIC/ReconOut/Brems_new.root","plots/LOWQ2BremsRecon3.root",detector,bunchRate);
//LOWQ2Benchmarks(inputFileName,outputFileName,detector,eventRate);
if(inputIsTimeBased){
eventRate = 1.0 / timeWindow; // [Hz]
}

LOWQ2Benchmarks(inputFileName,outputFileName,detector,eventRate);

}

0 comments on commit 29374e0

Please sign in to comment.