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