eventAnalysis  7.0-49-g0ac7482
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TLowLevelInfoModule.cxx
Go to the documentation of this file.
2 #include "TGeomInfo.hxx"
3 #include "THit.hxx"
4 #include "TIntegerDatum.hxx"
5 #include "TTFBChannelId.hxx"
6 #include "TTFBDigit.hxx"
7 
10 
12  const char* title) {
13  SetNameTitle(name, title);
14  // Enable this module by default:
15  fIsEnabled = kTRUE;
16  fDescription =
17  "Module for extracting TDigit and THit level info from the output of "
18  "eventUnpack";
20  new TClonesArray("ND::TLowLevelInfoModule::TLowLevelTFBDigit", 100);
22  new TClonesArray("ND::TLowLevelInfoModule::TLowLevelHit", 100);
23 }
25  // DIGIT AND HIT INFO
26  fOutputTree->Branch("TFBDigitArray", &fLowLevelTFBDigits, fBufferSize,
27  fSplitLevel);
28  fOutputTree->Branch("HitArray", &fLowLevelHits, fBufferSize, fSplitLevel);
29 }
30 
31 bool ND::TLowLevelInfoModule::FillTree(ND::TND280Event& event) {
32  fEventNumber = event.GetEventId();
33 
34  // ===========================================================================
35  // First get mcmTrig info
36  //
37  Long64_t fTdcTrig = 0;
38 
39  ND::THandle<ND::TIntegerDatum> mcmTrigTime =
40  event.Get<ND::TIntegerDatum>("mcmTrigTime");
41  if (mcmTrigTime) {
42  UInt_t trigger_mcmTDC = static_cast<UInt_t>(mcmTrigTime->GetValue());
43  const Long64_t mcmTick(4LL);
44  fTdcTrig = mcmTick * trigger_mcmTDC;
45  }
46 
47  Long64_t fTdcRead = 0;
48  Float_t fTimeRead = 0;
49  ND::THandle<ND::TIntegerDatum> mcmTimeSinceBusy =
50  event.Get<ND::TIntegerDatum>("mcmTimeSinceBusy");
51  if (mcmTimeSinceBusy) {
52  UInt_t dt_bktTrig_mcmTDC =
53  static_cast<UInt_t>(mcmTimeSinceBusy->GetValue());
54  const Long64_t mcmTick(4LL);
55  fTdcRead = mcmTick * dt_bktTrig_mcmTDC;
56  fTimeRead = (fTdcRead % 260) * 2.5;
57  }
58 
59  // ===========================================================================
60  // Get the TFBDigits
61  //
62  ND::THandle<ND::TDataVector> digitV = event.Get<ND::TDataVector>("digits");
63  if (digitV) {
64  ND280Debug("\nFound a vector of digit containers!");
65  fNLowLevelTFBDigits = 0;
66  for (ND::TDataVector::iterator diter = digitV->begin();
67  diter != digitV->end(); diter++) {
68  ND::TDigitContainer* digList = dynamic_cast<ND::TDigitContainer*>(*diter);
69  if (digList) {
70  std::string dt_name = digList->GetName();
71  dt_name += "digits";
72  std::string dt_name_full = (digList->GetFullName()).Data();
73  dt_name_full += "digits";
74 
75  EDigitType digit_type = this->GetDigitType(digList->GetName());
76 
77  /// For now just do for ecal defined digits but could expand this to
78  /// work for
79  /// other sub-systems such as ingrid, smrd etc...
80  if (digit_type == kECalDigits) {
81  ND280Debug("Found an ecal digit container with name = "
82  << dt_name << " and " << digList->size() << " elements");
83  ND::TDigitContainer::iterator digItr;
84  for (digItr = digList->begin(); digItr != digList->end(); ++digItr) {
85  TTFBDigit* digit = dynamic_cast<TTFBDigit*>(*digItr);
86  if (!digit) {
87  continue;
88  }
89  // Now make a new lowleveltfbdigit and add it to the clones array.
91  new ((*fLowLevelTFBDigits)[fNLowLevelTFBDigits++])
93  // Fill in the lowleveldigit fields.
94  TTFBChannelId id(digit->GetChannelId());
95  fTFBDigit->Chan = id.GetChannel() + 16 * id.GetTripChip();
96  fTFBDigit->Tfb = id.GetTFB();
97  fTFBDigit->Rmm = id.GetRMM();
98  fTFBDigit->Subdet = id.GetSubDetector();
99  fTFBDigit->Side = 0;
100  fTFBDigit->Err = 0;
101  fTFBDigit->Err += (digit->CheckTimeDiscriminator() ? 0x1 : 0);
102  fTFBDigit->Tdc =
103  (digit->GetTimeCounter() * 4) + digit->GetTimeQuad();
104  fTFBDigit->Adc_lo = digit->GetLowGainADC();
105  fTFBDigit->Adc_hi = digit->GetHighGainADC();
106  fTFBDigit->TdcTrig = fTdcTrig;
107  fTFBDigit->TdcRead = fTdcRead;
108  } // end of loop over digits in container
109  } // for ecal digits
110  } // if(digList)
111  } // end of loop over digit containers
112  } // end of if(event.Has...
113 
114  // ===========================================================================
115  // Now get the Hits.
116  //
117  ND::THandle<ND::TDataVector> hitV = event.Get<ND::TDataVector>("hits");
118  if (hitV) {
119  ND280Debug("Found a hits container!");
120  fNLowLevelHits = 0;
121  for (ND::TDataVector::iterator hiter = hitV->begin(); hiter != hitV->end();
122  ++hiter) {
123  ND::THitSelection* hitList = dynamic_cast<ND::THitSelection*>(*hiter);
124  if (hitList) {
125  EHitType hit_type = this->GetHitType(hitList->GetName());
126  /// ====================================================================
127  /// For now just do for ecal defined hits but could expand this to work
128  /// for other sub-systems such as ingrid, smrd etc...
129  if (hit_type == kECalHits) {
130  ND::THitSelection::iterator hitItr;
131  for (hitItr = hitList->begin(); hitItr != hitList->end(); ++hitItr) {
132  // Now make a new lowlevelecal hit and add it to the clones array.
134  new ((*fLowLevelHits)[fNLowLevelHits++])
136  // Fill in the lowlevelhit fields.
137  ND::THandle<ND::THit> hit = (*hitItr);
138  fTFBHit->Time = hit->GetTime();
139  fTFBHit->Charge = hit->GetCharge();
140  fTFBHit->GeomId = hit->GetGeomId().AsInt();
141  fTFBHit->PosX = hit->GetPosition().X();
142  fTFBHit->PosY = hit->GetPosition().Y();
143  fTFBHit->PosZ = hit->GetPosition().Z();
144  std::string nodename =
145  ND::TGeomInfo::Get().NodeName(hit->GetGeomId());
146  fTFBHit->XLayer = this->LayerXFromName(nodename);
147  fTFBHit->YLayer = this->LayerYFromName(nodename);
148  fTFBHit->Bar = this->BarFromName(nodename);
149  fTFBHit->End = -1;
150  fTFBHit->TimeRead = fTimeRead;
151  // fTFBHit->Adc.hi = srcdigit->GetHighGainADC();
152  } // end of loop over digits in container
153  } // for ecal digits
154  } // if(digList)
155  } // end of loop over digit containers
156  } // end of if(event.Has...
157 
158  return true;
159 }
160 
162  return true;
163 }
164 
166  std::string match("Bar_");
167  if (name.find(match) == name.npos) return -1;
168  std::string ss = name.substr(name.find(match) + match.size());
169  return atoi(ss.c_str());
170 }
171 
173  std::string match("ScintX1_");
174  if (name.find(match) == name.npos) return -1;
175  std::string ss = name.substr(name.find(match) + match.size());
176  return atoi(ss.c_str());
177 }
178 
180  std::string match("ScintY1_");
181  if (name.find(match) == name.npos) return -1;
182  std::string ss = name.substr(name.find(match) + match.size());
183  return atoi(ss.c_str());
184 }
186  const char* name) {
187  std::string digit_str(name);
188  EDigitType digit_type = kOtherDigits;
189  if (digit_str.compare("ecal") == 0) {
190  digit_type = kECalDigits;
191  } else if (digit_str.compare("p0d") == 0) {
192  digit_type = kP0DDigits;
193  } else if (digit_str.compare("smrd") == 0) {
194  digit_type = kSMRDDigits;
195  } else if (digit_str.compare("ingrid") == 0) {
196  digit_type = kINGRIDDigits;
197  }
198  return digit_type;
199 }
201  const char* name) {
202  std::string hit_str(name);
203  EHitType hit_type = kOtherHits;
204  if (hit_str.find("ecal") != std::string::npos ||
205  hit_str.find("barrel") != std::string::npos) {
206  hit_type = kECalHits;
207  } else if (hit_str.compare("p0d") == 0) {
208  hit_type = kP0DHits;
209  } else if (hit_str.compare("smrd") == 0) {
210  hit_type = kSMRDHits;
211  } else if (hit_str.compare("ingrid") == 0) {
212  hit_type = kINGRIDHits;
213  }
214  return hit_type;
215 }
EDigitType GetDigitType(const char *)
int LayerXFromName(std::string name)
TClonesArray * fLowLevelHits
TClonesArray of TLowLevelTFBDigit objects.
ClassImp(ND::TBeamSummaryDataModule::TBeamSummaryData)
EHitType GetHitType(const char *)
std::string fDescription
A longish descrition of the analysis.
TClonesArray * fLowLevelTFBDigits
TClonesArray of TLowLevelTFBDigit objects.
virtual void InitializeBranches()
Initialize Branches. Don&#39;t do anything else in this function.
virtual bool FillTree(ND::TND280Event &)
Fill all the stuff that goes in the output tree.
void SetNameTitle(char const *name, char const *title)
int LayerYFromName(std::string name)
int BarFromName(std::string name)
virtual Bool_t ProcessFirstEvent(ND::TND280Event &)
Is called after the first event is loaded in.
TLowLevelInfoModule(const char *name="LowLevelInfo", const char *title="Low Level Info Module")
TLowLevelHit An object for storing low level hit information (THits).
TLowLevelTFBDigit An object for storing low level TFB digit information (TTFBDigits) ...

Package Summary
Package Name: eventAnalysis
Package Version: 7.0-49-g0ac7482
Package Manager:

Generated on Mon Mar 25 2024 14:43:59 for eventAnalysis by doxygen 1.8.5