Changeset 18482
- Timestamp:
- 04/30/16 18:59:35 (9 years ago)
- Location:
- trunk/Mars/manalysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/manalysis/MSoftwareTriggerCalc.cc
r18480 r18482 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // 27 // MSoftwareTrigger 27 // MSoftwareTriggerCalc 28 28 // 29 29 ////////////////////////////////////////////////////////////////////////////// 30 #include "MSoftwareTrigger .h"30 #include "MSoftwareTriggerCalc.h" 31 31 32 32 #include <algorithm> … … 37 37 #include "MParList.h" 38 38 39 #include "MParameters.h"40 39 #include "MRawEvtData.h" 40 #include "MSoftwareTrigger.h" 41 41 #include "MPedestalSubtractedEvt.h" 42 42 43 ClassImp(MSoftwareTrigger );43 ClassImp(MSoftwareTriggerCalc); 44 44 45 45 using namespace std; … … 49 49 // Default constructor. 50 50 // 51 MSoftwareTrigger ::MSoftwareTrigger(const char *name, const char *title)52 : fRawEvt(0), fSignal(0), fTrigger Signal(0), fTriggerBaseline(0)51 MSoftwareTriggerCalc::MSoftwareTriggerCalc(const char *name, const char *title) 52 : fRawEvt(0), fSignal(0), fTrigger(0) 53 53 { 54 fName = name ? name : "MSoftwareTrigger ";54 fName = name ? name : "MSoftwareTriggerCalc"; 55 55 fTitle = title ? title : "Calculate the FACT trigger in software"; 56 56 } … … 58 58 // -------------------------------------------------------------------------- 59 59 // 60 Int_t MSoftwareTrigger ::PreProcess(MParList *pList)60 Int_t MSoftwareTriggerCalc::PreProcess(MParList *pList) 61 61 { 62 62 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");//, AddSerialNumber(fNamePedestalSubtractedEvt)); … … 74 74 } 75 75 76 fTrigger Signal = (MParameterD*)pList->FindCreateObj("MParameterD","SoftwareTriggerSignal");77 if (!fTrigger Signal)76 fTrigger = (MSoftwareTrigger*)pList->FindCreateObj("MSoftwareTrigger"); 77 if (!fTrigger) 78 78 return kFALSE; 79 79 80 fTriggerBaseline = (MParameterD*)pList->FindCreateObj("MParameterD","SoftwareTriggerBaseline");81 if (!fTriggerBaseline)82 return kFALSE;83 84 *fLog << flush << inf;85 80 return kTRUE; 86 81 } … … 88 83 // -------------------------------------------------------------------------- 89 84 // 90 Bool_t MSoftwareTrigger ::ReInit(MParList *pList)85 Bool_t MSoftwareTriggerCalc::ReInit(MParList *pList) 91 86 { 92 87 // FIXME: Check number of samples! … … 96 91 // -------------------------------------------------------------------------- 97 92 // 98 Int_t MSoftwareTrigger ::Process()93 Int_t MSoftwareTriggerCalc::Process() 99 94 { 100 95 const UShort_t *idx = fRawEvt->GetPixelIds(); … … 154 149 */ 155 150 156 Float_t max = -50000; 151 Float_t max = -50000; 152 UShort_t pos = 0; 153 Short_t patch = -1; 157 154 158 const UInt_t nsum = buf.GetSize(); 159 for (Float_t *sum=buf.GetArray(); sum<buf.GetArray()+nsum; sum+=num) 155 for (int i=0; i<160; i++) 160 156 { 161 157 int idx = 0; 162 158 Float_t v[4] = { 0, 0, 0, 0 }; 163 159 160 Float_t *sum=buf.GetArray() + num*i; 164 161 for (Float_t *ptr=sum+15; ptr<sum+num; ptr++) 165 162 { … … 170 167 171 168 const Float_t min = *std::min_element(v, v+4); 172 if (min>max) 173 max = min; 169 if (min<=max) 170 continue; 171 172 max = min; 173 pos = ptr-sum+beg; 174 patch = i; 174 175 } 175 176 } … … 179 180 avg /= (num-15)*(1440-24); 180 181 181 fTriggerSignal->SetVal(max); 182 fTriggerSignal->SetReadyToSave(); 183 184 fTriggerBaseline->SetVal(avg); 185 fTriggerBaseline->SetReadyToSave(); 182 fTrigger->SetData(patch, avg, pos, max); 183 fTrigger->SetReadyToSave(); 186 184 187 185 return kTRUE; … … 190 188 // -------------------------------------------------------------------------- 191 189 // 192 Int_t MSoftwareTrigger ::ReadEnv(const TEnv &env, TString prefix, Bool_t print)190 Int_t MSoftwareTriggerCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 193 191 { 194 192 return kTRUE; -
trunk/Mars/manalysis/MSoftwareTriggerCalc.h
r18480 r18482 1 #ifndef MARS_MSoftwareTrigger 2 #define MARS_MSoftwareTrigger 1 #ifndef MARS_MSoftwareTriggerCalc 2 #define MARS_MSoftwareTriggerCalc 3 3 4 4 #ifndef MARS_MTask … … 7 7 8 8 class MRawEvtData; 9 class M ParameterD;9 class MSoftwareTrigger; 10 10 class MPedestalSubtractedEvt; 11 11 12 class MSoftwareTrigger : public MTask12 class MSoftwareTriggerCalc : public MTask 13 13 { 14 14 private: 15 15 MRawEvtData *fRawEvt; 16 16 MPedestalSubtractedEvt *fSignal; 17 MParameterD *fTriggerSignal; 18 MParameterD *fTriggerBaseline; 17 MSoftwareTrigger *fTrigger; 19 18 20 19 Int_t PreProcess(MParList *pList); … … 24 23 25 24 public: 26 MSoftwareTrigger (const char *name=NULL, const char *title=NULL);25 MSoftwareTriggerCalc(const char *name=NULL, const char *title=NULL); 27 26 28 27 virtual Bool_t InitArrays(Int_t) { return kTRUE; } 29 28 30 ClassDef(MSoftwareTrigger , 0) // Time And Charge Extractor Base Class29 ClassDef(MSoftwareTriggerCalc, 0) // Time And Charge Extractor Base Class 31 30 }; 32 31
Note:
See TracChangeset
for help on using the changeset viewer.