69 #include "TObjString.h" 83 #include <unordered_map> 105 void algoEndJob ()
override;
108 int statCollectionFromMode(
const char*
tag)
const;
109 void bookDQMHistos(
const char* dqm_dir,
const char* tag);
112 void swapBFieldMode(
void);
115 void algoAnalyzeTheTree();
116 void algoComputeMPVandGain();
119 void getPeakOfLandau(TH1* InputHisto,
double* FitResults,
double LowRange=50,
double HighRange=5400);
120 bool IsGoodLandauFit(
double* FitResults);
122 void qualityMonitor();
123 void MakeCalibrationMap();
124 bool produceTagFilter();
179 std::array< std::vector<APVGain::APVmon>,7 >
Charge_1;
180 std::array< std::vector<APVGain::APVmon>,7 >
Charge_2;
181 std::array< std::vector<APVGain::APVmon>,7 >
Charge_3;
182 std::array< std::vector<APVGain::APVmon>,7 >
Charge_4;
267 unsigned int eventnumber =0;
309 std::unordered_map<unsigned int, stAPVGain*>
APVsColl;
316 std::vector<string>::const_iterator it=dqm_tag_.begin();
317 while(it!=dqm_tag_.end()) {
318 if(*it==
std::string(tag))
return it-dqm_tag_.begin();
328 if(A->GetNbinsX() == B->GetNbinsX()){
331 for(
int x=0;x<=B->GetNbinsX()+1; x++){
332 for(
int y=0;y<=B->GetNbinsY()+1; y++){
333 A->SetBinContent(x,y,A->GetBinContent(x,y)+B->GetBinContent(x,y));
437 EventPrefix_ = evtinfo_pset.getUntrackedParameter<
string>(
"prefix");
438 EventSuffix_ = evtinfo_pset.getUntrackedParameter<
string>(
"suffix");
443 TrackPrefix_ = track_pset.getUntrackedParameter<
string>(
"prefix");
444 TrackSuffix_ = track_pset.getUntrackedParameter<
string>(
"suffix");
459 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Setting " << dqm_dir <<
"in DQM and booking histograms for tag " 464 dbe->setCurrentFolder(dqm_dir);
468 if(!stag.empty() && stag[0]!=
'_') stag.insert(0,1,
'_');
491 std::vector<float> binXarray;
494 binXarray.push_back( (
float)
a );
497 std::array<float,688> binYarray;
499 double p1 = 0.002113;
500 double p2 = 69.01576;
502 for(
int b=0;
b<687;
b++) {
504 if(y<=902.) y = y + 2.;
505 else y = ( p0 -
log(
exp(p0-p1*y) - p2*p1)) / p1;
507 binYarray[687] = 4000.;
522 for (
unsigned int i=0;
i<hnames.size();
i++){
532 for (
unsigned int i=0;
i<hnames.size();
i++){
542 for (
unsigned int i=0;
i<hnames.size();
i++){
552 for (
unsigned int i=0;
i<hnames.size();
i++){
567 MPV_Vs_EtaTIB =
dbe->book2DD(
"MPV_vs_EtaTIB" ,
"MPV vs Eta TIB" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
568 MPV_Vs_EtaTID =
dbe->book2DD(
"MPV_vs_EtaTID" ,
"MPV vs Eta TID" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
569 MPV_Vs_EtaTOB =
dbe->book2DD(
"MPV_vs_EtaTOB" ,
"MPV vs Eta TOB" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
570 MPV_Vs_EtaTEC =
dbe->book2DD(
"MPV_vs_EtaTEC" ,
"MPV vs Eta TEC" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
571 MPV_Vs_EtaTECthin =
dbe->book2DD(
"MPV_vs_EtaTEC1",
"MPV vs Eta TEC-thin" , 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
572 MPV_Vs_EtaTECthick =
dbe->book2DD(
"MPV_vs_EtaTEC2",
"MPV vs Eta TEC-thick", 50, -3.0, 3.0, MPVbin, MPVmin, MPVmax);
574 MPV_Vs_PhiTIB =
dbe->book2DD(
"MPV_vs_PhiTIB" ,
"MPV vs Phi TIB" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
575 MPV_Vs_PhiTID =
dbe->book2DD(
"MPV_vs_PhiTID" ,
"MPV vs Phi TID" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
576 MPV_Vs_PhiTOB =
dbe->book2DD(
"MPV_vs_PhiTOB" ,
"MPV vs Phi TOB" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
577 MPV_Vs_PhiTEC =
dbe->book2DD(
"MPV_vs_PhiTEC" ,
"MPV vs Phi TEC" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
578 MPV_Vs_PhiTECthin =
dbe->book2DD(
"MPV_vs_PhiTEC1",
"MPV vs Phi TEC-thin" , 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
579 MPV_Vs_PhiTECthick =
dbe->book2DD(
"MPV_vs_PhiTEC2",
"MPV vs Phi TEC-thick", 50, -3.4, 3.4, MPVbin, MPVmin, MPVmax);
581 NoMPVfit =
dbe->book2DD(
"NoMPVfit" ,
"Modules with bad Landau Fit",350, -350, 350, 240, 0, 120);
582 NoMPVmasked =
dbe->book2DD(
"NoMPVmasked" ,
"Masked Modules" ,350, -350, 350, 240, 0, 120);
584 Gains =
dbe->book1DD(
"Gains" ,
"Gains" , 300, 0, 2);
585 MPVs =
dbe->book1DD(
"MPVs" ,
"MPVs" , MPVbin, MPVmin, MPVmax);
586 MPVs320 =
dbe->book1DD(
"MPV_320" ,
"MPV 320 thickness" , MPVbin, MPVmin, MPVmax);
587 MPVs500 =
dbe->book1DD(
"MPV_500" ,
"MPV 500 thickness" , MPVbin, MPVmin, MPVmax);
588 MPVsTIB =
dbe->book1DD(
"MPV_TIB" ,
"MPV TIB" , MPVbin, MPVmin, MPVmax);
589 MPVsTID =
dbe->book1DD(
"MPV_TID" ,
"MPV TID" , MPVbin, MPVmin, MPVmax);
590 MPVsTIDP =
dbe->book1DD(
"MPV_TIDP" ,
"MPV TIDP" , MPVbin, MPVmin, MPVmax);
591 MPVsTIDM =
dbe->book1DD(
"MPV_TIDM" ,
"MPV TIDM" , MPVbin, MPVmin, MPVmax);
592 MPVsTOB =
dbe->book1DD(
"MPV_TOB" ,
"MPV TOB" , MPVbin, MPVmin, MPVmax);
593 MPVsTEC =
dbe->book1DD(
"MPV_TEC" ,
"MPV TEC" , MPVbin, MPVmin, MPVmax);
594 MPVsTECP =
dbe->book1DD(
"MPV_TECP" ,
"MPV TECP" , MPVbin, MPVmin, MPVmax);
595 MPVsTECM =
dbe->book1DD(
"MPV_TECM" ,
"MPV TECM" , MPVbin, MPVmin, MPVmax);
596 MPVsTECthin =
dbe->book1DD(
"MPV_TEC1" ,
"MPV TEC1" , MPVbin, MPVmin, MPVmax);
597 MPVsTECthick =
dbe->book1DD(
"MPV_TEC2" ,
"MPV TEC2" , MPVbin, MPVmin, MPVmax);
598 MPVsTECP1 =
dbe->book1DD(
"MPV_TECP1" ,
"MPV TECP1" , MPVbin, MPVmin, MPVmax);
599 MPVsTECP2 =
dbe->book1DD(
"MPV_TECP2" ,
"MPV TECP2" , MPVbin, MPVmin, MPVmax);
600 MPVsTECM1 =
dbe->book1DD(
"MPV_TECM1" ,
"MPV TECM1" , MPVbin, MPVmin, MPVmax);
601 MPVsTECM2 =
dbe->book1DD(
"MPV_TECM2" ,
"MPV TECM2" , MPVbin, MPVmin, MPVmax);
603 MPVError =
dbe->book1DD(
"MPVError" ,
"MPV Error" , 150, 0, 150);
604 MPVErrorVsMPV =
dbe->book2DD(
"MPVErrorVsMPV" ,
"MPV Error vs MPV" ,300, 0, 600, 150, 0, 150);
605 MPVErrorVsEta =
dbe->book2DD(
"MPVErrorVsEta" ,
"MPV Error vs Eta" , 50, -3.0, 3.0, 150, 0, 150);
606 MPVErrorVsPhi =
dbe->book2DD(
"MPVErrorVsPhi" ,
"MPV Error vs Phi" , 50, -3.4, 3.4, 150, 0, 150);
607 MPVErrorVsN =
dbe->book2DD(
"MPVErrorVsN" ,
"MPV Error vs N" ,500, 0,1000, 150, 0, 150);
614 GainVsPrevGainTIB =
dbe->book2DD(
"GainVsPrevGainTIB" ,
"Gain vs PrevGain TIB" , 100, 0,2, 100, 0,2);
615 GainVsPrevGainTID =
dbe->book2DD(
"GainVsPrevGainTID" ,
"Gain vs PrevGain TID" , 100, 0,2, 100, 0,2);
616 GainVsPrevGainTOB =
dbe->book2DD(
"GainVsPrevGainTOB" ,
"Gain vs PrevGain TOB" , 100, 0,2, 100, 0,2);
617 GainVsPrevGainTEC =
dbe->book2DD(
"GainVsPrevGainTEC" ,
"Gain vs PrevGain TEC" , 100, 0,2, 100, 0,2);
620 for (
unsigned int i=0;
i<hnames.size();
i++){
638 const char * dqm_dir =
"AlCaReco/SiStripGainsHarvesting/";
645 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " 655 tTopo_ = TopoHandle.product();
659 auto const &
Det = tkGeom->
dets();
664 unsigned int Index=0;
665 for(
unsigned int i=0;
i<
Det.size();
i++){
673 if(!DetUnit)
continue;
676 unsigned int NAPV = Topo.
nstrips()/128;
678 for(
unsigned int j=0;j<NAPV;j++){
694 APV->
x = DetUnit->position().basicVector().x();
695 APV->
y = DetUnit->position().basicVector().y();
696 APV->
z = DetUnit->position().basicVector().z();
697 APV->
Eta = DetUnit->position().basicVector().eta();
698 APV->
Phi = DetUnit->position().basicVector().phi();
699 APV->
R = DetUnit->position().basicVector().transverse();
700 APV->
Thickness = DetUnit->surface().bounds().thickness();
712 for(
unsigned int i=0;
i<
Det.size();
i++){
717 if(!DetUnit)
continue;
720 unsigned int NROCRow = Topo.
nrows()/(80.);
721 unsigned int NROCCol = Topo.
ncolumns()/(52.);
723 for(
unsigned int j=0;j<NROCRow;j++){
724 for(
unsigned int i=0;
i<NROCCol;
i++){
740 APV->
x = DetUnit->position().basicVector().x();
741 APV->
y = DetUnit->position().basicVector().y();
742 APV->
z = DetUnit->position().basicVector().z();
743 APV->
Eta = DetUnit->position().basicVector().eta();
744 APV->
Phi = DetUnit->position().basicVector().phi();
745 APV->
R = DetUnit->position().basicVector().transverse();
746 APV->
Thickness = DetUnit->surface().bounds().thickness();
780 return ( (isOn && !is0T) || (!isOn && is0T) );
798 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Switching calibration mode for endorsing BField status: " 827 edm::LogWarning(
"SiStripGainFromCalibTree")<<
"WARNING: TickMarkGain in the global tag changed\n"<< std::endl
828 <<
" APV->SubDet: "<< APV->
SubDet <<
" APV->APVId:" << APV->
APVId << std::endl
829 <<
" APV->PreviousGainTick: "<<APV->
PreviousGainTick<<
" newPreviousGainTick: "<<newPreviousGainTick<<std::endl;
847 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Starting harvesting statistics" << std::endl;
855 if(!stag.empty() && stag[0]!=
'_') stag.insert(0,1,
'_');
889 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvi.c_str()
890 <<
", statistics will not be summed!" << std::endl;
893 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Harvesting " 894 << (
Charge_Vs_Index[elepos])->getTH2S()->GetEntries() <<
" more clusters" << std::endl;
903 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIB.c_str()
904 <<
", statistics will not be summed!" << std::endl;
908 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTOB.c_str()
909 <<
", statistics will not be summed!" << std::endl;
913 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIDP.c_str()
914 <<
", statistics will not be summed!" << std::endl;
918 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTIDM.c_str()
919 <<
", statistics will not be summed!" << std::endl;
923 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECP1.c_str()
924 <<
", statistics will not be summed!" << std::endl;
928 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECP2.c_str()
929 <<
", statistics will not be summed!" << std::endl;
933 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECM1.c_str()
934 <<
", statistics will not be summed!" << std::endl;
938 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << cvpTECM2.c_str()
939 <<
", statistics will not be summed!" << std::endl;
945 for (
unsigned int i=0;
i<tags.size();
i++){
949 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
950 <<
", statistics will not be summed!" << std::endl;
951 }
else (
Charge_1[Harvest][i]).getMonitor()->getTH1D()->Add((
Charge_1[elepos][i]).getMonitor()->getTH1D());
955 for (
unsigned int i=0;
i<tags.size();
i++){
959 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
960 <<
", statistics will not be summed!" << std::endl;
961 }
else (
Charge_2[Harvest][i]).getMonitor()->getTH1D()->Add((
Charge_2[elepos][i]).getMonitor()->getTH1D());
966 for (
unsigned int i=0;
i<tags.size();
i++){
970 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
971 <<
", statistics will not be summed!" << std::endl;
972 }
else (
Charge_3[Harvest][i]).getMonitor()->getTH1D()->Add((
Charge_3[elepos][i]).getMonitor()->getTH1D());
977 for (
unsigned int i=0;
i<tags.size();
i++){
981 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not retrieve " << tag.c_str()
982 <<
", statistics will not be summed!" << std::endl;
983 }
else (
Charge_4[Harvest][i]).getMonitor()->getTH1D()->Add((
Charge_4[elepos][i]).getMonitor()->getTH1D());
995 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Analyzing calibration tree" << std::endl;
1014 edm::LogInfo(
"SiStripGainFromCalibTree") <<
"Saving summary into root file" << std::endl;
1040 FitResults[0] = -0.5;
1042 FitResults[2] = -0.5;
1044 FitResults[4] = -0.5;
1050 TF1* MyLandau =
new TF1(
"MyLandau",
"landau",LowRange, HighRange);
1051 MyLandau->SetParameter(1,300);
1052 InputHisto->Fit(MyLandau,
"0QR WW");
1055 FitResults[0] = MyLandau->GetParameter(1);
1056 FitResults[1] = MyLandau->GetParError(1);
1057 FitResults[2] = MyLandau->GetParameter(2);
1058 FitResults[3] = MyLandau->GetParError(2);
1059 FitResults[4] = MyLandau->GetChisquare() / MyLandau->GetNDF();
1060 FitResults[5] = MyLandau->GetParameter(0);
1066 if(FitResults[0] <= 0 )
return false;
1082 NTrack+=(*trackp).size();
1086 unsigned int FirstAmplitude=0;
1087 for(
unsigned int i=0;
i<(*chargeoverpath).size();
i++){
1088 FirstAmplitude+=(*nstrips)[
i];
1089 int TI = (*trackindex)[
i];
1123 bool Saturation =
false;
1124 for(
unsigned int s=0;
s<(*nstrips)[
i];
s++){
1125 int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[
i]+
s];
1129 if(StripCharge>1024){
1132 }
else if(StripCharge>254){
1136 Charge += StripCharge;
1140 Charge = (*charge)[
i];
1142 Charge = (*charge)[
i]/265.0;
1147 double ClusterChargeOverPath = ( (double) Charge )/(*path)[
i] ;
1149 if(
Validation) {ClusterChargeOverPath/=(*gainused)[
i];}
1154 if(APV->
SubDet<=2)
continue;
1165 for(
unsigned int s=0;
s<(*nstrips)[
i];
s++){
1166 int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[
i]+
s];
1167 if(StripCharge>1024) StripCharge = 255;
1168 else if(StripCharge>254) StripCharge = 254;
1169 mCharge1 += StripCharge;
1170 mCharge2 += StripCharge;
1171 mCharge3 += StripCharge;
1172 mCharge4 += StripCharge;
1175 mCharge2 *= (*gainused)[
i];
1176 mCharge3 *= (*gainusedTick)[
i];
1177 mCharge4 *= ( (*gainused)[
i] * (*gainusedTick)[
i]);
1179 std::vector<APVGain::APVmon>& v1 =
Charge_1[elepos];
1181 for(
unsigned int m=0;
m<cmon1.size();
m++) cmon1[
m]->
Fill(( (
double) mCharge1 )/(*path)[
i]);
1183 std::vector<APVGain::APVmon>& v2 =
Charge_2[elepos];
1185 for(
unsigned int m=0;
m<cmon2.size();
m++) cmon2[
m]->
Fill(( (
double) mCharge2 )/(*path)[
i]);
1187 std::vector<APVGain::APVmon>& v3 =
Charge_3[elepos];
1189 for(
unsigned int m=0;
m<cmon3.size();
m++) cmon3[
m]->
Fill(( (
double) mCharge3 )/(*path)[
i]);
1191 std::vector<APVGain::APVmon>& v4 =
Charge_4[elepos];
1193 for(
unsigned int m=0;
m<cmon4.size();
m++) cmon4[
m]->
Fill(( (
double) mCharge4 )/(*path)[
i]);
1212 }
else if(APV->
Eta>0){
1226 TString tree_path = TString::Format(
"gainCalibrationTree%s/tree",
m_calibrationMode.c_str());
1227 TTree*
tree =
dynamic_cast<TTree*
> (tfile->Get(tree_path.Data()));
1259 unsigned int nentries = tree->GetEntries();
1260 printf(
"Number of Events = %i + %i = %i\n",
NEvent,nentries,(
NEvent+nentries));
1261 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1262 printf(
"Looping on the Tree :");
1263 int TreeStep = nentries/50;
if(TreeStep<=1)TreeStep=1;
1264 for (
unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
1265 if(ientry%TreeStep==0){printf(
".");fflush(
stdout);}
1266 tree->GetEntry(ientry);
1276 TH1F* Proj =
nullptr;
1277 double FitResults[6];
1278 double MPVmean = 300;
1283 edm::LogError(
"SiStripGainFromCalibTree") <<
"Harvesting: could not execute algoComputeMPVandGain method because " 1285 <<
"Please check if input contains " 1293 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
1294 printf(
"Fitting Charge Distribution :");
1297 if(I%TreeStep==0){printf(
".");fflush(
stdout);}
1299 if(APV->
Bin<0) APV->
Bin = chvsidx->GetXaxis()->FindBin(APV->
Index);
1303 Proj = (TH1F*)(chvsidx->ProjectionY(
"",chvsidx->GetXaxis()->FindBin(APV->
Index),chvsidx->GetXaxis()->FindBin(APV->
Index),
"e"));
1308 int SecondAPVId = APV->
APVId;
1309 if(SecondAPVId%2==0){ SecondAPVId = SecondAPVId+1; }
else{ SecondAPVId = SecondAPVId-1; }
1311 if(APV2->
Bin<0) APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1312 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"",APV2->
Bin,APV2->
Bin,
"e"));
1313 if(Proj2){Proj->Add(Proj2,1);
delete Proj2;}
1315 for(
unsigned int i=0;
i<16;
i++){
1320 if(APV2->
Bin<0) APV2->
Bin = chvsidx->GetXaxis()->FindBin(APV2->
Index);
1321 TH1F* Proj2 = (TH1F*)(chvsidx->ProjectionY(
"",APV2->
Bin,APV2->
Bin,
"e"));
1322 if(Proj2){Proj->Add(Proj2,1);
delete Proj2;}
1330 APV->
FitMPV = FitResults[0];
1336 APV->
NEntries = Proj->GetEntries();
1358 if(APV==
nullptr)
continue;
1360 unsigned int Index = APV->
Index;
1368 double FitMPV = APV->
FitMPV;
1374 if (SubDet<3)
continue;
1379 int bin = chvsidx->GetXaxis()->FindBin(Index);
1380 TH1D* Proj = chvsidx->ProjectionY(
"proj",bin,bin);
1381 for (
int binId=0; binId<Proj->GetXaxis()->GetNbins();binId++) {
1382 double new_charge = Proj->GetXaxis()->GetBinCenter(binId) /
Gain;
1383 if (Proj->GetBinContent(binId)!=0.) {
1384 for (
unsigned int h=0;
h<charge_histos.size();
h++) {
1385 TH1D* chisto = (charge_histos[
h])->getTH1D();
1386 for (
int e=0;
e<Proj->GetBinContent(binId);
e++) chisto->Fill(new_charge);
1415 }
else if(SubDet==4) {
1422 }
else if (SubDet==5) {
1427 }
else if (SubDet==6) {
1433 if(Thickness<0.04) {
1440 if(Thickness>0.04) {
1464 unsigned int tree_Index;
1465 unsigned int tree_Bin;
1466 unsigned int tree_DetId;
1467 unsigned char tree_APVId;
1468 unsigned char tree_SubDet;
1475 float tree_Thickness;
1477 float tree_FitMPVErr;
1478 float tree_FitWidth;
1479 float tree_FitWidthErr;
1480 float tree_FitChi2NDF;
1483 double tree_PrevGain;
1484 double tree_PrevGainTick;
1485 double tree_NEntries;
1489 MyTree = tfs->
make<TTree> (
"APVGain",
"APVGain");
1490 MyTree->Branch(
"Index" ,&tree_Index ,
"Index/i");
1491 MyTree->Branch(
"Bin" ,&tree_Bin ,
"Bin/i");
1492 MyTree->Branch(
"DetId" ,&tree_DetId ,
"DetId/i");
1493 MyTree->Branch(
"APVId" ,&tree_APVId ,
"APVId/b");
1494 MyTree->Branch(
"SubDet" ,&tree_SubDet ,
"SubDet/b");
1495 MyTree->Branch(
"x" ,&tree_x ,
"x/F");
1496 MyTree->Branch(
"y" ,&tree_y ,
"y/F");
1497 MyTree->Branch(
"z" ,&tree_z ,
"z/F");
1498 MyTree->Branch(
"Eta" ,&tree_Eta ,
"Eta/F");
1499 MyTree->Branch(
"R" ,&tree_R ,
"R/F");
1500 MyTree->Branch(
"Phi" ,&tree_Phi ,
"Phi/F");
1501 MyTree->Branch(
"Thickness" ,&tree_Thickness ,
"Thickness/F");
1502 MyTree->Branch(
"FitMPV" ,&tree_FitMPV ,
"FitMPV/F");
1503 MyTree->Branch(
"FitMPVErr" ,&tree_FitMPVErr ,
"FitMPVErr/F");
1504 MyTree->Branch(
"FitWidth" ,&tree_FitWidth ,
"FitWidth/F");
1505 MyTree->Branch(
"FitWidthErr" ,&tree_FitWidthErr,
"FitWidthErr/F");
1506 MyTree->Branch(
"FitChi2NDF" ,&tree_FitChi2NDF ,
"FitChi2NDF/F");
1507 MyTree->Branch(
"FitNorm" ,&tree_FitNorm ,
"FitNorm/F");
1508 MyTree->Branch(
"Gain" ,&tree_Gain ,
"Gain/D");
1509 MyTree->Branch(
"PrevGain" ,&tree_PrevGain ,
"PrevGain/D");
1510 MyTree->Branch(
"PrevGainTick" ,&tree_PrevGainTick,
"PrevGainTick/D");
1511 MyTree->Branch(
"NEntries" ,&tree_NEntries ,
"NEntries/D");
1512 MyTree->Branch(
"isMasked" ,&tree_isMasked ,
"isMasked/O");
1516 fprintf(Gains,
"NEvents = %i\n",
NEvent);
1517 fprintf(Gains,
"NTracks = %i\n",
NTrack);
1521 fprintf(Gains,
"Number of Strip APVs = %lu\n",static_cast<unsigned long>(
NStripAPVs));
1525 fprintf(Gains,
"NEvents = %i\n",
NEvent);
1526 fprintf(Gains,
"NTracks = %i\n",
NTrack);
1529 fprintf(Gains,
"Number of Strip APVs = %lu\n",static_cast<unsigned long>(
NStripAPVs));
1537 if(APV==
nullptr)
continue;
1541 tree_Index = APV->
Index;
1543 tree_DetId = APV->
DetId;
1544 tree_APVId = APV->
APVId;
1545 tree_SubDet = APV->
SubDet;
1549 tree_Eta = APV->
Eta;
1551 tree_Phi = APV->
Phi;
1553 tree_FitMPV = APV->
FitMPV;
1557 tree_FitChi2NDF = APV->
FitChi2;
1559 tree_Gain = APV->
Gain;
1566 if(tree_DetId==402673324){
1567 printf(
"%i | %i : %f --> %f (%f)\n", tree_DetId, tree_APVId, tree_PrevGain, tree_Gain, tree_NEntries);
1573 if(Gains)fclose(Gains);
1584 edm::LogError(
"SiStripGainFromCalibTree") <<
"produceTagFilter -> Return false: could not retrieve the " 1586 <<
"Please check if input contains " 1596 <<
"produceTagFilter -> Return false: Statistics is too low : " << integral << endl;
1602 <<
"produceTagFilter -> Return false: ratio of GOOD/TOTAL is too low: " << (1.0 *
GOOD) / (
GOOD+
BAD) << endl;
1614 edm::LogWarning(
"SiStripGainFromCalibTree")<<
"getNewObject -> will not produce a paylaod because produceTagFilter returned false " << endl;
1620 std::vector<float>* theSiStripVector =
nullptr;
1621 unsigned int PreviousDetId = 0;
1624 if(APV==
nullptr){ printf(
"Bug\n");
continue; }
1625 if(APV->
SubDet<=2)
continue;
1626 if(APV->
DetId != PreviousDetId){
1627 if(theSiStripVector!=
nullptr){
1629 if ( !obj->
put(PreviousDetId,range) ) printf(
"Bug to put detId = %i\n",PreviousDetId);
1631 theSiStripVector =
new std::vector<float>;
1632 PreviousDetId = APV->
DetId;
1634 theSiStripVector->push_back(APV->
Gain);
1636 if(theSiStripVector!=
nullptr){
1638 if ( !obj->
put(PreviousDetId,range) ) printf(
"Bug to put detId = %i\n",PreviousDetId);
1641 if (theSiStripVector!=
nullptr)
delete theSiStripVector;
1652 if(APV!=
nullptr)
delete APV;
1661 TChain* t1 =
new TChain(
"SiStripCalib/APVGain");
1664 unsigned int tree_DetId;
1665 unsigned char tree_APVId;
1668 t1->SetBranchAddress(
"DetId" ,&tree_DetId );
1669 t1->SetBranchAddress(
"APVId" ,&tree_APVId );
1670 t1->SetBranchAddress(
"Gain" ,&tree_Gain );
1672 for (
unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) {
1673 t1->GetEntry(ientry);
MonitorElement * MPVError
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
edm::EDGetTokenT< std::vector< int > > trackindex_token_
std::vector< MonitorElement * > Charge_Vs_Index
T getParameter(std::string const &) const
EventNumber_t event() const
void swapBFieldMode(void)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< string > dqm_tag_
MonitorElement * MPVsTECP2
virtual int nrows() const =0
const std::vector< float > * trackp
unsigned int MinTrackHits
edm::EDGetTokenT< std::vector< double > > tracketa_token_
edm::EDGetTokenT< std::vector< unsigned char > > amplitude_token_
std::vector< APVGain::APVmon > newCharge
const std::vector< double > * chargeoverpath
MonitorElement * DiffWRTPrevGainTEC
edm::EDGetTokenT< std::vector< unsigned int > > rawid_token_
const std::vector< unsigned char > * amplitude
bool isBFieldConsistentWithMode(const edm::EventSetup &iSetup) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
~SiStripGainFromCalibTree() override
MonitorElement * MPV_Vs_PhiTEC
SiStripApvGain * getNewObject() override
MonitorElement * MPVsTIDP
const std::vector< double > * localdirz
size_t getNumberOfTags() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * MPVErrorVsN
const std::vector< double > * trackchi2ndof
void algoBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
const std::vector< double > * localdirx
const std::vector< double > * gainusedTick
MonitorElement * MPV_Vs_PhiTID
dispatcher processEvent(e, inputTag, standby)
#define DEFINE_FWK_MODULE(type)
unsigned int NClusterPixel
void algoEndRun(const edm::Run &run, const edm::EventSetup &iSetup) override
MonitorElement * MPV_Vs_EtaTOB
const std::vector< unsigned int > * rawid
MonitorElement * MPV_Vs_PhiTIB
edm::EDGetTokenT< std::vector< bool > > overlapping_token_
double tagCondition_GoodFrac
SiStripGainFromCalibTree(const edm::ParameterSet &)
const TrackerTopology * tTopo_
edm::Handle< T > connect(const T *&ptr, edm::EDGetTokenT< T > token, const edm::Event &evt)
MonitorElement * MPVErrorVsPhi
int subdetectorPlane(uint32_t, const TrackerTopology *)
const std::vector< int > * trackalgo
std::vector< MonitorElement * > Charge_Vs_PathlengthTOB
MonitorElement * MPV_Vs_EtaTIB
void storeOnTree(TFileService *tfs)
T * make(const Args &...args) const
make new ROOT object
const std::vector< float > * trackpt
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM1
const std::vector< unsigned int > * trackhitsvalid
MonitorElement * MPVsTECP
MonitorElement * MPVsTECM
void MakeCalibrationMap()
MonitorElement * MPVsTECM2
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM2
MonitorElement * MPV_Vs_EtaTECthick
double MaxTrackChiOverNdf
static float getApvGain(const uint16_t &apv, const SiStripApvGain::Range &range)
MonitorElement * GainVsPrevGainTIB
edm::EDGetTokenT< std::vector< bool > > farfromedge_token_
bool put(const uint32_t &detID, Range input)
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< std::vector< unsigned int > > trackhitsvalid_token_
std::string m_calibrationMode
std::vector< MonitorElement * > FetchMonitor(std::vector< APVmon >, uint32_t, const TrackerTopology *topo=0)
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
std::vector< stAPVGain * > APVsCollOrdered
edm::EDGetTokenT< std::vector< double > > path_token_
void algoComputeMPVandGain()
edm::EDGetTokenT< std::vector< int > > trackalgo_token_
MonitorElement * GainVsPrevGainTEC
MonitorElement * MPVErrorVsEta
edm::EDGetTokenT< std::vector< float > > trackp_token_
bool IsGoodLandauFit(double *FitResults)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::unordered_map< unsigned int, stAPVGain * > APVsColl
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool doChargeMonitorPerPlane
std::array< std::vector< APVGain::APVmon >, 7 > Charge_3
void algoBeginJob(const edm::EventSetup &iSetup) override
std::pair< ContainerIterator, ContainerIterator > Range
edm::EDGetTokenT< std::vector< bool > > TrigTech_token_
edm::EDGetTokenT< std::vector< double > > chargeoverpath_token_
const std::complex< double > I
edm::EDGetTokenT< std::vector< double > > gainusedTick_token_
const std::vector< double > * gainused
MonitorElement * MPV_Vs_EtaTID
MonitorElement * GainVsPrevGainTOB
MonitorElement * MPVsTECthick
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP1
edm::EDGetTokenT< std::vector< double > > localdirz_token_
static const std::string B
const std::vector< unsigned short > * firststrip
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDM
const std::vector< double > * localdiry
std::array< std::vector< APVGain::APVmon >, 7 > Charge_2
edm::EDGetTokenT< std::vector< unsigned int > > charge_token_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MonitorElement * MPV_Vs_PhiTECthick
MonitorElement * NoMPVmasked
MonitorElement * GainVsPrevGainTID
MonitorElement * MPV_Vs_PhiTOB
Integral< F, X >::type integral(const F &f)
def elem(elemtype, innerHTML='', html_class='', kwargs)
MonitorElement * DiffWRTPrevGainTIB
bin
set the eta bin as selection string.
vector< string > VInputFiles
void algoEndJob() override
edm::EDGetTokenT< std::vector< unsigned short > > nstrips_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP2
std::string m_calibrationPath
const std::vector< int > * trackindex
int statCollectionFromMode(const char *tag) const
MonitorElement * MPVsTECthin
std::vector< MonitorElement * > Charge_Vs_PathlengthTIB
edm::EDGetTokenT< std::vector< unsigned short > > firststrip_token_
void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< std::vector< float > > trackpt_token_
MonitorElement * DiffWRTPrevGainTOB
T const * product() const
const std::vector< bool > * overlapping
const std::vector< bool > * saturation
MonitorElement * MPVsTECP1
MonitorElement * MPV_Vs_EtaTECthin
virtual int nstrips() const =0
bool merge(LuminosityBlockRange &lh, LuminosityBlockRange &rh)
void getPeakOfLandau(TH1 *InputHisto, double *FitResults, double LowRange=50, double HighRange=5400)
int subdetectorSide(uint32_t, const TrackerTopology *)
void algoAnalyzeTheTree()
MonitorElement * MPVsTECM1
const std::vector< bool > * farfromedge
MonitorElement * MPV_Vs_PhiTECthin
MonitorElement * MPV_Vs_EtaTEC
const std::vector< bool > * TrigTech
void setDoStore(const bool doStore)
When set to false the payload will not be written to the db.
MonitorElement * NoMPVfit
virtual int ncolumns() const =0
MonitorElement * MPVErrorVsMPV
std::vector< std::string > VChargeHisto
double tagCondition_NClusters
edm::EDGetTokenT< std::vector< double > > localdirx_token_
edm::EDGetTokenT< std::vector< bool > > saturation_token_
edm::EDGetTokenT< std::vector< double > > trackchi2ndof_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDP
edm::EDGetTokenT< std::vector< double > > localdiry_token_
const std::vector< unsigned int > * charge
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
const std::vector< double > * path
const std::vector< double > * trackphi
std::array< std::vector< APVGain::APVmon >, 7 > Charge_4
const std::vector< unsigned short > * nstrips
T const * product() const
edm::EDGetTokenT< std::vector< double > > gainused_token_
int subdetectorId(uint32_t)
MonitorElement * DiffWRTPrevGainTID
void bookDQMHistos(const char *dqm_dir, const char *tag)
edm::EDGetTokenT< std::vector< double > > trackphi_token_
const std::vector< double > * tracketa
MonitorElement * MPVsTIDM
unsigned int NClusterStrip
void merge(TH2 *A, TH2 *B)
const SiStripApvGain::Range getRange(uint32_t detID) const
std::array< std::vector< APVGain::APVmon >, 7 > Charge_1