CMS 3D CMS Logo

EcalLaser_weekly_Linearization.cc
Go to the documentation of this file.
8 
9 #include<iostream>
10 #include<iomanip>
11 #include <sstream>
12 
14  : m_name(ps.getUntrackedParameter<std::string>("name","EcalLaser_weekly_Handler")) {
15  std::cout << "EcalLaser Source handler constructor\n" << std::endl;
16 }
17 
19  // do nothing
20 }
21 
23  // int file[1] = {190708};
24 
25  int iIov = 0;
26 
27  std::cout << "------- Ecal -> getNewObjects\n";
28 
29 
30  unsigned long long max_since= 1;
32 
33  // here popcon tells us which is the last since of the last object in the offline DB
34  max_since=tagInfo().lastInterval.first;
35  Tm max_since_tm(max_since);
36 
37  // const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap =
38  // payload->getLaserMap();
39  // std::cout << "payload->getLaserMap(): OK " << std::endl;
40  // std::cout << "Its size is " << laserRatiosMap.size() << std::endl;
41  // const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap =
42  // payload->getTimeMap();
43  // std::cout << "payload->getTimeMap(): OK " << std::endl;
44  // std::cout << "Last Object in Offline DB has SINCE = " << max_since
45  // << " -> " << max_since_tm.cmsNanoSeconds()
46  // << " (" << max_since_tm << ")"
47  // << " and SIZE = " << tagInfo().size
48  // << std::endl;
49 
50  for(int week = 0; week < 1; week++) {
51  int fileIOV;
52  std::cout << " which input IOV do you want " << std::endl;
53  std::cin >> fileIOV;
54  std::ifstream fWeek;
55  std::ostringstream oss;
56  oss << fileIOV;
57  std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
58  /*
59  oss << file[week];
60  // std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv5_trans_" + oss.str() + "_";
61  std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_";
62  oss.str("");
63  // if(week == 32) oss << 200000;
64  // else oss << file[week + 1] - 1;
65  oss << 200000;
66  fname += oss.str() + ".txt";
67  */
68  fWeek.open(fname.c_str());
69  if(!fWeek.is_open()) {
70  std::cout << "ERROR : can't open file '" << fname << std::endl;
71  break;
72  }
73  std::cout << " file " << fname << " opened" << std::endl;
74  // int rawId;
75  // float corrp;
77  for(int i = 0; i < 85; i++) getline (fWeek, line);
78  char cryst[10];
79  uint32_t ped[kGains], mult[kGains], shift[kGains];
80  uint32_t id;
81 
83 
84  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
85  getline (fWeek, line);
86  // std::cout << " line " << line << std::endl;
87  // fWeek >> cryst >> id;
88  sscanf(line.c_str(), "%s %u", cryst, &id);
89  // std::cout << cryst << " id " << id << std::endl;
90  // EBDetId ebId = DetId(id);
91  for (int gain = 0; gain < kGains; gain++) {
92  // fWeek >> std::hex >> ped[gain] >> mult[gain] >> shift[gain];
93  getline (fWeek, line);
94  // std::cout << " line g " << line << std::endl;
95  sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
96  // std::cout << " gain " << gain << " ped " << ped[gain] << " mult " << mult[gain] << " shift " << shift[gain]<< std::endl;
97  }
99  item.mult_x1 = mult[2];
100  item.mult_x6 = mult[1];
101  item.mult_x12 = mult[0];
102  item.shift_x1 = shift[2];
103  item.shift_x6 = shift[1];
104  item.shift_x12 = shift[0];
105 
106  linC->insert(std::make_pair(id, item));
107  // corr.p1=corr.p2=corr.p3 = corrp;
108  // corrSet->setValue((int)ebId, corr );
109  // cryst ="";
110  } // end loop over EB channels
111  getline (fWeek, line); // cmment before EE crystals
112  std::cout << " comment line " << line << std::endl;
113  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
114  getline (fWeek, line);
115  // std::cout << " line " << line << std::endl;
116  sscanf(line.c_str(), "%s %u", cryst, &id);
117  // std::cout << cryst << " id " << id << std::endl;
118  // EEDetId eeId = DetId(id);
119  for (int gain =0; gain < kGains; gain++) {
120  getline (fWeek, line);
121  // std::cout << " line g " << line << std::endl;
122  sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
123  // std::cout << " gain " << gain << " ped " << ped[gain] << " mult " << mult[gain] << " shift " << shift[gain]<< std::endl;
124 
125  } // corr.p1=corr.p2=corr.p3 = corrp;
126  // corrSet->setValue((int)eeId, corr );
128  item.mult_x1 = mult[2];
129  item.mult_x6 = mult[1];
130  item.mult_x12 = mult[0];
131  item.shift_x1 = shift[2];
132  item.shift_x6 = shift[1];
133  item.shift_x12 = shift[0];
134 
135  linC->insert(std::make_pair(id, item));
136  } // end loop over EE channels
137  fWeek.close();
138  // special tag for Stephanie
139  // m_to_transfer.push_back(std::make_pair((EcalTPGLinearizationConst*)linC, file[week]));
140  m_to_transfer.push_back(std::make_pair(linC, fileIOV));
141  // end special
142  iIov++;
143  } // end loop over week
144  std::cout << "Ecal -> end of getNewObjects -----------\n";
145 }
cond::ValidityInterval lastInterval
Definition: Types.h:76
void insert(std::pair< uint32_t, Item > const &a)
string fname
main script
static unsigned int const shift
Definition: Tm.h:13
EcalTPGLinearizationConstMap EcalTPGLinearizationConst