FairRoot/PandaRoot
PndMissingPzCleanerTask.cxx
Go to the documentation of this file.
1 /*
2  * PndMissingPzCleanerTask.cpp
3  *
4  * Created on: Jun 26, 2013
5  * Author: schumann
6  */
7 
8 // Root includes
9 #include "TROOT.h"
10 #include "TClonesArray.h"
11 
12 #include "FairRootManager.h"
13 
14 #include "PndTrack.h"
15 
17 
18 
20 
21 
23 }
24 
26 
27  FairRootManager* ioman = FairRootManager::Instance();
28 
29  if (!ioman) {
30  std::cout << "-E- PndMissingPzCleanerTask::Init: "
31  << "RootManager not instantiated!" << std::endl;
32  return kFATAL;
33  }
34 
35  // get data-object
36  fTracks = (TClonesArray*) ioman->GetObject(fInputTrackBranch);
37 
38  if (fOutputTrackBranch.Length() == 0){
40  fOutputTrackBranch.Append("_filtered");
41  }
42 
43  fFilteredTracks = ioman->Register(fOutputTrackBranch, "PndTrack", "Tracks", GetPersistency());
44 
45  return kSUCCESS;
46 
47 }
48 
50 
51 // if (fVerbose > 0) {
52 // std::cout << "============= Begin PndMissingPzCleanerTask::Exec" << std::endl;
53 // std::cout << std::endl;
54 // }
55  FairRootManager* ioman = FairRootManager::Instance();
56  fFilteredTracks->Delete();
57 
58  for (int i = 0; i < fTracks->GetEntriesFast(); i++){
59  PndTrack* myTrack = (PndTrack*)fTracks->At(i);
60  int nNoStt = myTrack->GetLinksWithType(ioman->GetBranchId("MVDHitsPixel")).GetNLinks();
61  nNoStt += myTrack->GetLinksWithType(ioman->GetBranchId("MVDHitsStrip")).GetNLinks();
62  nNoStt += myTrack->GetLinksWithType(ioman->GetBranchId("GEMHit")).GetNLinks();
63  int nStt = myTrack->GetLinksWithType(ioman->GetBranchId("STTHit")).GetNLinks();
64 
65  if ((nStt > 0) && (nNoStt == 0)){
66  if ((myTrack->GetParamFirst().GetPz() > 0.015) && (myTrack->GetParamFirst().GetPz() < 0.025)){
67  myTrack->SetFlag(-30);
68  std::cout << ioman->GetEntryNr() << "/" << i << " : Wrong Pz Track found: " << *myTrack << std::endl;
69  }
70  }
71 
72  if (!((fRemoveTrack == kTRUE) && (myTrack->GetFlag() == -30)))
73  new ((*fFilteredTracks)[fFilteredTracks->GetEntriesFast()]) PndTrack(*myTrack);
74  else
75  std::cout << "Track removed " << i <<std::endl;
76  }
77 
78 
79 }
80 
81 
83  if(fTracks != 0) fTracks->Delete();
84 }
85 
87 }
88 
virtual void Exec(Option_t *opt)
Int_t i
Definition: run_full.C:25
Int_t GetFlag() const
Definition: PndTrack.h:33
ClassImp(PndMissingPzCleanerTask)
Bool_t fRemoveTrack
if this flag is set than the track will not be written to the output branch. Otherwise the flag -30 w...
void SetFlag(Int_t i)
Definition: PndTrack.h:38
FairTrackParP GetParamFirst()
Definition: PndTrack.h:49