FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairTutorialDet2DigiPar.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 // -------------------------------------------------------------------------
9 // ----- FairTutorialDet2DigiPar source file -----
10 // ----- Created 05/06/08 by F. Uhlig -----
11 // -------------------------------------------------------------------------
12 
14 
15 #include "FairLogger.h"
16 #include "FairParamList.h"
17 
18 #include <TArrayF.h>
19 #include <TString.h>
20 
21 FairTutorialDet2DigiPar::FairTutorialDet2DigiPar(const char* name, const char* title, const char* context)
22  : FairParGenericSet(name, title, context)
23  , ftutdetdigipar(new TArrayF(10))
24  , ftutdetdigiparsector()
25  , ftutdetdigiparstation(-1)
26 {
27  detName = "TutorialDet";
28  // ftutdetdigipar = new TArrayF(10);
29  // ftutdetdigipar = new TArrayF(10);
30 }
31 
33 
35 {
36  status = kFALSE;
38 }
39 
41 {
42  LOG(info) << "Print";
43  LOG(info) << "ftutdetdigiparstation: " << ftutdetdigiparstation;
44  Int_t size = ftutdetdigiparsector.GetSize();
45  LOG(info) << "size: " << size;
46  for (Int_t i = 0; i < size; i++) {
47  LOG(info) << i << " :" << ftutdetdigiparsector.GetAt(i);
48  }
49  size = ftutdetdigipar->GetSize();
50  LOG(info) << "size: " << size;
51  for (Int_t i = 0; i < size; i++) {
52  LOG(info) << i << " :" << ftutdetdigipar->GetAt(i);
53  }
54 }
55 
57 {
58  // print();
59  LOG(info) << "I am in FairTutorialDet2DigiPar::putParams ";
60  if (!l) {
61  return;
62  }
63  l->add("FairTutorialDet2DigiStations", ftutdetdigiparstation);
64  l->add("FairTutorialDet2DigiSectorsPerStation", ftutdetdigiparsector);
65  Int_t count_sectors = 0;
66  for (Int_t i = 0; i < ftutdetdigiparstation; i++) {
67  count_sectors += ftutdetdigiparsector[i];
68  }
69  Int_t array_size = (count_sectors * 10 + ftutdetdigiparstation * 3);
70  LOG(info) << "Array Size: " << array_size;
71  /* Float_t zwischen[array_size];
72  for (Int_t i=0; i< array_size; i++) {
73  zwischen[i] = ftutdetdigipar.GetAt(i);
74  }
75  */
76  ftutdetdigipar->Set(array_size);
77  l->add("FairTutorialDet2DigiPar", *ftutdetdigipar);
78 }
79 
81 {
82  // print();
83 
84  LOG(info) << "I am in FairTutorialDet2DigiPar::getParams ";
85 
86  if (!l) {
87  return kFALSE;
88  }
89  if (!l->fill("FairTutorialDet2DigiStations", &ftutdetdigiparstation)) {
90  return kFALSE;
91  }
92  ftutdetdigiparsector.Set(ftutdetdigiparstation);
93 
94  if (!l->fill("FairTutorialDet2DigiSectorsPerStation", &ftutdetdigiparsector)) {
95  return kFALSE;
96  }
97 
98  Int_t count_sectors = 0;
99  for (Int_t i = 0; i < ftutdetdigiparstation; i++) {
100  count_sectors += ftutdetdigiparsector[i];
101  }
102  LOG(info) << "Total number of sectors: " << count_sectors;
103 
104  Int_t array_size = (count_sectors * 10 + ftutdetdigiparstation * 3);
105  LOG(info) << "Array Size: " << array_size;
106  ftutdetdigipar->Set(array_size);
107  // Float_t zwischen[array_size];
108  if (!(l->fill("FairTutorialDet2DigiPar", ftutdetdigipar))) {
109  LOG(warn) << "Could not initialize FairTutorialDet2DigiPar";
110  return kFALSE;
111  }
112  // ftutdetdigipar.Set(array_size, zwischen);
113  return kTRUE;
114 }
115 
Bool_t status
versions of container in the 2 possible inputs
Definition: FairParSet.h:25
TString detName
Definition: FairParSet.h:23
ClassImp(FairEventBuilder)
void putParams(FairParamList *)
FairTutorialDet2DigiPar(const char *name="FairTutorialDet2DigiPar", const char *title="Tutorial Det digi parameters", const char *context="Default")
Bool_t fill(const Text_t *, Text_t *, const Int_t)
void resetInputVersions()
Definition: FairParSet.cxx:121
Bool_t getParams(FairParamList *)
void add(FairParamObj &)