FairRoot/PandaRoot
PndPosCorrectorTask.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 version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 // -------------------------------------------------------------------------
9 // ----- PndPosCorrectorTaskT source file -----
10 // -------------------------------------------------------------------------
11 
12 #include "PndPosCorrectorTask.h"
13 
14 #include "PndSdsHit.h"
15 
16 #include "FairLink.h" // for FairLink
17 #include "FairRootManager.h" // for FairRootManager
18 #include "FairTimeStamp.h" // for FairTimeStamp
19 
20 #include <iosfwd> // for ostream
21 #include "TClass.h" // for TClass
22 #include "TClonesArray.h" // for TClonesArray
23 
24 #include <iostream> // for operator<<, cout, ostream, etc
25 #include <vector> // for vector
26 
28 {
29  return kSUCCESS;
30 }
31 
32 // ----- Public method Init --------------------------------------------
34 {
35 
36  FairRootManager* ioman = FairRootManager::Instance();
37  if ( ! ioman ) {
38  std::cout << "-E- PndPosCorrectorTaskT::Init: "
39  << "RootManager not instantiated!" << std::endl;
40  return kFATAL;
41  }
42 
43  // Create and register output array
44  fInputArray = (TClonesArray*)FairRootManager::Instance()->GetObject(fInputBranch);
45 
46  if(fVerbose>1) { Info("Init","Registering this branch: %s/%s",fFolder.Data(),fOutputBranch.Data()); }
47  fOutputArray = ioman->Register(fOutputBranch, fInputArray->GetClass()->GetName(), fFolder, fPersistance);
48 
49 
50  return kSUCCESS;
51 }
52 // -------------------------------------------------------------------------
53 
54 // ----- Public method Exec --------------------------------------------
56 {
57 
58 // fInputArray = (FairRootManager::Instance()->GetTClonesArray(fInputBranch);
59  if (fVerbose > 1 && ++fEntryNr % 1000 == 0) {
60  std::cout << "-I- PndPosCorrectorTask: Event " << fEntryNr << " Size PixelArray: " << fInputArray->GetEntriesFast() << std::endl;
61  }
62  Double_t timeOfLast = 0;
63  for (int i = 0; i < fInputArray->GetEntriesFast(); i++) {
64  PndSdsHit* myData = (PndSdsHit*)fInputArray->At(i);
65  myData->SetX(myData->GetX() - fPosCorrectionMap[myData->GetSensorID()].first);
66  myData->SetY(myData->GetY() - fPosCorrectionMap[myData->GetSensorID()].second);
67 
68  (*fOutputArray)[fOutputArray->GetEntries()] = myData->Clone();
69  // delete(myData);
70  }
71  //fOutputArray->Sort();
72 }
73 
74 // -------------------------------------------------------------------------
75 
77 {
78  fOutputArray->Delete();
79 }
80 
82 {
83 }
84 
int fVerbose
Definition: poormantracks.C:24
Int_t i
Definition: run_full.C:25
ClassImp(PndPosCorrectorTask)
virtual void Exec(Option_t *opt)
Double_t
std::map< Int_t, std::pair< Double_t, Double_t > > fPosCorrectionMap
TClonesArray * fOutputArray
virtual InitStatus Init()
Int_t GetSensorID() const
Definition: PndSdsHit.h:90
TClonesArray * fInputArray
virtual InitStatus ReInit()