StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoFmsFiller.cxx
1 //
2 // StPicoFmsFiller is a helper class that stores FMS information to the PicoDst
3 //
4 
5 // ROOT headers
6 #include "TClonesArray.h"
7 
8 // MuDst headers
9 #include "StMuDSTMaker/COMMON/StMuDst.h"
10 #include "StMuDSTMaker/COMMON/StMuFmsCollection.h"
11 #include "StMuDSTMaker/COMMON/StMuFmsHit.h"
12 
13 // PicoDst headers
14 #include "StPicoDstMaker/StPicoFmsFiller.h"
15 #include "StPicoEvent/StPicoDst.h"
16 #include "StPicoEvent/StPicoFmsHit.h"
17 
18 //_________________
19 StPicoFmsFiller::StPicoFmsFiller(StPicoDst& picoDst) : mPicoDst(picoDst) {
20  /* empty */
21 }
22 
27 //_________________
28 void StPicoFmsFiller::fill(const StMuDst& muDst, const StFmsDbMaker* fmsDbMaker) {
29 
30  StMuFmsCollection* muFmsCollection = muDst.muFmsCollection();
31  TClonesArray* muFmsHits = muFmsCollection ? muFmsCollection->getHitArray() : nullptr;
32 
33  if (!muFmsHits) {
34  // std::cout << "StMuFmsHits not found in StMuDst\n";
35  return;
36  }
37 
38  TClonesArray *hitCollection = mPicoDst.picoArray(StPicoArrays::FmsHit);
39 
40  for (const TObject* obj : *muFmsHits) {
41 
42  const StMuFmsHit& muFmsHit = static_cast<const StMuFmsHit&>(*obj);
43  int counter = hitCollection->GetEntries();
44  new((*hitCollection)[counter]) StPicoFmsHit(muFmsHit.detectorId(),
45  muFmsHit.channel(),
46  muFmsHit.adc());
47  }
48 }
void fill(const StMuDst &muDst, const StFmsDbMaker *fmsDbMaker=nullptr)
Fill FMS info.
static StMuFmsCollection * muFmsCollection()
returns pointer to current StMuFmsCollection
Definition: StMuDst.h:391
static TClonesArray * picoArray(Int_t type)
Return pointer to the n-th TClonesArray.
Definition: StPicoDst.h:60
Holds information about FMS hit.
Definition: StPicoFmsHit.h:17
Main class that keeps TClonesArrays with main classes.
Definition: StPicoDst.h:40
StPicoFmsFiller(StPicoDst &picoDst)
Constructor.