33 includeUnmatchedHits_(include_unmatched_hits) {
38 for(
int i=0;
i<161;
i++)
42 for(
unsigned int ii=0;ii<calibLines_.size();ii++)
45 if(calibLines_[ii][0]==
"TDC")
47 if(calibLines_[ii].
size()==4)
49 int channel=atoi(calibLines_[ii][1].c_str());
50 tdc_ped[channel]=atof(calibLines_[ii][2].c_str());
51 tdc_convers[channel]=atof(calibLines_[ii][3].c_str());
57 "Wrong TDC configuration format : expected 3 parameters, got "<<calibLines_[ii].size()-1;
62 if(calibLines_[ii][0]==
"WC")
64 if(calibLines_[ii].
size()==6)
66 int plane=atoi(calibLines_[ii][1].c_str());
67 wc_[plane].
b0=atof(calibLines_[ii][2].c_str());
68 wc_[plane].
b1=atof(calibLines_[ii][3].c_str());
69 wc_[plane].
mean=atof(calibLines_[ii][4].c_str());
70 wc_[plane].
sigma=atof(calibLines_[ii][5].c_str());
77 "Wrong Wire Chamber configuration format : expected 5 parameters, got "<<calibLines_[ii].size()-1;
87 std::vector<Hit> hits;
116 if (raw.
size()<3*8) {
117 throw cms::Exception(
"Missing Data") <<
"No data in the TDC block";
120 const unsigned int* hitbase=0;
121 unsigned int totalhits=0;
126 hitbase=(
unsigned int*)(qdctdc);
135 hitbase=&(tdc->
hits[0]);
139 for (
unsigned int i=0;
i<totalhits;
i++) {
141 h.
channel=(hitbase[
i]&0x7FC00000)>>22;
149 for (
int i=0;
i<32;
i++) v775[
i]=-1;
152 hitbase=(
unsigned int*)(qdctdc);
156 totalhits=(qdctdc->
n_tdc_hits&0xFFFF0000)>>16;
157 for (
unsigned int i=0;
i<totalhits;
i++) {
160 h.
channel=129+((hitbase[
i]&0x3F0000)>>16);
164 v775[(h.
channel-129)] = (hitbase[
i]&0xFFF);
173 std::vector<Hit>::const_iterator
j;
174 double trigger_time=0;
175 double ttc_l1a_time=0;
176 double laser_flash=0;
183 std::vector<double> m1hits, m2hits, m3hits, s1hits, s2hits, s3hits, s4hits,
184 bh1hits, bh2hits, bh3hits, bh4hits,beam_coinc;
186 for (j=hits.begin(); j!=hits.end(); j++) {
187 switch (j->channel) {
212 timing.
setTimes(trigger_time,ttc_l1a_time,laser_flash,qie_phase,TOF1S_time,TOF1J_time,TOF2S_time,TOF2J_time);
213 timing.
setHits (m1hits,m2hits,m3hits,s1hits,s2hits,s3hits,s4hits,bh1hits,bh2hits,bh3hits,bh4hits,beam_coinc);
273 const int MAX_HITS=100;
274 float hits1[MAX_HITS], hits2[MAX_HITS], hitsA[MAX_HITS];
275 int n1,n2,nA,chan1,chan2,chanA;
277 std::vector<double>
x;
279 for (
int plane=0; plane<
PLANECOUNT; plane++) {
282 std::vector<double> plane_hits;
293 for (std::vector<Hit>::const_iterator
j=hits.begin();
j!=hits.end();
j++) {
294 if (
j->channel==chan1 && n1<MAX_HITS) {
297 if (
j->channel==chan2 && n2<MAX_HITS) {
300 if (
j->channel==chanA && nA<MAX_HITS) {
305 if (n1!=0 && n2!=0 &&
dumpObs!=0) {
306 fprintf(
dumpObs,
"%d,%f,%f,%f,%f\n",plane,hits1[0],hits2[0],hitsA[0],hitsA[1]);
311 for (
int ii=0; ii<n1; ii++) {
312 int jmin=-1, lmin=-1;
314 for (
int jj=0;
jj<n2;
jj++) {
315 for (
int ll=0; ll<nA; ll++) {
316 float dsum=fabs(
wc_[plane].
mean - hits1[ii] - hits2[
jj] + 2.0*hitsA[ll]);
317 if(dsum<(
N_SIGMA*
wc_[plane].sigma) && dsum<dsumMin){
325 hit_time =
wc_[plane].
b0 +
326 wc_[plane].
b1 * (hits1[ii]-hits2[jmin]);
329 plane_hits.push_back(-hit_time);
331 plane_hits.push_back(hit_time);
340 for (
int ii=0; ii<n1; ii++) {
341 if (hits1[ii]<-99990)
continue;
342 for (
int jj=0;
jj<n2;
jj++) {
343 if (hits2[
jj]<-99990)
continue;
344 hit_time =
wc_[plane].
b0 +
345 wc_[plane].
b1 * (hits1[ii]-hits2[
jj]);
348 plane_hits.push_back(-hit_time);
350 plane_hits.push_back(hit_time);
355 if ((plane%2)==0) x=plane_hits;
357 char chamber=
'A'+plane/2;
static const int lcBeamCoincidence
void setChamberHits(char chamberch, const std::vector< double > &xvec, const std::vector< double > &yvec)
void reconstructTiming(const std::vector< Hit > &hits, HcalTBTiming &timing) const
static const int lcBeamHalo4
void unpackHits(const FEDRawData &raw, std::vector< Hit > &hits, HcalTBTiming &timing) const
static const int lcTTCL1ATime
static const int lcScint4
static const int lcScint3
size_t size() const
Lenght of the data buffer in bytes.
static const int lcBeamHalo2
static const int lcLaserFlash
static const int lcScint1
void setCalib(const std::vector< std::vector< std::string > > &calibLines_)
static const int lcBeamHalo1
static const int lcTriggerTime
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static const int lcQIEPhase
bool includeUnmatchedHits_
void unpack(const FEDRawData &raw, HcalTBEventPosition &pos, HcalTBTiming &timing) const
void reconstructWC(const std::vector< Hit > &hits, HcalTBEventPosition &pos) const
static const double N_SIGMA
static const int lcBeamHalo3
void setTimes(const double trigger_time, const double ttc_l1a_time, const double laser_flash, const double qie_phase, const double TOF1S_time, const double TOF1J_time, const double TOF2S_time, const double TOF2J_time)
static const int PLANECOUNT
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static const double TDC_OFFSET_CONSTANT
void setHits(const std::vector< double > &m1hits, const std::vector< double > &m2hits, const std::vector< double > &m3hits, const std::vector< double > &s1hits, const std::vector< double > &s2hits, const std::vector< double > &s3hits, const std::vector< double > &s4hits, const std::vector< double > &bh1hits, const std::vector< double > &bh2hits, const std::vector< double > &bh3hits, const std::vector< double > &bh4hits, const std::vector< double > &beamCoincidenceHits)
static const int WC_CHANNELIDS[PLANECOUNT *3]
tuple size
Write out results.
struct hcaltb::HcalTBTDCUnpacker::WireChamberRecoData wc_[PLANECOUNT]
static const int lcScint2