FairRoot/PandaRoot
PndSdsTimeWalkCorrTask.cxx
Go to the documentation of this file.
1 /*
2  * PndSdsTimeWalkCorrTask.cxx
3  *
4  * Created on: Aug 27, 2010
5  * Author: Simone Esch
6  */
7 
9 #include "PndSdsFESimple.h"
10 
11 
13 
14 // ----- Default constructor -------------------------------------------
15 
17  PndSdsTask("SDS TimeWalkCorrection Task"),
18  fDigiArray(NULL),
19  fDigiCorrArray(NULL),
20  fDigiPar(NULL),
21  fDigiTotPar(NULL),
22  fFEModel(NULL),
23  fVerbose(0)
24 {
25  SetPersistency(kTRUE);
26 }
27 
28 // ----- Named constructor ---------------------------------------------
30  PndSdsTask(name),
31  fDigiArray(NULL),
32  fDigiCorrArray(NULL),
33  fDigiPar(NULL),
34  fDigiTotPar(NULL),
35  fFEModel(NULL),
36  fVerbose(1)
37 {
38  SetPersistency(kTRUE);
39 }
40 
41 
43 }
44 
45 // ----- Initialization of Parameter Containers -------------------------
47 {
48  if( ! fDigiPar) Fatal("SetParContainers","No digitiztiopn parameters specified");
49  if( ! fDigiTotPar ) Fatal("SetParContainers","No tot digitiztiopn parameters specified");
50  if(fVerbose>1) Info("SetParContainers","done.");
51  return;
52 }
53 
54 
55 // ----- Public method Init --------------------------------------------
57 {
59 
60  fFEModel = new PndSdsFESimple();
61 
62  FairRootManager* ioman = FairRootManager::Instance();
63 
64  if ( ! ioman )
65  {
66  std::cout << "-E- PndSdsTimeWalkCorrTask::Init: "
67  << "RootManager not instantiated!" << std::endl;
68  return kFATAL;
69  }
70 
71  // Get input array
72  fDigiArray = (TClonesArray*) ioman->GetTClonesArray(fInBranchName);
73 
74  if ( ! fDigiArray )
75  {
76  std::cout << "-W- PndSdsTimeWalkCorrTask::Init: " << "No SDSDigi array!" << std::endl;
77  return kERROR;
78  }
79 
80  // Create output array
81  fDigiCorrArray = ioman->Register(fOutBranchName, "PndSdsDigiPixel", fFolderName, GetPersistency());
82 
83  SetInBranchId();
84 
85  fDigiPar->Print();
86  fDigiTotPar->Print();
87 
88  std::cout << "-I- PndSdsTimeWalkCorrTask: Initialisation successfull" << std::endl;
89 
90  return kSUCCESS;
91 }
92 // -------------------------------------------------------------------------
93 
95 {
96 
97  if ( ! fDigiCorrArray ) Fatal("Exec", "No ClusterArray");
98  fDigiCorrArray->Delete();
99 
100 
101  Int_t nPoints = fDigiArray->GetEntriesFast();
102 
103  for (Int_t iPoint = 0; iPoint < nPoints; iPoint++)
104  {
105  PndSdsDigiPixel myDigi = *(PndSdsDigiPixel*)(fDigiArray->At(iPoint));
106  myDigi.SetTimeStamp(myDigi.GetTimeStamp() - fFEModel->GetTimeWalkFromTot(myDigi.GetCharge()) - fFEModel->GetTimeStep()/2);
107  new ((*fDigiCorrArray)[iPoint])PndSdsDigiPixel(myDigi);
108  }
109 
110 }
111 
113 {
114  if ( ! fDigiCorrArray ) Fatal("Exec", "No ClusterArray");
115  fDigiCorrArray->Delete();
116 
117 
118  Int_t nPoints = fDigiArray->GetEntriesFast();
119 
120  for (Int_t iPoint = 0; iPoint < nPoints; iPoint++)
121  {
122  PndSdsDigiPixel myDigi = *(PndSdsDigiPixel*)(fDigiArray->At(iPoint));
123  myDigi.SetTimeStamp(myDigi.GetTimeStamp() - fFEModel->GetTimeWalkFromTot(myDigi.GetCharge()) - fFEModel->GetTimeStep()/2);
124  new ((*fDigiCorrArray)[iPoint])PndSdsDigiPixel(myDigi);
125  }
126 }
int fVerbose
Definition: poormantracks.C:24
TString fOutBranchName
Definition: PndSdsTask.h:40
PndSdsTotDigiPar * fDigiTotPar
Double_t GetCharge() const
Definition: PndSdsDigi.h:60
virtual double GetTimeStep()
Definition: PndSdsFE.h:60
void SetPersistency(Bool_t val=kTRUE)
PndSdsPixelDigiPar * fDigiPar
ClassImp(PndSdsTimeWalkCorrTask)
TString fInBranchName
Definition: PndSdsTask.h:39
virtual void SetBranchNames()=0
virtual double GetTimeWalkFromTot(double tot)
Definition: PndSdsFE.cxx:69
TString fFolderName
Definition: PndSdsTask.h:41
TString name
virtual void Print(std::ostream &out=std::cout) const
Data class to store the digi output of a pixel module.
virtual void Print(std::ostream &out=std::cout) const
virtual void SetInBranchId()
Definition: PndSdsTask.h:30