9#include <ecl/digitization/OfflineFitFunction.h>
21int main(
int argc,
char* argv[])
24 TString OutputDirectory =
"";
25 if (OutputDirectory ==
".") {
26 std::cout <<
"Error set output directory" << std::endl;
31 int LowIDLimit = atoi(argv[1]);
32 int HighIDLimit = atoi(argv[2]);
34 double PhotonWaveformPar[11];
35 TFile* PhotonParFile =
new TFile(OutputDirectory +
"PhotonWaveformParameters.root");
36 TTree* chain =
static_cast<TTree*
>(PhotonParFile->Get(
"ParTree"));
37 chain->SetBranchAddress(
"PhotonPar", &PhotonWaveformPar);
39 TFile* f =
new TFile(OutputDirectory + Form(
"PhotonShapes_Low%d_High%d.root", LowIDLimit, HighIDLimit),
"RECREATE");
41 TTree* mtree =
new TTree(
"mtree",
"");
42 std::vector<double> PhotonWaveformArray(100000);
43 mtree->Branch(
"PhotonArray", PhotonWaveformArray.data(),
"PhotonWaveformArray[100000]/D");
46 for (Long64_t jentry = LowIDLimit; jentry < HighIDLimit; jentry++) {
47 chain->GetEntry(jentry);
48 TF1 PhotonShapeFunc = TF1(Form(
"photonShape_%lld", jentry), Belle2::ECL::WaveFuncTwoComponent, 0, 20, 26);;
49 PhotonShapeFunc.SetNpx(1000);
50 std::cout << PhotonWaveformPar[0] << std::endl;
51 PhotonShapeFunc.SetParameter(0, 0);
52 PhotonShapeFunc.SetParameter(1, 0);
53 PhotonShapeFunc.SetParameter(2, 1);
54 PhotonShapeFunc.SetParameter(3, 0);
55 for (
int k = 0; k < 10; k++) {
56 PhotonShapeFunc.SetParameter(4 + k, PhotonWaveformPar[k + 1]);
57 PhotonShapeFunc.SetParameter(10 + 4 + k, PhotonWaveformPar[k + 1]);
59 PhotonShapeFunc.SetParameter(24, PhotonWaveformPar[0]);
60 PhotonShapeFunc.SetParameter(25, 1);
62 if (PhotonWaveformPar[0] > 0 && jentry <= 8737) {
63 for (
unsigned int k = 0; k < PhotonWaveformArray.size();
64 k++) PhotonWaveformArray[k] = PhotonShapeFunc.Eval(((
double)k) * (1. / 1000.)) ;
66 for (
unsigned int k = 0; k < PhotonWaveformArray.size(); k++) PhotonWaveformArray[k] = -999;