37 if(
m_done)
return StatusCode::SUCCESS;
41 const EventContext& ctx = Gaudi::Hive::currentContext();
50 outfit->Add(s.c_str());
59 Int_t FT=0, slot=0, channel=0;
62 Float_t ShapeDer[2000];
66 outfit->SetBranchAddress(
"channelId", &channelId);
67 outfit->SetBranchAddress(
"FT", &FT);
68 outfit->SetBranchAddress(
"slot", &slot);
69 outfit->SetBranchAddress(
"channel", &channel);
70 outfit->SetBranchAddress(
"detector", &det);
72 outfit->SetBranchAddress(
"PhaseTime", &phaseTime);
73 outfit->SetBranchAddress(
"Phase", &phase);
74 outfit->SetBranchAddress(
"timeOffset", &timeOffset);
76 outfit->SetBranchAddress(
"nSamples", &nsamples);
77 outfit->SetBranchAddress(
"Gain", &gain);
78 outfit->SetBranchAddress(
"Shape", Shape);
79 outfit->SetBranchAddress(
"ShapeDer", ShapeDer);
81 Float_t timeBinWidth=-1, prevTime=-1, timeOff=-1;
85 std::unique_ptr<LArShapeComplete> larShapeComplete;
86 std::unique_ptr<LArShape32MC> larShapeMC;
89 larShapeComplete = std::make_unique<LArShapeComplete>();
91 ATH_CHECK( larShapeComplete->initialize() );
93 larShapeMC = std::make_unique<LArShape32MC>();
98 std::vector<float> shapemc;
99 std::vector<float> shape_dermc;
100 typedef std::vector<std::vector<float> > wave2d;
101 std::map<std::pair<unsigned int,int>, wave2d> shape;
102 std::map<std::pair<unsigned int,int>, wave2d> shape_der;
105 Long64_t nentries = outfit->GetEntries();
106 for ( Long64_t iev = 0; iev < nentries; ++iev )
108 outfit->GetEvent(iev);
109 ATH_MSG_INFO (
" Chan " << std::hex << channelId <<
" det. "<< det << std::dec );
122 if(FT != onlineHelper->
feedthrough(
id) || slot != onlineHelper->
slot(
id) || channel != onlineHelper->
channel(
id)) {
140 if ( nsamples >= 2000 ) {
141 ATH_MSG_ERROR (
" Too many points specified vs the expected content of the ntuple ! " );
147 if(timeBinWidth < 0) {
152 if(abs(phase-prevPhase) == 1) {
153 timeBinWidth=std::fabs(phaseTime - prevTime);
158 if(timeOff < 0) timeOff=timeOffset;
161 if(shape[std::make_pair(hwid,gain)].
empty()) shape[std::make_pair(hwid,gain)].reserve(50);
162 if(shape_der[std::make_pair(hwid,gain)].
empty()) shape_der[std::make_pair(hwid,gain)].reserve(50);
163 shape[std::make_pair(hwid,gain)][phase].reserve(nsamples);
164 shape_der[std::make_pair(hwid,gain)][phase].reserve(nsamples);
165 for(
int i=0;i<nsamples; ++i) {shape[std::make_pair(hwid,gain)][phase][i]=0.;
166 shape_der[std::make_pair(hwid,gain)][phase][i]=0.;}
168 shapemc.resize(nsamples);
169 shape_dermc.resize(nsamples);
170 for(
int i=0;i<nsamples; ++i) {shapemc[i]=0.; shape_dermc[i]=0.;}
172 unsigned int skipped = 0;
173 unsigned int limit = nsamples;
175 for (
unsigned int i = 0; i < limit; i++ ) {
189 if (
id != mcsym->ZPhiSymOnl(
id) ) {
193 ATH_MSG_INFO(
"Storing shape with length: " << shapemc.size() );
198 larShapeMC->set(
id, gain, shapemc, shape_dermc);
199 ATH_MSG_INFO( larShapeMC->Shape(
id,gain).size() <<
" " << larShapeMC->ShapeDer(
id,gain).size() );
200 ATH_MSG_INFO(
"Shape[2] =" << larShapeMC->Shape(
id,gain)[2] <<
"shapemc[2] =" << shapemc[2] );
207 std::map<std::pair<unsigned int,int>, wave2d>
::iterator ibeg = shape.begin();
208 std::map<std::pair<unsigned int,int>, wave2d>
::iterator iend = shape.end();
209 for(;ibeg != iend; ++ibeg) {
210 larShapeComplete->set(
HWIdentifier((ibeg->first).first),(ibeg->first).second,
211 ibeg->second, shape_der[std::make_pair((ibeg->first).first, (ibeg->first).second)],
212 timeOff,timeBinWidth);
221 return StatusCode::SUCCESS;