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