16 #include <TClonesArray.h>
20 :
FairTask(
"FairTutorialDet4MilleWriter")
28 LOG(debug) <<
"Default Constructor of FairTutorialDet4MilleWriter";
33 LOG(debug) <<
"Destructor of FairTutorialDet4MilleWriter";
38 LOG(debug) <<
"SetParContainers of FairTutorialDet4MilleWriter";
51 LOG(debug) <<
"Initilization of FairTutorialDet4MilleWriter";
57 fTracks =
static_cast<TClonesArray*
>(ioman->
GetObject(
"TutorialDetTrack"));
59 LOG(error) <<
"No InputDataLevelName array!\n FairTutorialDet4MilleWriter will be inactive";
64 fHits =
static_cast<TClonesArray*
>(ioman->
GetObject(
"TutorialDetHit"));
66 LOG(error) <<
"No InputDataLevelName array!\n FairTutorialDet4MilleWriter will be inactive";
72 fFileName +=
".ascii";
73 fMille =
new Mille(fFileName,
false,
true);
76 fMille =
new Mille(fFileName,
true,
false);
84 LOG(debug) <<
"Initilization of FairTutorialDet4MilleWriter";
95 StraightLineShiftXY();
100 Bool_t FairTutorialDet4MilleWriter::IsGoodEvent()
108 std::set<Int_t> detIdSet;
109 std::set<Int_t>::iterator it;
111 Int_t nHits = fHits->GetEntriesFast();
112 for (Int_t iHit = 0; iHit < nHits; ++iHit) {
115 it = detIdSet.find(detId);
116 if (it == detIdSet.end()) {
117 detIdSet.insert(detId);
127 void FairTutorialDet4MilleWriter::StraightLineShiftX()
140 Float_t* derLC =
new Float_t[nLC];
141 Float_t* derGL =
new Float_t[nGL];
143 Int_t* label =
new Int_t[nGL];
145 for (Int_t help = 0; help < nGL; help++) {
149 for (Int_t help = 0; help < nLC; help++) {
156 Double_t OffX = track->
GetX();
157 Double_t SlopeX = track->
GetTx();
163 Int_t nHits = fHits->GetEntriesFast();
164 for (Int_t iHit = 0; iHit < nHits; ++iHit) {
167 Float_t Z = hit->
GetZ();
168 Float_t hitX = hit->
GetX();
169 Float_t fitX = OffX + SlopeX * Z;
170 LOG(debug) <<
"hitX, fitX: " << hitX <<
" ," << fitX;
179 residual = fitX - hitX;
180 LOG(debug) <<
"ResidualX: " << residual;
182 fMille->
mille(nLC, derLC, nGL, derGL, label, residual, sigma);
191 void FairTutorialDet4MilleWriter::StraightLineShiftXY()
204 Float_t* derLC =
new Float_t[nLC];
205 Float_t* derGL =
new Float_t[nGL];
207 Int_t* label =
new Int_t[nGL];
209 for (Int_t help = 0; help < nGL; help++) {
213 for (Int_t help = 0; help < nLC; help++) {
220 Double_t OffX = track->
GetX();
221 Double_t SlopeX = track->
GetTx();
222 Double_t OffY = track->
GetY();
223 Double_t SlopeY = track->
GetTy();
229 Int_t nHits = fHits->GetEntriesFast();
230 for (Int_t iHit = 0; iHit < nHits; ++iHit) {
233 Float_t Z = hit->
GetZ();
234 Float_t hitX = hit->
GetX();
235 Float_t fitX = OffX + SlopeX * Z;
236 Float_t hitY = hit->
GetY();
237 Float_t fitY = OffY + SlopeY * Z;
238 LOG(debug) <<
"hitX, fitX: " << hitX <<
" ," << fitX;
241 label[1] = iHit + 101;
251 residual = fitX - hitX;
252 LOG(debug) <<
"ResidualX: " << residual;
254 fMille->
mille(nLC, derLC, nGL, derGL, label, residual, sigma);
264 residual = fitY - hitY;
265 LOG(debug) <<
"ResidualX: " << residual;
267 fMille->
mille(nLC, derLC, nGL, derGL, label, residual, sigma);
virtual InitStatus ReInit()
static FairRootManager * Instance()
~FairTutorialDet4MilleWriter()
ClassImp(FairEventBuilder)
TObject * GetObject(const char *BrName)
Int_t GetDetectorID() const
virtual InitStatus Init()
FairTutorialDet4MilleWriter()
void mille(int NLC, const float *derLc, int NGL, const float *derGl, const int *label, float rMeas, float sigma)
virtual void Exec(Option_t *opt)
virtual void SetParContainers()